Index: autogen.sh ================================================================== --- autogen.sh +++ autogen.sh @@ -1,4 +1,5 @@ #!/bin/sh aclocal -I m4 || exit 1 autoconf || exit 1 +autoheader || exit 1 ./configure $@ Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -17,8 +17,17 @@ OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString -fobjc-exceptions" BUILDSYS_SHARED_LIB +AC_CHECK_LIB(objc, sel_get_name, + [AC_DEFINE(HAVE_SEL_GET_NAME, 1, [Whether we have sel_get_name])]) +AC_CHECK_LIB(objc, sel_getName, + [AC_DEFINE(HAVE_SEL_GETNAME, 1, [Whether we have sel_getName])]) + +test x"$have_sel_name" = x"no" -a x"$have_selname" = x"no" && \ + AC_ERROR(You need either sel_get_name or sel_getName in libobjc!) + AC_SUBST(PACKAGE, objfw) AC_CONFIG_FILES(buildsys.mk) +AC_CONFIG_HEADERS(config.h) AC_OUTPUT Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -24,9 +24,10 @@ OFString.h \ OFWideString.h include ../buildsys.mk +CPPFLAGS += -I.. OBJCFLAGS += ${LIB_CFLAGS} LD = ${OBJC} LDFLAGS += ${LIB_LDFLAGS} LIBS += -lobjc Index: src/OFCString.m ================================================================== --- src/OFCString.m +++ src/OFCString.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import "OFCString.h" Index: src/OFConstCString.m ================================================================== --- src/OFConstCString.m +++ src/OFConstCString.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import "OFConstCString.h" @implementation OFConstCString Index: src/OFConstWideCString.m ================================================================== --- src/OFConstWideCString.m +++ src/OFConstWideCString.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import "OFConstWideCString.h" @implementation OFConstWideCString Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -7,14 +7,22 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import #import #import "OFExceptions.h" + +#if defined HAVE_SEL_GET_NAME +#define SEL_NAME(x) sel_get_name(x) +#elif defined HAVE_SEL_GETNAME +#define SEL_NAME(x) sel_getName(x) +#endif @implementation OFException + newWithObject: (id)obj { return [[OFException alloc] initWithObject: obj]; @@ -76,13 +84,12 @@ - initWithObject: (id)obj andSelector: (SEL)sel { if ((self = [super init])) - /* FIXME: Is casting SEL to char* portable? */ asprintf(&errstr, "ERROR: Requested selector %s not " - "implemented in %s!\n", (char*)sel, [obj name]); + "implemented in %s!\n", SEL_NAME(sel), [obj name]); return self; } @end Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import #import Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -18,11 +18,11 @@ OFListObject *last; } - init; - free; -- freeWithData; +- freeIncludingData; - (OFListObject*)first; - (OFListObject*)last; - (void)add: (OFListObject*)ptr; - (void)addNew: (void*)ptr; @end Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -7,10 +7,12 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import "OFList.h" @implementation OFList - init { @@ -31,17 +33,17 @@ } return [super free]; } -- freeWithData +- freeIncludingData { OFListObject *iter, *next; for (iter = first; iter != nil; iter = next) { next = [iter next]; - [iter freeWithData]; + [iter freeIncludingData]; } first = last = nil; return [super free]; } @@ -69,8 +71,8 @@ last = ptr; } - (void)addNew: (void*)ptr { - return [self add: [OFListObject new: ptr]]; + return [self add: [OFListObject newWithData: ptr]]; } @end Index: src/OFListObject.h ================================================================== --- src/OFListObject.h +++ src/OFListObject.h @@ -16,14 +16,14 @@ void *data; OFListObject *next; OFListObject *prev; } -+ new: (void*)ptr; -- init: (void*)ptr; -- freeWithData; ++ newWithData: (void*)ptr; +- initWithData: (void*)ptr; +- freeIncludingData; - (void*)data; - (OFListObject*)next; - (OFListObject*)prev; - (void)setNext: (OFListObject*)ptr; - (void)setPrev: (OFListObject*)ptr; @end Index: src/OFListObject.m ================================================================== --- src/OFListObject.m +++ src/OFListObject.m @@ -7,30 +7,32 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import #import "OFListObject.h" @implementation OFListObject -+ new: (void*)ptr ++ newWithData: (void*)ptr { - return [[OFListObject alloc] init: ptr]; + return [[OFListObject alloc] initWithData: ptr]; } -- init: (void*)ptr +- initWithData: (void*)ptr { if ((self = [super init])) { next = nil; prev = nil; data = ptr; } return self; } -- freeWithData +- freeIncludingData { if (data != NULL) free(data); return [super free]; } Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import "OFObject.h" #import "OFExceptions.h" Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import "OFString.h" Index: src/OFWideCString.m ================================================================== --- src/OFWideCString.m +++ src/OFWideCString.m @@ -7,13 +7,16 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import #import #import + #import "OFWideCString.h" #import "OFExceptions.h" @implementation OFWideCString - initWithWideCString: (wchar_t*)str Index: tests/OFList/OFList.m ================================================================== --- tests/OFList/OFList.m +++ tests/OFList/OFList.m @@ -56,10 +56,9 @@ else { puts("Last element is not expected element!"); return 1; } - [iter free]; - [list free]; + [list freeIncludingData]; return 0; }