Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -829,38 +829,10 @@ * size or count is 0. */ - (nullable void *)allocMemoryWithSize: (size_t)size count: (size_t)count OF_WARN_UNUSED_RESULT; -/** - * @brief Allocates memory, initializes it with zeros and stores it in the - * object's memory pool. - * - * It will be free'd automatically when the object is deallocated. - * - * @param size The size of the memory to allocate - * @return A pointer to the allocated memory. May return NULL if the specified - * size is 0. - */ -- (nullable void *)allocZeroedMemoryWithSize: (size_t)size - OF_WARN_UNUSED_RESULT; - -/** - * @brief Allocates memory for the specified number of items, initializes it - * with zeros and stores it in the object's memory pool. - * - * It will be free'd automatically when the object is deallocated. - * - * @param size The size of each item to allocate - * @param count The number of items to allocate - * @return A pointer to the allocated memory. May return NULL if the specified - * size or count is 0. - */ -- (nullable void *)allocZeroedMemoryWithSize: (size_t)size - count: (size_t)count - OF_WARN_UNUSED_RESULT; - /** * @brief Resizes memory in the object's memory pool to the specified size. * * If the pointer is NULL, this is equivalent to allocating memory. * If the size is 0, this is equivalent to freeing memory. Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -1140,49 +1140,10 @@ @throw [OFOutOfRangeException exception]; return [self allocMemoryWithSize: size * count]; } -- (void *)allocZeroedMemoryWithSize: (size_t)size -{ - void *pointer; - struct pre_mem *preMem; - - if OF_UNLIKELY (size == 0) - return NULL; - - if OF_UNLIKELY (size > SIZE_MAX - PRE_IVARS_ALIGN) - @throw [OFOutOfRangeException exception]; - - if OF_UNLIKELY ((pointer = calloc(1, PRE_MEM_ALIGN + size)) == NULL) - @throw [OFOutOfMemoryException - exceptionWithRequestedSize: size]; - - preMem = pointer; - preMem->owner = self; - preMem->prev = PRE_IVARS->lastMem; - - if OF_LIKELY (PRE_IVARS->lastMem != NULL) - PRE_IVARS->lastMem->next = preMem; - - if OF_UNLIKELY (PRE_IVARS->firstMem == NULL) - PRE_IVARS->firstMem = preMem; - - PRE_IVARS->lastMem = preMem; - - return (char *)pointer + PRE_MEM_ALIGN; -} - -- (void *)allocZeroedMemoryWithSize: (size_t)size - count: (size_t)count -{ - if OF_UNLIKELY (count > SIZE_MAX / size) - @throw [OFOutOfRangeException exception]; - - return [self allocZeroedMemoryWithSize: size * count]; -} - - (void *)resizeMemory: (void *)pointer size: (size_t)size { void *new; struct pre_mem *preMem;