︙ | | | ︙ | |
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#import "macros.h"
#if defined(OF_OBJFW_RUNTIME)
# import <objfw-rt.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# import <objc/objc-api.h>
# import <objc/sarray.h>
#else
# import <objc/runtime.h>
#endif
#ifdef _WIN32
# include <windows.h>
#endif
|
>
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#import "macros.h"
#if defined(OF_OBJFW_RUNTIME)
# import <objfw-rt.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# import <objc/objc-api.h>
# import <objc/sarray.h>
# import <objc/Protocol.h>
#else
# import <objc/runtime.h>
#endif
#ifdef _WIN32
# include <windows.h>
#endif
|
︙ | | | ︙ | |
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
Class c;
struct objc_protocol_list *pl;
size_t i;
for (c = self; c != Nil; c = class_get_super_class(c))
for (pl = c->protocols; pl != NULL; pl = pl->next)
for (i = 0; i < pl->count; i++)
if ([pl->list[i] conformsToProtocol: protocol])
return YES;
return NO;
#else
Class c;
for (c = self; c != Nil; c = class_getSuperclass(c))
|
|
|
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
Class c;
struct objc_protocol_list *pl;
size_t i;
for (c = self; c != Nil; c = class_get_super_class(c))
for (pl = c->protocols; pl != NULL; pl = pl->next)
for (i = 0; i < pl->count; i++)
if ([pl->list[i] conformsTo: protocol])
return YES;
return NO;
#else
Class c;
for (c = self; c != Nil; c = class_getSuperclass(c))
|
︙ | | | ︙ | |
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
*/
return class_replaceMethod(((OFObject*)self)->isa, selector, newimp,
method_getTypeEncoding(method));
#endif
}
+ (IMP)replaceClassMethod: (SEL)selector
withMethodFromClass: (Class)class;
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
|
|
|
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
*/
return class_replaceMethod(((OFObject*)self)->isa, selector, newimp,
method_getTypeEncoding(method));
#endif
}
+ (IMP)replaceClassMethod: (SEL)selector
withMethodFromClass: (Class)class
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
|
︙ | | | ︙ | |
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
return class_replaceMethod(self, selector, newimp,
method_getTypeEncoding(method));
#endif
}
+ (IMP)replaceInstanceMethod: (SEL)selector
withMethodFromClass: (Class)class;
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
|
|
|
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
return class_replaceMethod(self, selector, newimp,
method_getTypeEncoding(method));
#endif
}
+ (IMP)replaceInstanceMethod: (SEL)selector
withMethodFromClass: (Class)class
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
|
︙ | | | ︙ | |
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
|
if (nitems > SIZE_MAX / size)
@throw [OFOutOfRangeException newWithClass: isa];
return [self resizeMemory: ptr
toSize: nitems * size];
}
- (void)freeMemory: (void*)ptr;
{
void **iter, *last, **memchunks;
size_t i, memchunks_size;
if (ptr == NULL)
return;
|
|
|
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
|
if (nitems > SIZE_MAX / size)
@throw [OFOutOfRangeException newWithClass: isa];
return [self resizeMemory: ptr
toSize: nitems * size];
}
- (void)freeMemory: (void*)ptr
{
void **iter, *last, **memchunks;
size_t i, memchunks_size;
if (ptr == NULL)
return;
|
︙ | | | ︙ | |