Simplify last change a little for readability.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17861 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-10-14 09:09:06 +00:00
parent 88bd37b151
commit 0d55588d8a
2 changed files with 9 additions and 9 deletions

View file

@ -32,8 +32,8 @@
* allocated from the heap (to avoid stack overflow). * allocated from the heap (to avoid stack overflow).
*/ */
#define OBUFMAX 1024 #define OBUFMAX 1024
#define OBUFBEGIN(P, S) { id _xxx[(S) <= OBUFMAX ? (S) : 0]; id *(P) = ((S) <= OBUFMAX) ? _xxx : (id*)NSZoneMalloc(NSDefaultMallocZone(), (S) * sizeof(id)); #define OBUFBEGIN(P, S) { id _obuf[(S) <= OBUFMAX ? (S) : 0]; id *_base = ((S) <= OBUFMAX) ? _obuf : (id*)NSZoneMalloc(NSDefaultMallocZone(), (S) * sizeof(id)); id *(P) = _base;
#define OBUFEND(P, S) if ((S) > OBUFMAX) NSZoneFree(NSDefaultMallocZone(), (P)); } #define OBUFEND() if (_base != _obuf) NSZoneFree(NSDefaultMallocZone(), _base); }
/* /*
* Function to get the name of a string encoding as an NSString. * Function to get the name of a string encoding as an NSString.

View file

@ -278,7 +278,7 @@ static SEL rlSel;
na = [[GSArrayClass allocWithZone: NSDefaultMallocZone()] na = [[GSArrayClass allocWithZone: NSDefaultMallocZone()]
initWithObjects: objects count: c+1]; initWithObjects: objects count: c+1];
OBUFEND(objects, c+1) OBUFEND()
} }
return AUTORELEASE(na); return AUTORELEASE(na);
} }
@ -301,7 +301,7 @@ static SEL rlSel;
[anotherArray getObjects: &objects[c]]; [anotherArray getObjects: &objects[c]];
na = [NSArrayClass arrayWithObjects: objects count: c+l]; na = [NSArrayClass arrayWithObjects: objects count: c+l];
OBUFEND(objects, c+l) OBUFEND()
return na; return na;
} }
@ -364,7 +364,7 @@ static SEL rlSel;
[aCoder encodeArrayOfObjCType: @encode(id) [aCoder encodeArrayOfObjCType: @encode(id)
count: count count: count
at: a]; at: a];
OBUFEND(a, count) OBUFEND()
} }
} }
@ -524,7 +524,7 @@ static SEL rlSel;
{ {
self = [self initWithObjects: objects count: c]; self = [self initWithObjects: objects count: c];
} }
OBUFEND(objects, c) OBUFEND()
return self; return self;
} }
@ -540,7 +540,7 @@ static SEL rlSel;
[array getObjects: objects]; [array getObjects: objects];
self = [self initWithObjects: objects count: c]; self = [self initWithObjects: objects count: c];
OBUFEND(objects, c) OBUFEND()
return self; return self;
} }
@ -568,7 +568,7 @@ static SEL rlSel;
[contents[count] release]; [contents[count] release];
} }
#endif #endif
OBUFEND(contents, count) OBUFEND()
} }
else else
{ {
@ -988,7 +988,7 @@ compare(id elem1, id elem2, void* context)
[self getObjects: objects range: aRange]; [self getObjects: objects range: aRange];
na = [NSArray arrayWithObjects: objects count: aRange.length]; na = [NSArray arrayWithObjects: objects count: aRange.length];
OBUFEND(objects, aRange.length) OBUFEND()
} }
return na; return na;
} }