MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / getnextfilename

Function getnextfilename

3rd/lua-5.4.3/src/loadlib.c:447–462  ·  view source on GitHub ↗

** Get the next name in '*path' = 'name1;name2;name3;...', changing ** the ending ';' to '\0' to create a zero-terminated string. Return ** NULL when list ends. */

Source from the content-addressed store, hash-verified

445** NULL when list ends.
446*/
447static const char *getnextfilename (char **path, char *end) {
448 char *sep;
449 char *name = *path;
450 if (name == end)
451 return NULL; /* no more names */
452 else if (*name == '\0') { /* from previous iteration? */
453 *name = *LUA_PATH_SEP; /* restore separator */
454 name++; /* skip it */
455 }
456 sep = strchr(name, *LUA_PATH_SEP); /* find next separator */
457 if (sep == NULL) /* separator not found? */
458 sep = end; /* name goes until the end */
459 *sep = '\0'; /* finish file name */
460 *path = sep; /* will start next search from here */
461 return name;
462}
463
464
465/*

Callers 1

searchpathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected