Differences From Artifact [3138cd18bb]:
- File
src/OFDictionary_hashtable.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 9023) [annotate] [blame] [check-ins using]
To Artifact [0f9f60ec04]:
- File
src/OFDictionary_hashtable.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 9037) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
26 27 28 29 30 31 32 | #import "OFString.h" #import "OFXMLElement.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #import "OFString.h" #import "OFXMLElement.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" static void * copy(void *object) { return [(id)object copy]; } static void * retain(void *object) { return [(id)object retain]; } static void release(void *object) |
︙ | ︙ | |||
92 93 94 95 96 97 98 | [self release]; @throw e; } return self; } | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | [self release]; @throw e; } return self; } - initWithDictionary: (OFDictionary *)dictionary { size_t count; if (dictionary == nil) return [self init]; if ([dictionary isKindOfClass: [OFDictionary_hashtable class]] || [dictionary isKindOfClass: [OFMutableDictionary_hashtable class]]) { self = [super init]; @try { OFDictionary_hashtable *dictionary_ = (OFDictionary_hashtable *)dictionary; _mapTable = [dictionary_->_mapTable copy]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
162 163 164 165 166 167 168 | [self release]; @throw e; } return self; } | | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | [self release]; @throw e; } return self; } - initWithObjects: (id const *)objects forKeys: (id const *)keys count: (size_t)count { self = [self initWithCapacity: count]; @try { size_t i; |
︙ | ︙ | |||
236 237 238 239 240 241 242 | [self release]; @throw e; } return self; } | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFArray *keys, *objects; OFEnumerator *keyEnumerator, *objectEnumerator; |
︙ | ︙ | |||
314 315 316 317 318 319 320 | { OFDictionary_hashtable *dictionary_; if (![dictionary isKindOfClass: [OFDictionary_hashtable class]] && ![dictionary isKindOfClass: [OFMutableDictionary_hashtable class]]) return [super isEqual: dictionary]; | | | | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | { OFDictionary_hashtable *dictionary_; if (![dictionary isKindOfClass: [OFDictionary_hashtable class]] && ![dictionary isKindOfClass: [OFMutableDictionary_hashtable class]]) return [super isEqual: dictionary]; dictionary_ = (OFDictionary_hashtable *)dictionary; return [dictionary_->_mapTable isEqual: _mapTable]; } - (bool)containsObject: (id)object { return [_mapTable containsObject: object]; } - (bool)containsObjectIdenticalTo: (id)object { return [_mapTable containsObjectIdenticalTo: object]; } - (OFArray *)allKeys { OFArray *ret; id *keys; size_t count; count = [_mapTable count]; keys = [self allocMemoryWithSize: sizeof(*keys) |
︙ | ︙ | |||
364 365 366 367 368 369 370 | } @finally { [self freeMemory: keys]; } return ret; } | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | } @finally { [self freeMemory: keys]; } return ret; } - (OFArray *)allObjects { OFArray *ret; id *objects; size_t count; count = [_mapTable count]; objects = [self allocMemoryWithSize: sizeof(*objects) |
︙ | ︙ | |||
399 400 401 402 403 404 405 | } @finally { [self freeMemory: objects]; } return ret; } | | | | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | } @finally { [self freeMemory: objects]; } return ret; } - (OFEnumerator *)keyEnumerator { return [[[OFMapTable_EnumeratorWrapper alloc] initWithEnumerator: [_mapTable keyEnumerator] object: self] autorelease]; } - (OFEnumerator *)objectEnumerator { return [[[OFMapTable_EnumeratorWrapper alloc] initWithEnumerator: [_mapTable objectEnumerator] object: self] autorelease]; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects count: (int)count { return [_mapTable countByEnumeratingWithState: state objects: objects count: count]; } |
︙ | ︙ |