ObjFW  Check-in [4c343b7841]

Overview
Comment:Take care of the root metaclass's super being the root class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4c343b7841d0f5651ec1d25ce1f2f17c51bd8de19c9cf3950ee9fffd7f23a3a5
User & Date: js on 2009-06-02 17:21:55
Other Links: manifest | tags
Context
2009-06-02
19:25
Improve -[readLine] in OFStream. check-in: f1dae95070 user: js tags: trunk
17:21
Take care of the root metaclass's super being the root class. check-in: 4c343b7841 user: js tags: trunk
2009-06-01
20:36
Add objfw.h which includes everything.
Only importing what you really need is preferred, though.
check-in: f8b652cc27 user: js tags: trunk
Changes

Modified src/OFConstString.m from [3c89cd8ab2] to [be48d08a96].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

- (void)release
{
}

- (size_t)retainCount
{
	return 1;
}

- autorelease
{
	return self;
}
@end







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

- (void)release
{
}

- (size_t)retainCount
{
	return SIZE_MAX;
}

- autorelease
{
	return self;
}
@end

Modified src/OFExceptions.h from [cd34df0695] to [1fccb40947].

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#import "OFString.h"

/**
 * An exception indicating an object could not be allocated.
 *
 * This exception is preallocated, as if there's no memory, no exception can
 * be allocated of course. That's why you shouldn't and even can't deallocate
 *it.
 *
 * This is the only exception that is not an OFException as it's special.
 * It does not know for which class allocation failed and it should not be
 * handled like other exceptions, as the exception handling code is not
 * allowed to allocate ANY memory.
 */
@interface OFAllocFailedException







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#import "OFString.h"

/**
 * An exception indicating an object could not be allocated.
 *
 * This exception is preallocated, as if there's no memory, no exception can
 * be allocated of course. That's why you shouldn't and even can't deallocate
 * it.
 *
 * This is the only exception that is not an OFException as it's special.
 * It does not know for which class allocation failed and it should not be
 * handled like other exceptions, as the exception handling code is not
 * allowed to allocate ANY memory.
 */
@interface OFAllocFailedException

Modified src/OFObject.h from [3ce907fa27] to [60d0648156].

221
222
223
224
225
226
227




















228
229
230
231
232
233
234
- (void)release;

/**
 * Deallocates the object and also frees all memory allocated via its memory
 * pool.
 */
- (void)dealloc;




















@end

/**
 * Objects implementing this protocol can be copied.
 */
@protocol OFCopying
/**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
- (void)release;

/**
 * Deallocates the object and also frees all memory allocated via its memory
 * pool.
 */
- (void)dealloc;

/*
 * Those are needed as the root class is the superclass of the root class's
 * metaclass and thus instance methods can be sent to class objects as well.
 */
+ addMemoryToPool: (void*)ptr;
+ (void*)allocMemoryWithSize: (size_t)size;
+ (void*)allocMemoryForNItems: (size_t)nitems
		     withSize: (size_t)size;
+ (void*)resizeMemory: (void*)ptr
	       toSize: (size_t)size;
+ (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size;
+ freeMemory: (void*)ptr;
+ retain;
+ autorelease;
+ (size_t)retainCount;
+ (void)release;
+ (void)dealloc;
@end

/**
 * Objects implementing this protocol can be copied.
 */
@protocol OFCopying
/**

Modified src/OFObject.m from [089ffd7efa] to [936af7ddb3].

424
425
426
427
428
429
430



































































431
		free(*iter);

	if (PRE_IVAR->memchunks != NULL)
		free(PRE_IVAR->memchunks);

	free((char*)self - PRE_IVAR_ALIGN);
}



































































@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
		free(*iter);

	if (PRE_IVAR->memchunks != NULL)
		free(PRE_IVAR->memchunks);

	free((char*)self - PRE_IVAR_ALIGN);
}

/*
 * Those are needed as the root class is the superclass of the root class's
 * metaclass and thus instance methods can be sent to class objects as well.
 */
+ addMemoryToPool: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ (void*)allocMemoryForNItems: (size_t)nitems
                     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ (void*)resizeMemory: (void*)ptr
	       toSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: self
					   andSelector: _cmd];
}

+ retain
{
	return self;
}

+ autorelease
{
	return self;
}

+ (size_t)retainCount
{
	return SIZE_MAX;
}

+ (void)release
{
}

+ (void)dealloc
{
}
@end