@@ -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