MCPcopy Index your code
hub / github.com/git/git / add_entry

Function add_entry

string-list.c:43–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static 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
63struct string_list_item *string_list_insert(struct string_list *list, const char *string)
64{

Callers 1

string_list_insertFunction · 0.70

Calls 2

get_entry_indexFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected