ObjFW  Diff

Differences From Artifact [b7bf801aac]:

  • File src/autorelease-foundation.m — part of check-in [9d802a786d] at 2025-01-01 12:58:18 on branch trunk — Update copyright (user: js size: 1410)

To Artifact [42c2973f24]:

  • File src/autorelease-foundation.m — part of check-in [21f9b3bab8] at 2025-03-17 20:20:35 on branch trunk — Optimize autorelease pools on macOS Leopard (user: js size: 1507) [more...]

25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 * need to use the implementation from Foundation to make ObjFWBridge work. We
 * can't use the ObjFWRT implementation as that would result in two parallel
 * autorelease pool chains.
 */

#include "config.h"

#import <Foundation/Foundation.h>



void *
objc_autoreleasePoolPush(void)
{
	return [[NSAutoreleasePool alloc] init];
}

void
objc_autoreleasePoolPop(void *pool)
{
	return [(id)pool drain];
}

id
_objc_rootAutorelease(id object)
{
	[NSAutoreleasePool addObject: object];

	return object;
}







|
>
>




|





|





|



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 * need to use the implementation from Foundation to make ObjFWBridge work. We
 * can't use the ObjFWRT implementation as that would result in two parallel
 * autorelease pool chains.
 */

#include "config.h"

extern void *NSPushAutoreleasePool(unsigned int count);
extern void NSPopAutoreleasePool(void *pool);
extern void NSAutoreleaseObject(id object);

void *
objc_autoreleasePoolPush(void)
{
	return NSPushAutoreleasePool(0);
}

void
objc_autoreleasePoolPop(void *pool)
{
	NSPopAutoreleasePool(pool);
}

id
_objc_rootAutorelease(id object)
{
	NSAutoreleaseObject(object);

	return object;
}