226 :(NSMutableSet *)objects
227{
229 id *keys = NULL;
230 id *values = NULL;
231 NSDictionary *result =
nil;
232 BOOL tempObjects = NO;
233
234 count = [
self count];
235 if (
count == 0)
return [[NSDictionary dictionary] retain];
236
237 keys = malloc(
sizeof *keys *
count);
238 values = malloc(
sizeof *values *
count);
239 if (keys == NULL || values == NULL)
240 {
241 free(keys);
242 free(values);
243 [NSException raise:NSMallocException format:@"Failed to allocate space for %lu objects in %s.", (unsigned long)count, __PRETTY_FUNCTION__];
244 }
245
246
248 {
249 objects = [[NSMutableSet alloc] init];
250 tempObjects = YES;
251 }
252
253 @try
254 {
255 i = 0;
257
259 {
260 keys[i] = [key ooDeepCopyWithSharedObjects:objects];
261 values[i] = [[self objectForKey:key] ooDeepCopyWithSharedObjects:objects];
262 i++;
263 }
264
265
266 result = [[NSDictionary alloc] initWithObjects:values forKeys:keys count:count];
267 }
268 @finally
269 {
270
271 for (i = 0; i <
count; i++)
272 {
273 [keys[i] release];
274 [values[i] release];
275 }
276
277 free(keys);
278 free(values);
279 if (tempObjects) [objects release];
280 }
281
282
283 return result;
284}
#define foreachkey(VAR, DICT)