added method to allow creation of list with a starting size
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 2 Mar 2006 19:07:40 +0000 (19:07 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 2 Mar 2006 19:07:40 +0000 (19:07 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@655 9efc2488-bf62-4759-914b-345cdb29e865

src/libstack/osrf_list.c
src/libstack/osrf_list.h

index f04c6ec..9b2de0f 100644 (file)
@@ -9,6 +9,15 @@ osrfList* osrfNewList() {
        return list;
 }
 
+osrfList* osrfNewListSize( unsigned int size ) {
+       osrfList* list = safe_malloc(sizeof(osrfList));
+       list->size              = 0;
+       list->freeItem = NULL;
+       list->arrsize   = size;
+       list->arrlist   = safe_malloc( list->arrsize * sizeof(void*) );
+       return list;
+}
+
 
 int osrfListPush( osrfList* list, void* item ) {
        if(!(list)) return -1;
index 69ced17..e936d1c 100644 (file)
@@ -28,6 +28,8 @@ struct __osrfListIteratorStruct {
 };
 typedef struct __osrfListIteratorStruct osrfListIterator;
 
+osrfList* osrfNewListSize( unsigned int size );
+
 
 /**
   Creates a new list iterator with the given list