ObjFW  Check-in [0708d6f152]

Overview
Comment:Fix a leak in OFIntrospection with the Apple runtime.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0708d6f152b82dd7becc7434b488a24510bf44e83e5399d95b54f7f44e219996
User & Date: js on 2011-07-29 21:52:53
Other Links: manifest | tags
Context
2011-07-29
21:54
Add +[inheritInstanceMethodsFromClass:] to OFObject. check-in: bf0f10966f user: js tags: trunk
21:52
Fix a leak in OFIntrospection with the Apple runtime. check-in: 0708d6f152 user: js tags: trunk
21:34
OFConstantString: -[completeInitialization] -> -[finishInitialization]. check-in: 2caeadf65a user: js tags: trunk
Changes

Modified src/OFIntrospection.m from [e9f75e8e35] to [6307d1d02a].

11
12
13
14
15
16
17


18
19
20
21
22
23
24
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"



#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
# import <objc/runtime.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# import <objc/objc-api.h>
#endif








>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdlib.h>

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
# import <objc/runtime.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# import <objc/objc-api.h>
#endif

112
113
114
115
116
117
118

119
120
121

122
123


124

125

126
127
128

129



130
131
132
133
134
135
136
		unsigned i, count;

		classMethods = [[OFMutableArray alloc] init];
		instanceMethods = [[OFMutableArray alloc] init];

		methodList = class_copyMethodList(((OFObject*)class)->isa,
		    &count);

		for (i = 0; i < count; i++) {
			[classMethods addObject: [[[OFMethod alloc]
			    _initWithMethod: methodList[i]] autorelease]];

			[pool releaseObjects];
		}




		methodList = class_copyMethodList(class, &count);

		for (i = 0; i < count; i++) {
			[instanceMethods addObject: [[[OFMethod alloc]
			    _initWithMethod: methodList[i]] autorelease]];

			[pool releaseObjects];



		}
#elif defined(OF_OLD_GNU_RUNTIME)
		MethodList_t methodList;

		classMethods = [[OFMutableArray alloc] init];
		instanceMethods = [[OFMutableArray alloc] init];








>
|
|
|
>
|
|
>
>
|
>

>
|
|
|
>
|
>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
		unsigned i, count;

		classMethods = [[OFMutableArray alloc] init];
		instanceMethods = [[OFMutableArray alloc] init];

		methodList = class_copyMethodList(((OFObject*)class)->isa,
		    &count);
		@try {
			for (i = 0; i < count; i++) {
				[classMethods addObject: [[[OFMethod alloc]
				    _initWithMethod: methodList[i]]
				    autorelease]];
				[pool releaseObjects];
			}
		} @finally {
			free(methodList);
		}

		methodList = class_copyMethodList(class, &count);
		@try {
			for (i = 0; i < count; i++) {
				[instanceMethods addObject: [[[OFMethod alloc]
				    _initWithMethod: methodList[i]]
				    autorelease]];
				[pool releaseObjects];
			}
		} @finally {
			free(methodList);
		}
#elif defined(OF_OLD_GNU_RUNTIME)
		MethodList_t methodList;

		classMethods = [[OFMutableArray alloc] init];
		instanceMethods = [[OFMutableArray alloc] init];