Overview
Comment: | OFMutableData: Resize in -[makeImmutable]
There is no point in keeping the unused capacity when items can no |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
bae49c5580f4ce96a8a24ee778e8b21a |
User & Date: | js on 2020-11-06 01:34:43 |
Other Links: | manifest | tags |
Context
2020-11-06
| ||
01:56 | OFString: Avoid -[allocMemoryWithSize:] check-in: 54d900fb66 user: js tags: trunk | |
01:34 | OFMutableData: Resize in -[makeImmutable] check-in: bae49c5580 user: js tags: trunk | |
01:23 | OFArray: Fix minor performance regression check-in: 51ea191cf4 user: js tags: trunk | |
Changes
Modified src/OFMutableData.m from [aec71097cd] to [c516ce707c].
︙ | ︙ | |||
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 |