mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 13:10:34 +00:00
Array now properly retains/releases objects it stores.
This commit is contained in:
parent
0213efb331
commit
5130545c72
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,7 @@
|
|||
if (index < 0 || index >= count)
|
||||
return;
|
||||
array[index] = item;
|
||||
[item retain];
|
||||
}
|
||||
|
||||
- (void) addItem: (id) item
|
||||
|
@ -52,6 +53,7 @@
|
|||
array = (id [])obj_realloc (array, size * @sizeof (id));
|
||||
}
|
||||
array[count++] = item;
|
||||
[item retain];
|
||||
}
|
||||
|
||||
- (void) removeItem: (id) item
|
||||
|
@ -60,6 +62,7 @@
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
if (array[i] == item) {
|
||||
[item release];
|
||||
count--;
|
||||
for (n = i; n < count; n++)
|
||||
array[n] = array[n + 1];
|
||||
|
@ -80,6 +83,7 @@
|
|||
count--;
|
||||
for (i = index; i < count; i++)
|
||||
array[i] = array[i + 1];
|
||||
[item release];
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -98,6 +102,7 @@
|
|||
array[i] = array[i - 1];
|
||||
array[index] = item;
|
||||
count++;
|
||||
[item retain];
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue