ObjFW  Diff

Differences From Artifact [5bcc5ee828]:

To Artifact [4d907e6ad8]:


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
+ (void)addToPool: (OFObject*)obj
{
	OFList *pool_list;

	@try {
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	} @catch (OFNotInSetException *e) {
		[e free];
		[[self alloc] init];
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	}

	if ([pool_list last] == NULL)
		[[self alloc] init];








|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
+ (void)addToPool: (OFObject*)obj
{
	OFList *pool_list;

	@try {
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	} @catch (OFNotInSetException *e) {
		[e dealloc];
		[[self alloc] init];
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	}

	if ([pool_list last] == NULL)
		[[self alloc] init];

69
70
71
72
73
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
104
105
106
107
108
	self = [super init];

	objects = nil;

	@try {
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	} @catch (OFNotInSetException *e) {
		[e free];
		pool_list = [[OFList alloc] initWithoutRetainAndRelease];
		[OFThread setObject: pool_list
			  forTLSKey: pool_list_key];
		[pool_list release];
	}

	listobj = [pool_list append: self];

	return self;
}

- free
{
	/*
	 * FIXME:
	 * Maybe we should get the objects ourself, release them and then
	 * release the pool without calling its release method? This way,
	 * there wouldn't be a recursion.
	 */
	if (listobj->next != NULL)
		[listobj->next->object release];

	[[OFThread objectForTLSKey: pool_list_key] remove: listobj];

	return [super free];
}

- addToPool: (OFObject*)obj
{
	if (objects == nil)
		objects = [[OFArray alloc] init];








|











|












|







69
70
71
72
73
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
104
105
106
107
108
	self = [super init];

	objects = nil;

	@try {
		pool_list = [OFThread objectForTLSKey: pool_list_key];
	} @catch (OFNotInSetException *e) {
		[e dealloc];
		pool_list = [[OFList alloc] initWithoutRetainAndRelease];
		[OFThread setObject: pool_list
			  forTLSKey: pool_list_key];
		[pool_list release];
	}

	listobj = [pool_list append: self];

	return self;
}

- (void)dealloc
{
	/*
	 * FIXME:
	 * Maybe we should get the objects ourself, release them and then
	 * release the pool without calling its release method? This way,
	 * there wouldn't be a recursion.
	 */
	if (listobj->next != NULL)
		[listobj->next->object release];

	[[OFThread objectForTLSKey: pool_list_key] remove: listobj];

	[super dealloc];
}

- addToPool: (OFObject*)obj
{
	if (objects == nil)
		objects = [[OFArray alloc] init];