@@ -88,11 +88,11 @@ @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; - _items = of_alloc(capacity, itemSize); + _items = OFAllocMemory(capacity, itemSize); _itemSize = itemSize; _capacity = capacity; _freeWhenDone = true; } @catch (id e) { [self release]; @@ -119,11 +119,11 @@ freeWhenDone: (bool)freeWhenDone { self = [self initWithItems: items count: count itemSize: itemSize]; if (freeWhenDone) - free(items); + OFFreeMemory(items); return self; } - (instancetype)initWithStringRepresentation: (OFString *)string @@ -179,11 +179,11 @@ { if (SIZE_MAX - _count < 1) @throw [OFOutOfRangeException exception]; if (_count + 1 > _capacity) { - _items = of_realloc(_items, _count + 1, _itemSize); + _items = OFResizeMemory(_items, _count + 1, _itemSize); _capacity = _count + 1; } memcpy(_items + _count * _itemSize, item, _itemSize); @@ -199,11 +199,11 @@ { if (count > SIZE_MAX - _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { - _items = of_realloc(_items, _count + count, _itemSize); + _items = OFResizeMemory(_items, _count + count, _itemSize); _capacity = _count + count; } memcpy(_items + _count * _itemSize, items, count * _itemSize); _count += count; @@ -215,11 +215,11 @@ { if (count > SIZE_MAX - _count || idx > _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { - _items = of_realloc(_items, _count + count, _itemSize); + _items = OFResizeMemory(_items, _count + count, _itemSize); _capacity = _count + count; } memmove(_items + (idx + count) * _itemSize, _items + idx * _itemSize, (_count - idx) * _itemSize); @@ -232,11 +232,11 @@ { if (count > SIZE_MAX - _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { - _items = of_realloc(_items, _count + count, _itemSize); + _items = OFResizeMemory(_items, _count + count, _itemSize); _capacity = _count + count; } memset(_items + _count * _itemSize, '\0', count * _itemSize); _count += count; @@ -257,11 +257,11 @@ _items + (range.location + range.length) * _itemSize, (_count - range.location - range.length) * _itemSize); _count -= range.length; @try { - _items = of_realloc(_items, _count, _itemSize); + _items = OFResizeMemory(_items, _count, _itemSize); _capacity = _count; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } @@ -271,20 +271,20 @@ if (_count == 0) return; _count--; @try { - _items = of_realloc(_items, _count, _itemSize); + _items = OFResizeMemory(_items, _count, _itemSize); _capacity = _count; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } - (void)removeAllItems { - free(_items); + OFFreeMemory(_items); _items = NULL; _count = 0; _capacity = 0; } @@ -297,15 +297,15 @@ - (void)makeImmutable { if (_capacity != _count) { @try { - _items = of_realloc(_items, _count, _itemSize); + _items = OFResizeMemory(_items, _count, _itemSize); _capacity = _count; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } object_setClass(self, [OFData class]); } @end