MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / scanformat

Function scanformat

Source/Misc/lua/src/lua.c:14402–14421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14400}
14401
14402static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
14403const char *p = strfrmt;
14404while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */
14405if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
14406luaL_error(L, "invalid format (repeated flags)");
14407if (isdigit(uchar(*p))) p++; /* skip width */
14408if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
14409if (*p == '.') {
14410p++;
14411if (isdigit(uchar(*p))) p++; /* skip precision */
14412if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
14413}
14414if (isdigit(uchar(*p)))
14415luaL_error(L, "invalid format (width or precision too long)");
14416*(form++) = '%';
14417strncpy(form, strfrmt, p - strfrmt + 1);
14418form += p - strfrmt + 1;
14419*form = '\0';
14420return p;
14421}
14422
14423
14424static void addintlen (char *form) {

Callers 1

str_formatFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected