Overview
Comment: | Add - changeHashSize: to OFDictionary. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5e77541e4d439463a3c0c021d964be9a |
User & Date: | js on 2009-05-04 17:27:17 |
Other Links: | manifest | tags |
Context
2009-05-04
| ||
17:54 | Add - items to OFList. check-in: 59ab431af4 user: js tags: trunk | |
17:27 | Add - changeHashSize: to OFDictionary. check-in: 5e77541e4d user: js tags: trunk | |
16:57 | Fix wrong memset in OFDictionary. check-in: 27a9132794 user: js tags: trunk | |
Changes
Modified src/OFDictionary.h from [0e40b77f27] to [a9019ce8f0].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 | - + - + - + - + - + + + + + + + + | /** * Creates a new OFDictionary, defaulting to a 12 bit hash. * * \return A new autoreleased OFDictionary */ + dictionary; |
Modified src/OFDictionary.m from [3e22e7bae1] to [4972fbd8f3].
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | + | #import "config.h" #include <string.h> #import "OFDictionary.h" #import "OFIterator.h" #import "OFExceptions.h" #import "OFMacros.h" /* Reference for static linking */ void _reference_to_OFIterator_in_OFDictionary() { [OFIterator class]; } @implementation OFDictionary + dictionary; { |
︙ | |||
54 55 56 57 58 59 60 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - + - + - - + | return self; } - initWithHashSize: (int)hashsize { self = [super init]; |
︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | return self; } } @throw [OFNotInSetException newWithClass: isa]; } - changeHashSize: (int)hashsize { OFList **newdata; size_t newsize, i; of_list_object_t *iter; if (hashsize < 8 || hashsize >= 28) @throw [OFInvalidArgumentException newWithClass: isa andSelector: _cmd]; newsize = (size_t)1 << hashsize; newdata = [self allocNItems: newsize withSize: sizeof(OFList*)]; memset(data, 0, newsize * sizeof(OFList*)); for (i = 0; i < size; i++) { if (OF_LIKELY(data[i] == nil)) continue; for (iter = [data[i] first]; iter != NULL; iter = iter->next->next) { uint32_t hash = [iter->object hash] & (newsize - 1); if (newdata[hash] == nil) newdata[hash] = [[OFList alloc] init]; [newdata[hash] append: iter->object]; [newdata[hash] append: iter->next->object]; } [data[i] release]; } [self freeMem: data]; data = newdata; size = newsize; return self; } /* FIXME: Implement this! */ /* - (BOOL)isEqual { } */ @end |
Modified tests/OFDictionary/OFDictionary.m from [51f348148f] to [4a94ec8c60].
︙ | |||
38 39 40 41 42 43 44 | 38 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 104 105 106 107 108 109 110 | - + - + - + + + + + + + + + + + + - + - + - + - + | [dict set: key1 to: value1]; [dict set: key2 to: value2]; [pool release]; if (strcmp([[dict get: @"key1"] cString], "value1")) { |