Sat, 07 Jan 2006 22:01:54 +0100
*list_remove return true if the item was found (and removed).
objlist.c | file | annotate | diff | comparison | revisions | |
objlist.h | file | annotate | diff | comparison | revisions | |
ptrlist.c | file | annotate | diff | comparison | revisions | |
ptrlist.h | file | annotate | diff | comparison | revisions |
--- a/objlist.c Sat May 14 22:23:20 2005 +0200 +++ b/objlist.c Sat Jan 07 22:01:54 2006 +0100 @@ -204,7 +204,7 @@ } -void objlist_remove(ObjList **objlist, Obj *obj) +bool objlist_remove(ObjList **objlist, Obj *obj) { ObjList *node=objlist_find_node(*objlist, obj); @@ -212,6 +212,8 @@ free_node(objlist, node); optimise(objlist); + + return (node!=NULL); }
--- a/objlist.h Sat May 14 22:23:20 2005 +0200 +++ b/objlist.h Sat Jan 07 22:01:54 2006 +0100 @@ -47,7 +47,7 @@ extern bool objlist_insert_first(ObjList **objlist, Obj *obj); extern bool objlist_reinsert_last(ObjList **objlist, Obj *obj); extern bool objlist_reinsert_first(ObjList **objlist, Obj *obj); -extern void objlist_remove(ObjList **objlist, Obj *obj); +extern bool objlist_remove(ObjList **objlist, Obj *obj); extern void objlist_clear(ObjList **objlist); extern void objlist_iter_init(ObjListIterTmp *state, ObjList *objlist); extern Obj *objlist_iter(ObjListIterTmp *state);
--- a/ptrlist.c Sat May 14 22:23:20 2005 +0200 +++ b/ptrlist.c Sat Jan 07 22:01:54 2006 +0100 @@ -107,12 +107,14 @@ } -void ptrlist_remove(PtrList **ptrlist, void *ptr) +bool ptrlist_remove(PtrList **ptrlist, void *ptr) { PtrList *node=ptrlist_find_node(*ptrlist, ptr); if(node!=NULL) free_node(ptrlist, node); + + return (node!=NULL); }
--- a/ptrlist.h Sat May 14 22:23:20 2005 +0200 +++ b/ptrlist.h Sat Jan 07 22:01:54 2006 +0100 @@ -45,7 +45,7 @@ extern bool ptrlist_insert_first(PtrList **ptrlist, void *ptr); extern bool ptrlist_reinsert_last(PtrList **ptrlist, void *ptr); extern bool ptrlist_reinsert_first(PtrList **ptrlist, void *ptr); -extern void ptrlist_remove(PtrList **ptrlist, void *ptr); +extern bool ptrlist_remove(PtrList **ptrlist, void *ptr); extern void ptrlist_clear(PtrList **ptrlist); extern void ptrlist_iter_init(PtrListIterTmp *state, PtrList *ptrlist); extern void *ptrlist_iter(PtrListIterTmp *state);