added method to allow creation of list with a starting size
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 2 Mar 2006 19:07:40 +0000 (19:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 2 Mar 2006 19:07:40 +0000 (19:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3241 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/libstack/osrf_list.c
OpenSRF/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