| 27 #include "string_list.h" |
27 #include "string_list.h" |
| 28 |
28 |
| 29 #include <assert.h> |
29 #include <assert.h> |
| 30 |
30 |
| 31 static void do_not_free(void* item) { |
31 static void do_not_free(void* item) { |
| |
32 (void) item; /* do not do anything with the item */ |
| 32 } |
33 } |
| 33 |
34 |
| 34 string_list* new_string_list() { |
35 string_list* new_string_list() { |
| 35 string_list* stringList = malloc(sizeof(string_list)); |
36 string_list* stringList = malloc(sizeof(string_list)); |
| 36 stringList->count = 0; |
37 stringList->count = 0; |
| 37 stringList->capacity = 32; |
38 stringList->capacity = 32; |
| 38 stringList->items = calloc(sizeof(char*), stringList->capacity); |
39 stringList->items = calloc(stringList->capacity, sizeof(char*)); |
| 39 stringList->free_item = do_not_free; |
40 stringList->free_item = do_not_free; |
| 40 |
41 |
| 41 return stringList; |
42 return stringList; |
| 42 } |
43 } |
| 43 |
44 |