ObjFW  Diff

Differences From Artifact [06405e2bb2]:

To Artifact [c1b6db103b]:


15
16
17
18
19
20
21

22
23
24
25
26
27
28
 */

#include "config.h"

#include <stdlib.h>

#import "OFAutoreleasePool.h"


#import "macros.h"
#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
# import "threading.h"

# import "OFInitializationFailedException.h"
#endif







>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 */

#include "config.h"

#include <stdlib.h>

#import "OFAutoreleasePool.h"
#import "OFAutoreleasePool+Private.h"

#import "macros.h"
#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
# import "threading.h"

# import "OFInitializationFailedException.h"
#endif
73
74
75
76
77
78
79
















80
81
82
83
84
85
86
	return [super alloc];
}

+ (id)addObject: (id)object
{
	return _objc_rootAutorelease(object);
}

















- init
{
	self = [super init];

	@try {
		_pool = objc_autoreleasePoolPush();







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







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
	return [super alloc];
}

+ (id)addObject: (id)object
{
	return _objc_rootAutorelease(object);
}

+ (void)OF_handleThreadTermination
{
#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
	OFAutoreleasePool **cache = of_tlskey_get(cacheKey);
#endif
	size_t i;

	if (cache != NULL) {
		for (i = 0; i < MAX_CACHE_SIZE; i++)
			[cache[i] OF_super_dealloc];

		free(cache);
		cache = NULL;
	}
}

- init
{
	self = [super init];

	@try {
		_pool = objc_autoreleasePoolPush();
111
112
113
114
115
116
117





118
119
120
121
122
123
124
	[self dealloc];
}

- (void)drain
{
	[self dealloc];
}






- (void)dealloc
{
#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
	OFAutoreleasePool **cache = of_tlskey_get(cacheKey);
#endif








>
>
>
>
>







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	[self dealloc];
}

- (void)drain
{
	[self dealloc];
}

- (void)OF_super_dealloc
{
	[super dealloc];
}

- (void)dealloc
{
#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
	OFAutoreleasePool **cache = of_tlskey_get(cacheKey);
#endif