Differences From Artifact [aec71097cd]:
- File src/OFMutableData.m — part of check-in [1a70abc65d] at 2020-11-06 01:11:51 on branch trunk — OF*Data: Avoid -[allocMemoryWithSize:] (user: js, size: 6446) [annotate] [blame] [check-ins using]
To Artifact [c516ce707c]:
- File
src/OFMutableData.m
— part of check-in
[bae49c5580]
at
2020-11-06 01:34:43
on branch trunk
— OFMutableData: Resize in -[makeImmutable]
There is no point in keeping the unused capacity when items can no
longer be added. (user: js, size: 6657) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
305 306 307 308 309 310 311 312 313 314 | return [[OFData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } - (void)makeImmutable { object_setClass(self, [OFData class]); } @end | > > > > > > > > > | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | return [[OFData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } - (void)makeImmutable { if (_capacity != _count) { @try { _items = of_realloc(_items, _count, _itemSize); _capacity = _count; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } object_setClass(self, [OFData class]); } @end |