mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-12 00:51:08 +00:00
Minor improvement for ease of debugging
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22730 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
51bfa42d59
commit
5eccbb6e66
2 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-03-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/Additions/GSObjCRuntime.m: Add a class for autoreleased
|
||||||
|
memory so it is clearer when using object allocation debugging.
|
||||||
|
|
||||||
2006-03-28 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-03-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSString.m: Fix error initialising mutable string from
|
* Source/GSString.m: Fix error initialising mutable string from
|
||||||
|
|
|
@ -2197,6 +2197,11 @@ NSArray *GSObjCDirectSubclassesOfClass(Class cls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@interface GSAutoreleasedMemory : NSObject
|
||||||
|
@end
|
||||||
|
@implementation GSAutoreleasedMemory
|
||||||
|
@end
|
||||||
|
|
||||||
void *
|
void *
|
||||||
GSAutoreleasedBuffer(unsigned size)
|
GSAutoreleasedBuffer(unsigned size)
|
||||||
{
|
{
|
||||||
|
@ -2208,22 +2213,22 @@ GSAutoreleasedBuffer(unsigned size)
|
||||||
#endif
|
#endif
|
||||||
#define ALIGN __alignof__(double)
|
#define ALIGN __alignof__(double)
|
||||||
|
|
||||||
static Class nsobject_class = 0;
|
static Class buffer_class = 0;
|
||||||
static Class autorelease_class;
|
static Class autorelease_class;
|
||||||
static SEL autorelease_sel;
|
static SEL autorelease_sel;
|
||||||
static IMP autorelease_imp;
|
static IMP autorelease_imp;
|
||||||
static int offset;
|
static int offset;
|
||||||
NSObject *o;
|
NSObject *o;
|
||||||
|
|
||||||
if (nsobject_class == 0)
|
if (buffer_class == 0)
|
||||||
{
|
{
|
||||||
nsobject_class = [NSObject class];
|
buffer_class = [GSAutoreleasedMemory class];
|
||||||
offset = nsobject_class->instance_size % ALIGN;
|
offset = buffer_class->instance_size % ALIGN;
|
||||||
autorelease_class = [NSAutoreleasePool class];
|
autorelease_class = [NSAutoreleasePool class];
|
||||||
autorelease_sel = @selector(addObject:);
|
autorelease_sel = @selector(addObject:);
|
||||||
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
||||||
}
|
}
|
||||||
o = (NSObject*)NSAllocateObject(nsobject_class,
|
o = (NSObject*)NSAllocateObject(buffer_class,
|
||||||
size + offset, NSDefaultMallocZone());
|
size + offset, NSDefaultMallocZone());
|
||||||
(*autorelease_imp)(autorelease_class, autorelease_sel, o);
|
(*autorelease_imp)(autorelease_class, autorelease_sel, o);
|
||||||
return ((void*)&o[1]) + offset;
|
return ((void*)&o[1]) + offset;
|
||||||
|
|
Loading…
Reference in a new issue