mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-09 09:11:05 +00:00
add removeItemAtHead and removeItemAtTail
This commit is contained in:
parent
5b9b11241b
commit
f2ad4dea7b
2 changed files with 39 additions and 3 deletions
|
@ -22,7 +22,9 @@ struct list_bucket_t = {
|
||||||
- (id) tail;
|
- (id) tail;
|
||||||
- (void) addItemAtHead: (id) item;
|
- (void) addItemAtHead: (id) item;
|
||||||
- (void) addItemAtTail: (id) item;
|
- (void) addItemAtTail: (id) item;
|
||||||
- (void) removeItem: (id) item;
|
- (id) removeItem: (id) item;
|
||||||
|
- (id) removeItemAtHead;
|
||||||
|
- (id) removeItemAtTail;
|
||||||
- (integer) count;
|
- (integer) count;
|
||||||
-(void)makeObjectsPerformSelector:(SEL)selector;
|
-(void)makeObjectsPerformSelector:(SEL)selector;
|
||||||
-(void)makeObjectsPerformSelector:(SEL)selector withObject:(id)arg;
|
-(void)makeObjectsPerformSelector:(SEL)selector withObject:(id)arg;
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
tail = &e.next;
|
tail = &e.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeItem: (id) item
|
- (id) removeItem: (id) item
|
||||||
{
|
{
|
||||||
local list_bucket_t [] e;
|
local list_bucket_t [] e;
|
||||||
|
|
||||||
|
@ -77,9 +77,43 @@
|
||||||
e.prev[0] = e.next;
|
e.prev[0] = e.next;
|
||||||
if (e.next)
|
if (e.next)
|
||||||
e.next.prev = e.prev;
|
e.next.prev = e.prev;
|
||||||
return;
|
obj_free (e);
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) removeItemAtHead
|
||||||
|
{
|
||||||
|
local list_bucket_t [] e;
|
||||||
|
local id obj;
|
||||||
|
|
||||||
|
if (!count)
|
||||||
|
return NIL;
|
||||||
|
e = head;
|
||||||
|
obj = e.obj;
|
||||||
|
e.prev[0] = e.next;
|
||||||
|
if (e.next)
|
||||||
|
e.next.prev = e.prev;
|
||||||
|
obj_free (e);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) removeItemAtTail
|
||||||
|
{
|
||||||
|
local list_bucket_t [] e;
|
||||||
|
local id obj;
|
||||||
|
|
||||||
|
if (!count)
|
||||||
|
return NIL;
|
||||||
|
e = (list_bucket_t []) tail;
|
||||||
|
obj = e.obj;
|
||||||
|
e.prev[0] = e.next;
|
||||||
|
if (e.next)
|
||||||
|
e.next.prev = e.prev;
|
||||||
|
obj_free (e);
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (integer) count
|
- (integer) count
|
||||||
|
|
Loading…
Reference in a new issue