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

Function append_one

string-list.c:297–321  ·  view source on GitHub ↗

* append a substring [p..end] to list; return number of things it * appended to the list. */

Source from the content-addressed store, hash-verified

295 * appended to the list.
296 */
297static int append_one(struct string_list *list,
298 const char *p, const char *end,
299 int in_place, unsigned flags)
300{
301 if (!end)
302 end = p + strlen(p);
303
304 if ((flags & STRING_LIST_SPLIT_TRIM)) {
305 /* rtrim */
306 for (; p < end; end--)
307 if (!isspace(end[-1]))
308 break;
309 }
310
311 if ((flags & STRING_LIST_SPLIT_NONEMPTY) && (end <= p))
312 return 0;
313
314 if (in_place) {
315 *((char *)end) = '\0';
316 string_list_append(list, p);
317 } else {
318 string_list_append_nodup(list, xmemdupz(p, end - p));
319 }
320 return 1;
321}
322
323/*
324 * Unfortunately this cannot become a public interface, as _in_place()

Callers 1

split_stringFunction · 0.85

Calls 3

string_list_append_nodupFunction · 0.85
xmemdupzFunction · 0.85
string_list_appendFunction · 0.70

Tested by

no test coverage detected