MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / newStringFromList

Function newStringFromList

Trash/stringTable.c:94–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94char *
95newStringFromList(
96 char **list,
97 INTN* size
98)
99{
100 char *begin = *list, *end;
101 char *newstr;
102 INTN newsize = *size;
103
104 while (*begin && newsize && isspace(*begin)) {
105 begin++;
106 newsize--;
107 }
108 end = begin;
109 while (*end && newsize && !isspace(*end)) {
110 end++;
111 newsize--;
112 }
113 if (begin == end)
114 return 0;
115 newstr = malloc(end - begin + 1);
116 strncpy(newstr, begin, end - begin);
117 *list = end;
118 *size = newsize;
119 return newstr;
120}
121
122/*
123 * compress == compress escaped characters to one character

Callers 1

loadOtherConfigsFunction · 0.85

Calls 3

isspaceFunction · 0.70
mallocFunction · 0.50
strncpyFunction · 0.50

Tested by

no test coverage detected