MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaO_str2d

Function luaO_str2d

freebsd/contrib/openzfs/module/lua/lobject.c:153–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151
152
153int luaO_str2d (const char *s, size_t len, lua_Number *result) {
154 char *endptr;
155 if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */
156 return 0;
157 else if (strpbrk(s, "xX")) /* hexa? */
158 *result = lua_strx2number(s, &endptr);
159 else
160 *result = lua_str2number(s, &endptr);
161 if (endptr == s) return 0; /* nothing recognized */
162 while (lisspace(cast_uchar(*endptr))) endptr++;
163 return (endptr == s + len); /* OK if no trailing characters */
164}
165
166
167

Callers 1

luaV_tonumberFunction · 0.70

Calls 2

strpbrkFunction · 0.85
lua_strx2numberFunction · 0.85

Tested by

no test coverage detected