mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
This fixes the upostop-- test by auto-casting implicit constants to unsigned (and it gives a warning for signed-unsigned comparisons otherwise). The generated code isn't quite the best, but the fix for that is next. Also clean up the resulting mess, though not properly. There are a few bogus warnings, and the legit ones could do with a review.
33 lines
635 B
R
33 lines
635 B
R
#include "Array+Private.h"
|
|
|
|
@implementation Array (Private)
|
|
|
|
/**
|
|
This is a somewhat dangerous thing to do, and it's done only 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;
|
|
|
|
while (i-- > 0) {
|
|
if (_objs[i] == anObject) {
|
|
for (tmp = i + 1; tmp < count; tmp++) {
|
|
_objs[tmp + 1] = _objs[tmp];
|
|
}
|
|
count--;
|
|
}
|
|
}
|
|
}
|
|
|
|
@end
|