Differences From Artifact [1029a1bdaf]:
- File src/OFValue.m — part of check-in [d0ae3bfd6c] at 2020-10-25 23:33:09 on branch trunk — Add of_{malloc,calloc,realloc,free} (user: js, size: 6191) [annotate] [blame] [check-ins using]
To Artifact [3be7f2e37d]:
- File
src/OFValue.m
— part of check-in
[3d8286feee]
at
2020-11-04 23:18:25
on branch trunk
— Remove of_free()
While it makes sense to wrap malloc and calloc to replace the error
checking with exceptions, it does not make sense to wrap free. (user: js, size: 6176) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
183 184 185 186 187 188 189 | size = of_sizeof_type_encoding(objCType); value = of_malloc(1, size); @try { otherValue = of_malloc(1, size); } @catch (id e) { | | | | | 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 | size = of_sizeof_type_encoding(objCType); value = of_malloc(1, size); @try { otherValue = of_malloc(1, size); } @catch (id e) { free(value); @throw e; } @try { [self getValue: value size: size]; [object getValue: otherValue size: size]; ret = (memcmp(value, otherValue, size) == 0); } @finally { free(value); free(otherValue); } return ret; } - (unsigned long)hash { |
︙ | ︙ | |||
220 221 222 223 224 225 226 | OF_HASH_INIT(hash); for (size_t i = 0; i < size; i++) OF_HASH_ADD(hash, value[i]); OF_HASH_FINALIZE(hash); } @finally { | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | OF_HASH_INIT(hash); for (size_t i = 0; i < size; i++) OF_HASH_ADD(hash, value[i]); OF_HASH_FINALIZE(hash); } @finally { free(value); } return hash; } - (id)copy { |
︙ | ︙ | |||
321 322 323 324 325 326 327 | for (size_t i = 0; i < size; i++) { if (i > 0) [ret appendString: @" "]; [ret appendFormat: @"%02x", value[i]]; } } @finally { | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | for (size_t i = 0; i < size; i++) { if (i > 0) [ret appendString: @" "]; [ret appendFormat: @"%02x", value[i]]; } } @finally { free(value); } [ret appendString: @">"]; [ret makeImmutable]; return ret; } @end |