Skip to content

Commit 64ab2d5

Browse files
committed
Rename legacy types.
For consistency, each now has a `_gcc` or `_gsv1` suffix indicating whether they were inherited from the GCC or GNUstep v1 ABI.
1 parent 48967e5 commit 64ab2d5

8 files changed

+33
-33
lines changed

category.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct objc_category
3737
struct objc_property_list *class_properties;
3838
};
3939

40-
struct objc_category_legacy
40+
struct objc_category_gcc
4141
{
4242
/**
4343
* The name of this category.
@@ -50,11 +50,11 @@ struct objc_category_legacy
5050
/**
5151
* The list of instance methods to add to the class.
5252
*/
53-
struct objc_method_list_legacy *instance_methods;
53+
struct objc_method_list_gcc *instance_methods;
5454
/**
5555
* The list of class methods to add to the class.
5656
*/
57-
struct objc_method_list_legacy *class_methods;
57+
struct objc_method_list_gcc *class_methods;
5858
/**
5959
* The list of protocols adopted by this category.
6060
*/

class.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct objc_class
144144
};
145145
// end: objc_class
146146

147-
struct legacy_gnustep_objc_class
147+
struct objc_class_gsv1
148148
{
149149
/**
150150
* Pointer to the metaclass for this class. The metaclass defines the
@@ -187,12 +187,12 @@ struct legacy_gnustep_objc_class
187187
/**
188188
* Metadata describing the instance variables in this class.
189189
*/
190-
struct objc_ivar_list_legacy *ivars;
190+
struct objc_ivar_list_gcc *ivars;
191191
/**
192192
* Metadata for for defining the mappings from selectors to IMPs. Linked
193193
* list of method list structures, one per class and one per category.
194194
*/
195-
struct objc_method_list_legacy *methods;
195+
struct objc_method_list_gcc *methods;
196196
/**
197197
* The dispatch table for this class. Intialized and maintained by the
198198
* runtime.
@@ -283,15 +283,15 @@ struct legacy_gnustep_objc_class
283283
* same fields, and you can test the new abi flag to tell whether it is safe to
284284
* access the subsequent fields.
285285
*/
286-
struct legacy_gcc_objc_class
286+
struct objc_class_gcc
287287
{
288288
struct objc_class *isa;
289289
struct objc_class *super_class;
290290
const char *name;
291291
long version;
292292
unsigned long info;
293293
long instance_size;
294-
struct objc_ivar_list_legacy *ivars;
294+
struct objc_ivar_list_gcc *ivars;
295295
struct objc_method_list *methods;
296296
void *dtable;
297297
struct objc_class *subclass_list;
@@ -375,7 +375,7 @@ static inline BOOL objc_test_class_flag(struct objc_class *aClass,
375375
return (aClass->info & (unsigned long)flag) == (unsigned long)flag;
376376
}
377377

378-
static inline BOOL objc_test_class_flag_legacy(struct legacy_gnustep_objc_class *aClass,
378+
static inline BOOL objc_test_class_flag_legacy(struct objc_class_gsv1 *aClass,
379379
enum objc_class_flags flag)
380380
{
381381
return (aClass->info & (unsigned long)flag) == (unsigned long)flag;
@@ -396,7 +396,7 @@ static inline int objc_get_class_version(struct objc_class *aClass)
396396
return aClass->abi_version + 1;
397397
}
398398

399-
static inline int objc_get_class_version_legacy(struct legacy_gnustep_objc_class *aClass)
399+
static inline int objc_get_class_version_legacy(struct objc_class_gsv1 *aClass)
400400
{
401401
if (!objc_test_class_flag_legacy(aClass, objc_class_flag_new_abi))
402402
{

class_table.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ PRIVATE BOOL objc_resolve_class(Class cls)
167167
}
168168
else
169169
{
170-
struct legacy_gnustep_objc_class *ocls = objc_legacy_class_for_class(cls);
170+
struct objc_class_gsv1 *ocls = objc_legacy_class_for_class(cls);
171171
if (ocls != NULL)
172172
{
173173
const char *super_name = (const char*)ocls->super_class;
@@ -258,7 +258,7 @@ PRIVATE BOOL objc_resolve_class(Class cls)
258258

259259
// Fix up the ivar offsets
260260
objc_compute_ivar_offsets(cls);
261-
struct legacy_gnustep_objc_class *oldCls = objc_legacy_class_for_class(cls);
261+
struct objc_class_gsv1 *oldCls = objc_legacy_class_for_class(cls);
262262
if (oldCls)
263263
{
264264
oldCls->super_class = cls->super_class;

ivar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ PRIVATE void objc_compute_ivar_offsets(Class class)
9191
}
9292
// If we have a legacy ivar list, update the offset in it too -
9393
// code from older compilers may access this directly!
94-
struct legacy_gnustep_objc_class* legacy = objc_legacy_class_for_class(class);
94+
struct objc_class_gsv1* legacy = objc_legacy_class_for_class(class);
9595
if (legacy)
9696
{
9797
for (i = 0 ; i < class->ivars->count ; i++)

ivar.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static inline ivar_ownership ivarGetOwnership(Ivar ivar)
7575
/**
7676
* Legacy ivar structure, inherited from the GCC ABI.
7777
*/
78-
struct objc_ivar_legacy
78+
struct objc_ivar_gcc
7979
{
8080
/**
8181
* Name of this instance variable.
@@ -123,7 +123,7 @@ struct objc_ivar_list
123123
/**
124124
* Legacy version of the ivar list
125125
*/
126-
struct objc_ivar_list_legacy
126+
struct objc_ivar_list_gcc
127127
{
128128
/**
129129
* The number of instance variables in this list.
@@ -133,6 +133,6 @@ struct objc_ivar_list_legacy
133133
* An array of instance variable metadata structures. Note that this array
134134
* has count elements.
135135
*/
136-
struct objc_ivar_legacy ivar_list[];
136+
struct objc_ivar_gcc ivar_list[];
137137
};
138138

legacy.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
PRIVATE size_t lengthOfTypeEncoding(const char *types);
1414

15-
static ivar_ownership ownershipForIvar(struct legacy_gnustep_objc_class *cls, int idx)
15+
static ivar_ownership ownershipForIvar(struct objc_class_gsv1 *cls, int idx)
1616
{
1717
if (objc_get_class_version_legacy(cls) < 2)
1818
{
@@ -29,9 +29,9 @@ static ivar_ownership ownershipForIvar(struct legacy_gnustep_objc_class *cls, in
2929
return ownership_unsafe;
3030
}
3131

32-
static struct objc_ivar_list *upgradeIvarList(struct legacy_gnustep_objc_class *cls)
32+
static struct objc_ivar_list *upgradeIvarList(struct objc_class_gsv1 *cls)
3333
{
34-
struct objc_ivar_list_legacy *l = cls->ivars;
34+
struct objc_ivar_list_gcc *l = cls->ivars;
3535
if (l == NULL)
3636
{
3737
return NULL;
@@ -69,7 +69,7 @@ static struct objc_ivar_list *upgradeIvarList(struct legacy_gnustep_objc_class *
6969
return n;
7070
}
7171

72-
static struct objc_method_list *upgradeMethodList(struct objc_method_list_legacy *old)
72+
static struct objc_method_list *upgradeMethodList(struct objc_method_list_gcc *old)
7373
{
7474
if (old == NULL)
7575
{
@@ -246,12 +246,12 @@ static struct objc_property_list *upgradePropertyList(struct objc_property_list_
246246

247247
static int legacy_key;
248248

249-
PRIVATE struct legacy_gnustep_objc_class* objc_legacy_class_for_class(Class cls)
249+
PRIVATE struct objc_class_gsv1* objc_legacy_class_for_class(Class cls)
250250
{
251-
return (struct legacy_gnustep_objc_class*)objc_getAssociatedObject((id)cls, &legacy_key);
251+
return (struct objc_class_gsv1*)objc_getAssociatedObject((id)cls, &legacy_key);
252252
}
253253

254-
PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass)
254+
PRIVATE Class objc_upgrade_class(struct objc_class_gsv1 *oldClass)
255255
{
256256
Class cls = calloc(sizeof(struct objc_class), 1);
257257
cls->isa = oldClass->isa;
@@ -268,16 +268,16 @@ PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass)
268268
objc_register_selectors_from_class(cls);
269269
if (!objc_test_class_flag(cls, objc_class_flag_meta))
270270
{
271-
cls->isa = objc_upgrade_class((struct legacy_gnustep_objc_class*)cls->isa);
271+
cls->isa = objc_upgrade_class((struct objc_class_gsv1*)cls->isa);
272272
objc_setAssociatedObject((id)cls, &legacy_key, (id)oldClass, OBJC_ASSOCIATION_ASSIGN);
273273
}
274274
return cls;
275275
}
276276

277-
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_legacy *old)
277+
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_gcc *old)
278278
{
279279
struct objc_category *cat = calloc(1, sizeof(struct objc_category));
280-
memcpy(cat, old, sizeof(struct objc_category_legacy));
280+
memcpy(cat, old, sizeof(struct objc_category_gcc));
281281
cat->instance_methods = upgradeMethodList(old->instance_methods);
282282
cat->class_methods = upgradeMethodList(old->class_methods);
283283
return cat;

legacy.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#include "category.h"
66
#include "protocol.h"
77

8-
PRIVATE Class objc_upgrade_class(struct legacy_gnustep_objc_class *oldClass);
9-
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_legacy *);
8+
PRIVATE Class objc_upgrade_class(struct objc_class_gsv1 *oldClass);
9+
PRIVATE struct objc_category *objc_upgrade_category(struct objc_category_gcc *);
1010

11-
PRIVATE struct legacy_gnustep_objc_class* objc_legacy_class_for_class(Class);
11+
PRIVATE struct objc_class_gsv1* objc_legacy_class_for_class(Class);
1212

1313
PRIVATE struct objc_protocol *objc_upgrade_protocol_gcc(struct objc_protocol_gcc*);
1414
PRIVATE struct objc_protocol *objc_upgrade_protocol_gsv1(struct objc_protocol_gsv1*);

method_list.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct objc_method
1717
const char *types;
1818
};
1919

20-
struct objc_method_legacy
20+
struct objc_method_gcc
2121
{
2222
/**
2323
* Selector used to send messages to this method. The type encoding of
@@ -66,18 +66,18 @@ struct objc_method_list
6666
/**
6767
* Legacy version of the method list.
6868
*/
69-
struct objc_method_list_legacy
69+
struct objc_method_list_gcc
7070
{
7171
/**
7272
* The next group of methods in the list.
7373
*/
74-
struct objc_method_list_legacy *next;
74+
struct objc_method_list_gcc *next;
7575
/**
7676
* The number of methods in this list.
7777
*/
7878
int count;
7979
/**
8080
* An array of methods. Note that the actual size of this is count.
8181
*/
82-
struct objc_method_legacy methods[];
82+
struct objc_method_gcc methods[];
8383
};

0 commit comments

Comments
 (0)