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

Function getnum

3rd/lua-5.4.3/src/lstrlib.c:1398–1408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396static int digit (int c) { return '0' <= c && c <= '9'; }
1397
1398static int getnum (const char **fmt, int df) {
1399 if (!digit(**fmt)) /* no number? */
1400 return df; /* return default value */
1401 else {
1402 int a = 0;
1403 do {
1404 a = a*10 + (*((*fmt)++) - '0');
1405 } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10);
1406 return a;
1407 }
1408}
1409
1410
1411/*

Callers 2

getnumlimitFunction · 0.85
getoptionFunction · 0.85

Calls 1

digitFunction · 0.85

Tested by

no test coverage detected