mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Move private Array methods into main file
#if 0 out the "normal" implementation, so that it doesn't hurt. When it becomes possible to have the private Array methods separate, remove them from the main file and remove the #if 0 block from Array+Private.r.
This commit is contained in:
parent
2c84ae4898
commit
5c8cb8fec8
2 changed files with 36 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "Array+Private.h"
|
||||
|
||||
#if 0
|
||||
@implementation Array (Private)
|
||||
|
||||
/**
|
||||
|
@ -31,3 +32,4 @@
|
|||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "math.h"
|
||||
|
||||
#include "Array.h"
|
||||
#include "Array+Private.h"
|
||||
|
||||
#define STANDARD_CAPACITY 16
|
||||
#define ARRAY_MAX_GRANULARITY 100
|
||||
|
@ -366,3 +367,36 @@
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation Array (Private)
|
||||
|
||||
/**
|
||||
This is a somewhat dangerous thing to do, and it's only done so that we can
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue