Differences From Artifact [84ddc75d7b]:
- File src/OFArray.m — part of check-in [9d74d1b74e] at 2020-11-06 02:12:39 on branch trunk — OFData: Make parameter order more consistent (user: js, size: 18211) [annotate] [blame] [check-ins using]
To Artifact [a1c992248d]:
- File
src/OFArray.m
— part of check-in
[a2b4238850]
at
2020-11-06 02:24:14
on branch trunk
— Future-proof some code using freeWhenDone
While -[OFData initWithDataNoCopy:count:itemSize:freeWhenDone:] can
currently never throw, it might in the future, and when it does so in
the future, these would be memory leaks then. (user: js, size: 18215) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
242 243 244 245 246 247 248 249 250 251 252 | { size_t count = self.count; id *buffer = of_malloc(count, sizeof(id)); @try { [self getObjects: buffer inRange: of_range(0, count)]; } @catch (id e) { free(buffer); @throw e; } | > > > > > < < < < < | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | { size_t count = self.count; id *buffer = of_malloc(count, sizeof(id)); @try { [self getObjects: buffer inRange: of_range(0, count)]; return [OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true].items; } @catch (id e) { free(buffer); @throw e; } } - (id)copy { return [self retain]; } |
︙ | ︙ |