@@ -135,12 +135,11 @@ size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; - UTF16 = [self allocMemoryWithSize: sizeof(of_char16_t) - count: length]; + UTF16 = of_malloc(length, sizeof(of_char16_t)); @try { DWORD UTF16Len; OFMutableData *rest = nil; size_t i = 0; @@ -258,11 +257,11 @@ if (rest != nil) [self unreadFromBuffer: rest.items length: rest.count]; } @finally { - [self freeMemory: UTF16]; + free(UTF16); } objc_autoreleasePoolPop(pool); return j; @@ -363,12 +362,11 @@ _incompleteUTF8SurrogateLen = 0; i += toCopy; } - tmp = [self allocMemoryWithSize: sizeof(of_char16_t) - count: length * 2]; + tmp = of_malloc(length * 2, sizeof(of_char16_t)); @try { DWORD bytesWritten; while (i < length) { of_unichar_t c; @@ -443,11 +441,11 @@ exceptionWithObject: self requestedLength: j * 2 bytesWritten: bytesWritten * 2 errNo: 0]; } @finally { - [self freeMemory: tmp]; + free(tmp); } /* * We do not count in bytes when writing to the Win32 console. But * since any incomplete write is an exception here anyway, we can just