mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-04 02:20:53 +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"
|
#include "Array+Private.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
@implementation Array (Private)
|
@implementation Array (Private)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,3 +32,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#include "Array.h"
|
#include "Array.h"
|
||||||
|
#include "Array+Private.h"
|
||||||
|
|
||||||
#define STANDARD_CAPACITY 16
|
#define STANDARD_CAPACITY 16
|
||||||
#define ARRAY_MAX_GRANULARITY 100
|
#define ARRAY_MAX_GRANULARITY 100
|
||||||
|
@ -366,3 +367,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@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…
Add table
Add a link
Reference in a new issue