MCPcopy Create free account
hub / github.com/git/git / extend_prefix_length

Function extend_prefix_length

add-interactive.c:72–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static void extend_prefix_length(struct string_list_item *p,
73 const char *other_string, size_t max_length)
74{
75 size_t *len = p->util;
76
77 if (!*len || memcmp(p->string, other_string, *len))
78 return;
79
80 for (;;) {
81 char c = p->string[*len];
82
83 /*
84 * Is `p` a strict prefix of `other`? Or have we exhausted the
85 * maximal length of the prefix? Or is the current character a
86 * multi-byte UTF-8 one? If so, there is no valid, unique
87 * prefix.
88 */
89 if (!c || ++*len > max_length || !isascii(c)) {
90 *len = 0;
91 break;
92 }
93
94 if (c != other_string[*len - 1])
95 break;
96 }
97}
98
99static void find_unique_prefixes(struct prefix_item_list *list)
100{

Callers 1

find_unique_prefixesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected