@@ -1019,11 +1019,11 @@ * to use -[initWithUTF8StringNoCopy:length:freeWhenDone:]. */ if (SIZE_MAX - (size_t)fileSize < 1) @throw [OFOutOfRangeException exception]; - tmp = of_malloc((size_t)fileSize + 1, 1); + tmp = of_alloc((size_t)fileSize + 1, 1); @try { file = [[OFFile alloc] initWithPath: path mode: @"r"]; [file readIntoBuffer: tmp @@ -1380,11 +1380,11 @@ char *cString; size_t cStringLength; switch (encoding) { case OF_STRING_ENCODING_UTF_8: - cString = of_malloc((length * 4) + 1, 1); + cString = of_alloc((length * 4) + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: (length * 4) + 1 @@ -1413,11 +1413,11 @@ case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_CODEPAGE_858: case OF_STRING_ENCODING_MAC_ROMAN: case OF_STRING_ENCODING_KOI8_R: case OF_STRING_ENCODING_KOI8_U: - cString = of_malloc(length + 1, 1); + cString = of_alloc(length + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: length + 1 encoding: encoding @@ -1867,11 +1867,11 @@ pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; - characters = of_malloc(range.length, sizeof(of_unichar_t)); + characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { @@ -1935,11 +1935,11 @@ return OF_NOT_FOUND; if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; - characters = of_malloc(range.length, sizeof(of_unichar_t)); + characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { @@ -2178,11 +2178,11 @@ bool hasPrefix; if ((prefixLength = prefix.length) > self.length) return false; - tmp = of_malloc(prefixLength, sizeof(of_unichar_t)); + tmp = of_alloc(prefixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(0, prefixLength)]; @@ -2208,11 +2208,11 @@ if ((suffixLength = suffix.length) > self.length) return false; length = self.length; - tmp = of_malloc(suffixLength, sizeof(of_unichar_t)); + tmp = of_alloc(suffixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(length - suffixLength, @@ -2501,11 +2501,11 @@ - (const of_unichar_t *)characters { size_t length = self.length; of_unichar_t *buffer; - buffer = of_malloc(length, sizeof(of_unichar_t)); + buffer = of_alloc(length, sizeof(of_unichar_t)); @try { [self getCharacters: buffer inRange: of_range(0, length)]; return [[OFData dataWithItemsNoCopy: buffer @@ -2531,11 +2531,11 @@ of_char16_t *buffer; size_t j; bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); /* Allocate memory for the worst case */ - buffer = of_malloc((length + 1) * 2, sizeof(of_char16_t)); + buffer = of_alloc((length + 1) * 2, sizeof(of_char16_t)); j = 0; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; @@ -2603,11 +2603,11 @@ - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { size_t length = self.length; of_char32_t *buffer; - buffer = of_malloc(length + 1, sizeof(of_char32_t)); + buffer = of_alloc(length + 1, sizeof(of_char32_t)); @try { [self getCharacters: buffer inRange: of_range(0, length)]; buffer[length] = 0;