MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / getnum

Function getnum

deps/lua/src/lua_struct.c:92–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91
92static int getnum (lua_State *L, const char **fmt, int df) {
93 if (!isdigit(**fmt)) /* no number? */
94 return df; /* return default value */
95 else {
96 int a = 0;
97 do {
98 if (a > (INT_MAX / 10) || a * 10 > (INT_MAX - (**fmt - '0')))
99 luaL_error(L, "integral size overflow");
100 a = a*10 + *((*fmt)++) - '0';
101 } while (isdigit(**fmt));
102 return a;
103 }
104}
105
106
107#define defaultoptions(h) ((h)->endian = native.endian, (h)->align = 1)

Callers 2

optsizeFunction · 0.85
controloptionsFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected