2010-12-12 01:25:09 +00:00
|
|
|
#include "Array+Private.h"
|
|
|
|
|
|
|
|
@implementation Array (Private)
|
|
|
|
|
|
|
|
/**
|
2010-12-12 13:55:53 +00:00
|
|
|
This is a somewhat dangerous thing to do, and it's done only so that we can
|
2010-12-12 01:25:09 +00:00
|
|
|
use an Array to implement AutoreleasePool.
|
|
|
|
*/
|
|
|
|
- (void) addObjectNoRetain: (id)anObject
|
|
|
|
{
|
|
|
|
if (count == capacity) {
|
|
|
|
capacity += granularity;
|
|
|
|
_objs = (id [])obj_realloc (_objs, capacity * @sizeof (id));
|
|
|
|
}
|
|
|
|
_objs[count++] = anObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) removeObjectNoRelease: (id)anObject
|
|
|
|
{
|
|
|
|
local unsigned i = count;
|
|
|
|
local unsigned tmp;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (_objs[--i] == anObject) {
|
|
|
|
for (tmp = i; tmp < count; tmp++) {
|
|
|
|
_objs[tmp] = _objs[tmp + 1];
|
|
|
|
}
|
|
|
|
count--;
|
|
|
|
}
|
|
|
|
} while (i);
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|