@@ -18,18 +18,19 @@ #import "OFDataArray.h" #import "OFString.h" #import "OFMD5Hash.h" #import "OFSHA1Hash.h" -#import "OFAutoreleasePool.h" + +#import "autorelease.h" int _OFDataArray_Hashing_reference; @implementation OFDataArray (Hashing) - (OFString*)MD5Hash { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMD5Hash *hash = [OFMD5Hash hash]; uint8_t *digest; char cString[OF_MD5_DIGEST_SIZE * 2]; size_t i; @@ -45,20 +46,20 @@ cString[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); cString[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } - [pool release]; + objc_autoreleasePoolPop(pool); return [OFString stringWithCString: cString encoding: OF_STRING_ENCODING_ASCII length: 32]; } - (OFString*)SHA1Hash { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMD5Hash *hash = [OFSHA1Hash hash]; uint8_t *digest; char cString[OF_SHA1_DIGEST_SIZE * 2]; size_t i; @@ -74,12 +75,12 @@ cString[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); cString[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } - [pool release]; + objc_autoreleasePoolPop(pool); return [OFString stringWithCString: cString encoding: OF_STRING_ENCODING_ASCII length: 40]; } @end