git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40469 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2017-04-12 06:22:07 +00:00
parent 552d190f31
commit fe7d8e2d9e

View file

@ -993,6 +993,7 @@ static int poolConnections = 0;
if (Nil == LitStringClass)
{
Class root = [NSObject class];
IMP imp;
SEL sel;
/* Find the literal string class used by the foundation library.
@ -1009,39 +1010,45 @@ static int poolConnections = 0;
* literal string doesn't get retained/released.
*/
sel = @selector(retain);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, sel),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
#define enc \
method_getTypeEncoding(class_getInstanceMethod(SQLStringClass, sel))
sel = @selector(release);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, sel),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
imp = class_getMethodImplementation(root, sel);
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
sel = @selector(autorelease);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, sel),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
imp = class_getMethodImplementation(root, sel);
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
sel = @selector(dealloc);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, sel),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
imp = class_getMethodImplementation(root, sel);
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
sel = @selector(retain);
imp = class_getMethodImplementation(root, sel);
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
/* The -copy and -copyWithZone: methods should simply retain
* the receiver.
*/
sel = @selector(copy);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, @selector(retain)),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
sel = @selector(copyWithZone:);
class_addMethod(SQLStringClass, sel,
class_getMethodImplementation(root, @selector(retain)),
method_getTypeEncoding(class_getInstanceMethod(root, sel)));
class_addMethod(SQLStringClass, sel, imp, enc);
NSAssert(imp == [SQLStringClass instanceMethodForSelector: sel],
NSInternalInconsistencyException);
}
if (nil == null)