Differences From Artifact [8b4c9a4782]:
- File
src/OFDictionary.m
— part of check-in
[9338313079]
at
2009-05-05 14:00:10
on branch trunk
— There is a good reason to return id and not OFObject*.
When using OFObject*, you have to cast to get rid of a warning when
calling methods on the returned object. (user: js, size: 4574) [annotate] [blame] [check-ins using]
To Artifact [967868d132]:
- File src/OFDictionary.m — part of check-in [9e6dd00ef5] at 2009-05-13 20:31:38 on branch trunk — Rename - free to - (void)dealloc. (user: js, size: 4600) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 | size = 4096; @try { data = [self allocNItems: size withSize: sizeof(OFList*)]; } @catch (OFException *e) { /* | | | | | | | | | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 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 | size = 4096; @try { data = [self allocNItems: size withSize: sizeof(OFList*)]; } @catch (OFException *e) { /* * We can't use [super dealloc] on OS X here. Compiler bug? * Anyway, set size to 0 so that [self dealloc] works. */ size = 0; [self dealloc]; @throw e; } memset(data, 0, size * sizeof(OFList*)); return self; } - initWithHashSize: (int)hashsize { self = [super init]; if (hashsize < 8 || hashsize >= 28) { Class c = isa; [super dealloc]; @throw [OFInvalidArgumentException newWithClass: c andSelector: _cmd]; } size = (size_t)1 << hashsize; @try { data = [self allocNItems: size withSize: sizeof(OFList*)]; } @catch (OFException *e) { /* * We can't use [super dealloc] on OS X here. Compiler bug? * Anyway, set size to 0 so that [self dealloc] works. */ size = 0; [self dealloc]; @throw e; } memset(data, 0, size * sizeof(OFList*)); return self; } - (void)dealloc { size_t i; for (i = 0; i < size; i++) if (data[i] != nil) [data[i] release]; [super dealloc]; } - set: (OFObject*)key to: (OFObject*)obj { uint32_t hash; of_list_object_t *iter; |
︙ | ︙ |