| 41 | } |
| 42 | |
| 43 | static size_t add_entry(struct string_list *list, const char *string) |
| 44 | { |
| 45 | bool exact_match; |
| 46 | size_t index = get_entry_index(list, string, &exact_match); |
| 47 | |
| 48 | if (exact_match) |
| 49 | return index; |
| 50 | |
| 51 | ALLOC_GROW(list->items, list->nr+1, list->alloc); |
| 52 | if (index < list->nr) |
| 53 | MOVE_ARRAY(list->items + index + 1, list->items + index, |
| 54 | list->nr - index); |
| 55 | list->items[index].string = list->strdup_strings ? |
| 56 | xstrdup(string) : (char *)string; |
| 57 | list->items[index].util = NULL; |
| 58 | list->nr++; |
| 59 | |
| 60 | return index; |
| 61 | } |
| 62 | |
| 63 | struct string_list_item *string_list_insert(struct string_list *list, const char *string) |
| 64 | { |
no test coverage detected