Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -25,11 +25,11 @@ @implementation OFFile + fileWithPath: (OFString*)path andMode: (OFString*)mode { - return [[[OFFile alloc] initWithPath: path + return [[[self alloc] initWithPath: path andMode: mode] autorelease]; } + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode Index: src/OFHashes.m ================================================================== --- src/OFHashes.m +++ src/OFHashes.m @@ -115,11 +115,11 @@ } @implementation OFMD5Hash + md5Hash { - return [[[OFMD5Hash alloc] init] autorelease]; + return [[[self alloc] init] autorelease]; } - init { self = [super init]; @@ -353,11 +353,11 @@ } @implementation OFSHA1Hash + sha1Hash { - return [[[OFSHA1Hash alloc] init] autorelease]; + return [[[self alloc] init] autorelease]; } - init { self = [super init]; Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -15,11 +15,11 @@ #import "OFExceptions.h" @implementation OFList + list { - return [[[OFList alloc] init] autorelease]; + return [[[self alloc] init] autorelease]; } - init { self = [super init]; Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -223,126 +223,126 @@ } @implementation OFNumber + numberWithChar: (char)char_ { - return [[[OFNumber alloc] initWithChar: char_] autorelease]; + return [[[self alloc] initWithChar: char_] autorelease]; } + numberWithShort: (short)short_ { - return [[[OFNumber alloc] initWithShort: short_] autorelease]; + return [[[self alloc] initWithShort: short_] autorelease]; } + numberWithInt: (int)int_ { - return [[[OFNumber alloc] initWithInt: int_] autorelease]; + return [[[self alloc] initWithInt: int_] autorelease]; } + numberWithLong: (long)long_ { - return [[[OFNumber alloc] initWithLong: long_] autorelease]; + return [[[self alloc] initWithLong: long_] autorelease]; } + numberWithUChar: (unsigned char)uchar { - return [[[OFNumber alloc] initWithUChar: uchar] autorelease]; + return [[[self alloc] initWithUChar: uchar] autorelease]; } + numberWithUShort: (unsigned short)ushort { - return [[[OFNumber alloc] initWithUShort: ushort] autorelease]; + return [[[self alloc] initWithUShort: ushort] autorelease]; } + numberWithUInt: (unsigned int)uint { - return [[[OFNumber alloc] initWithUInt: uint] autorelease]; + return [[[self alloc] initWithUInt: uint] autorelease]; } + numberWithULong: (unsigned long)ulong { - return [[[OFNumber alloc] initWithULong: ulong] autorelease]; + return [[[self alloc] initWithULong: ulong] autorelease]; } + numberWithInt8: (int8_t)int8 { - return [[[OFNumber alloc] initWithInt8: int8] autorelease]; + return [[[self alloc] initWithInt8: int8] autorelease]; } + numberWithInt16: (int16_t)int16 { - return [[[OFNumber alloc] initWithInt16: int16] autorelease]; + return [[[self alloc] initWithInt16: int16] autorelease]; } + numberWithInt32: (int32_t)int32 { - return [[[OFNumber alloc] initWithInt32: int32] autorelease]; + return [[[self alloc] initWithInt32: int32] autorelease]; } + numberWithInt64: (int64_t)int64 { - return [[[OFNumber alloc] initWithInt64: int64] autorelease]; + return [[[self alloc] initWithInt64: int64] autorelease]; } + numberWithUInt8: (uint8_t)uint8 { - return [[[OFNumber alloc] initWithUInt8: uint8] autorelease]; + return [[[self alloc] initWithUInt8: uint8] autorelease]; } + numberWithUInt16: (uint16_t)uint16 { - return [[[OFNumber alloc] initWithUInt16: uint16] autorelease]; + return [[[self alloc] initWithUInt16: uint16] autorelease]; } + numberWithUInt32: (uint32_t)uint32 { - return [[[OFNumber alloc] initWithUInt32: uint32] autorelease]; + return [[[self alloc] initWithUInt32: uint32] autorelease]; } + numberWithUInt64: (uint64_t)uint64 { - return [[[OFNumber alloc] initWithUInt64: uint64] autorelease]; + return [[[self alloc] initWithUInt64: uint64] autorelease]; } + numberWithSize: (size_t)size { - return [[[OFNumber alloc] initWithSize: size] autorelease]; + return [[[self alloc] initWithSize: size] autorelease]; } + numberWithSSize: (ssize_t)ssize { - return [[[OFNumber alloc] initWithSSize: ssize] autorelease]; + return [[[self alloc] initWithSSize: ssize] autorelease]; } + numberWithIntMax: (intmax_t)intmax { - return [[[OFNumber alloc] initWithIntMax: intmax] autorelease]; + return [[[self alloc] initWithIntMax: intmax] autorelease]; } + numberWithUIntMax: (uintmax_t)uintmax { - return [[[OFNumber alloc] initWithIntMax: uintmax] autorelease]; + return [[[self alloc] initWithIntMax: uintmax] autorelease]; } + numberWithPtrDiff: (ptrdiff_t)ptrdiff { - return [[[OFNumber alloc] initWithPtrDiff: ptrdiff] autorelease]; + return [[[self alloc] initWithPtrDiff: ptrdiff] autorelease]; } + numberWithIntPtr: (intptr_t)intptr { - return [[[OFNumber alloc] initWithIntPtr: intptr] autorelease]; + return [[[self alloc] initWithIntPtr: intptr] autorelease]; } + numberWithFloat: (float)float_ { - return [[[OFNumber alloc] initWithFloat: float_] autorelease]; + return [[[self alloc] initWithFloat: float_] autorelease]; } + numberWithDouble: (double)double_ { - return [[[OFNumber alloc] initWithDouble: double_] autorelease]; + return [[[self alloc] initWithDouble: double_] autorelease]; } - initWithChar: (char)char_ { self = [super init]; Index: src/OFSocket.h ================================================================== --- src/OFSocket.h +++ src/OFSocket.h @@ -43,10 +43,15 @@ #endif struct sockaddr *saddr; socklen_t saddr_len; } +/** + * \return A new autoreleased OFTCPSocket + */ ++ socket; + /** * Enables/disables non-blocking I/O. */ - setBlocking: (BOOL)enable; @end Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -32,10 +32,15 @@ if (WSAStartup(MAKEWORD(2, 0), &wsa)) @throw [OFInitializationFailedException newWithClass: self]; } #endif + ++ socket +{ + return [[[self alloc] init] autorelease]; +} - init { self = [super init]; Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -14,22 +14,10 @@ /** * The OFTCPSocket class provides functions to create and use sockets. */ @interface OFTCPSocket: OFSocket {} -/** - * \return A new autoreleased OFTCPSocket - */ -+ socket; - -/** - * Initializes an already allocated OFTCPSocket. - * - * \return An initialized OFTCPSocket - */ -- init; - /** * Connect the OFTCPSocket to the specified destination. * * \param service The service on the node to connect to * \param node The node to connect to Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -40,25 +40,10 @@ if (self == [OFTCPSocket class]) lock = [[OFObject alloc] init]; } #endif -+ socket -{ - return [[[OFTCPSocket alloc] init] autorelease]; -} - -- init -{ - self = [super init]; - - sock = INVALID_SOCKET; - saddr = NULL; - - return self; -} - - (void)dealloc { if (sock != INVALID_SOCKET) close(sock); Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -32,18 +32,10 @@ #endif @implementation OFThread + threadWithObject: (id)obj { - /* - * This is one of the rare cases where the convenience method should - * use self instead of the class. - * - * The reason is that you derive from OFThread and reimplement main. - * If OFThread instead of self would be used here, the reimplemented - * main would never be called. - */ return [[[self alloc] initWithObject: obj] autorelease]; } + setObject: (id)obj forTLSKey: (OFTLSKey*)key @@ -156,11 +148,11 @@ @end @implementation OFTLSKey + tlsKeyWithDestructor: (void(*)(void*))destructor { - return [[[OFTLSKey alloc] initWithDestructor: destructor] autorelease]; + return [[[self alloc] initWithDestructor: destructor] autorelease]; } - initWithDestructor: (void(*)(void*))destructor { Class c;