From 09b1e18f063a6a58fa49c4451c5e7faead945614 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 9 Nov 2005 21:47:31 +0000 Subject: [PATCH] added pop method to osrf_list makefile builds mod_xmlbuilder code git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@575 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_list.c | 6 ++++++ src/libstack/osrf_list.h | 9 +++++++++ src/utils/Makefile | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libstack/osrf_list.c b/src/libstack/osrf_list.c index a3d673e..7277720 100644 --- a/src/libstack/osrf_list.c +++ b/src/libstack/osrf_list.c @@ -128,6 +128,12 @@ unsigned long osrfListGetCount( osrfList* list ) { } +void* osrfListPop( osrfList* list ) { + if(!list) return NULL; + return osrfListRemove( list, list->size - 1 ); +} + + osrfListIterator* osrfNewListIterator( osrfList* list ) { if(!list) return NULL; osrfListIterator* itr = safe_malloc(sizeof(osrfListIterator)); diff --git a/src/libstack/osrf_list.h b/src/libstack/osrf_list.h index 104407b..cea3a94 100644 --- a/src/libstack/osrf_list.h +++ b/src/libstack/osrf_list.h @@ -64,6 +64,14 @@ osrfList* osrfNewList(); */ int osrfListPush( osrfList* list, void* item ); + +/** + * Removes the last item in the list + * See osrfListRemove for details on how the removed item is handled + * @return The item, unless 'freeItem' exists, then returns NULL + */ +void* osrfListPop( osrfList* list ); + /** Puts the given item into the list at the specified position. If there is already an item at the given position and the list has it's @@ -112,6 +120,7 @@ int osrfListFind( osrfList* list, void* addr ); void __osrfListSetSize( osrfList* list ); + /** @return The number of non-null items in the list */ diff --git a/src/utils/Makefile b/src/utils/Makefile index 7a80440..d5ad508 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -15,7 +15,6 @@ sha.o: sha.c sha.h string_array.o: string_array.c string_array.h - clean: /bin/rm -f *.o -- 2.11.0