@@ -17,18 +17,19 @@ #include "config.h" #import "OFString.h" #import "OFMD5Hash.h" #import "OFSHA1Hash.h" -#import "OFAutoreleasePool.h" + +#import "autorelease.h" int _OFString_Hashing_reference; @implementation OFString (Hashing) - (OFString*)MD5Hash { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMD5Hash *hash = [OFMD5Hash hash]; uint8_t *digest; char ret[OF_MD5_DIGEST_SIZE * 2]; size_t i; @@ -44,20 +45,20 @@ ret[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); ret[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } - [pool release]; + objc_autoreleasePoolPop(pool); return [OFString stringWithCString: ret 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 ret[OF_SHA1_DIGEST_SIZE * 2]; size_t i; @@ -73,12 +74,12 @@ ret[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); ret[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } - [pool release]; + objc_autoreleasePoolPop(pool); return [OFString stringWithCString: ret encoding: OF_STRING_ENCODING_ASCII length: 40]; } @end