@@ -195,11 +195,11 @@ { /* Classes containing data should reimplement this! */ return (uint32_t)(intptr_t)self; } -- addItemToMemoryPool: (void*)ptr +- addMemoryToPool: (void*)ptr { void **memchunks; size_t memchunks_size; memchunks_size = PRE_IVAR->memchunks_size + 1; @@ -208,21 +208,21 @@ memchunks_size > SIZE_MAX / sizeof(void*)) @throw [OFOutOfRangeException newWithClass: isa]; if ((memchunks = realloc(PRE_IVAR->memchunks, memchunks_size * sizeof(void*))) == NULL) - @throw [OFNoMemException newWithClass: isa - andSize: memchunks_size]; + @throw [OFOutOfMemoryException newWithClass: isa + andSize: memchunks_size]; PRE_IVAR->memchunks = memchunks; PRE_IVAR->memchunks[PRE_IVAR->memchunks_size] = ptr; PRE_IVAR->memchunks_size = memchunks_size; return self; } -- (void*)allocWithSize: (size_t)size +- (void*)allocMemoryWithSize: (size_t)size { void *ptr, **memchunks; size_t memchunks_size; if (size == 0) @@ -233,90 +233,91 @@ if (SIZE_MAX - PRE_IVAR->memchunks_size == 0 || memchunks_size > SIZE_MAX / sizeof(void*)) @throw [OFOutOfRangeException newWithClass: isa]; if ((ptr = malloc(size)) == NULL) - @throw [OFNoMemException newWithClass: isa - andSize: size]; + @throw [OFOutOfMemoryException newWithClass: isa + andSize: size]; if ((memchunks = realloc(PRE_IVAR->memchunks, memchunks_size * sizeof(void*))) == NULL) { free(ptr); - @throw [OFNoMemException newWithClass: isa - andSize: memchunks_size]; + @throw [OFOutOfMemoryException newWithClass: isa + andSize: memchunks_size]; } PRE_IVAR->memchunks = memchunks; PRE_IVAR->memchunks[PRE_IVAR->memchunks_size] = ptr; PRE_IVAR->memchunks_size = memchunks_size; return ptr; } -- (void*)allocNItems: (size_t)nitems - withSize: (size_t)size +- (void*)allocMemoryForNItems: (size_t)nitems + withSize: (size_t)size { if (nitems == 0 || size == 0) return NULL; if (nitems > SIZE_MAX / size) @throw [OFOutOfRangeException newWithClass: isa]; - return [self allocWithSize: nitems * size]; + return [self allocMemoryWithSize: nitems * size]; } -- (void*)resizeMem: (void*)ptr - toSize: (size_t)size +- (void*)resizeMemory: (void*)ptr + toSize: (size_t)size { void **iter; if (ptr == NULL) - return [self allocWithSize: size]; + return [self allocMemoryWithSize: size]; if (size == 0) { - [self freeMem: ptr]; + [self freeMemory: ptr]; return NULL; } iter = PRE_IVAR->memchunks + PRE_IVAR->memchunks_size; while (iter-- > PRE_IVAR->memchunks) { if (OF_UNLIKELY(*iter == ptr)) { if (OF_UNLIKELY((ptr = realloc(ptr, size)) == NULL)) - @throw [OFNoMemException newWithClass: isa - andSize: size]; + @throw [OFOutOfMemoryException + newWithClass: isa + andSize: size]; *iter = ptr; return ptr; } } - @throw [OFMemNotPartOfObjException newWithClass: isa - andPointer: ptr]; + @throw [OFMemoryNotPartOfObjectException newWithClass: isa + andPointer: ptr]; } -- (void*)resizeMem: (void*)ptr - toNItems: (size_t)nitems - withSize: (size_t)size +- (void*)resizeMemory: (void*)ptr + toNItems: (size_t)nitems + withSize: (size_t)size { if (ptr == NULL) - return [self allocNItems: nitems - withSize: size]; + return [self allocMemoryForNItems: nitems + withSize: size]; if (nitems == 0 || size == 0) { - [self freeMem: ptr]; + [self freeMemory: ptr]; return NULL; } if (nitems > SIZE_MAX / size) @throw [OFOutOfRangeException newWithClass: isa]; - return [self resizeMem: ptr - toSize: nitems * size]; + return [self resizeMemory: ptr + toSize: nitems * size]; } -- freeMem: (void*)ptr; +- freeMemory: (void*)ptr; { void **iter, *last, **memchunks; size_t i, memchunks_size; iter = PRE_IVAR->memchunks + PRE_IVAR->memchunks_size; @@ -354,12 +355,12 @@ return self; } } - @throw [OFMemNotPartOfObjException newWithClass: isa - andPointer: ptr]; + @throw [OFMemoryNotPartOfObjectException newWithClass: isa + andPointer: ptr]; } - retain { PRE_IVAR->retain_count++;