MCPcopy Create free account
hub / github.com/coreboot/coreboot / strsep

Function strsep

payloads/libpayload/libc/string.c:289–312  ·  view source on GitHub ↗

* Separate strings. * * @param stringp reference of the string to separate. * @param delim string containing all delimiters. * @return Token string. */

Source from the content-addressed store, hash-verified

287 * @return Token string.
288 */
289char *strsep(char **stringp, const char *delim)
290{
291 char *walk, *token;
292
293 if (!stringp || !*stringp)
294 return NULL;
295
296 token = walk = *stringp;
297
298 /* Walk, search for delimiters */
299 while (*walk && !strchr(delim, *walk))
300 walk++;
301
302 if (*walk) {
303 /* NUL terminate */
304 *walk = '\0';
305 *stringp = walk + 1;
306 } else {
307 /* Set to NULL after last token. */
308 *stringp = NULL;
309 }
310
311 return token;
312}
313
314/* Check that a character is in the valid range for the
315 given base

Callers 2

test_strsepFunction · 0.85
get_deviceFunction · 0.85

Calls 1

strchrFunction · 0.70

Tested by 2

test_strsepFunction · 0.68
get_deviceFunction · 0.68