** Convert string 's' to a Lua number (put in 'result'). Return NULL on ** fail or the address of the ending '\0' on success. ('mode' == 'x') ** means a hexadecimal numeral. */
| 226 | ** means a hexadecimal numeral. |
| 227 | */ |
| 228 | static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { |
| 229 | char *endptr; |
| 230 | *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ |
| 231 | : lua_str2number(s, &endptr); |
| 232 | if (endptr == s) return NULL; /* nothing recognized? */ |
| 233 | while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ |
| 234 | return (*endptr == '\0') ? endptr : NULL; /* OK iff no trailing chars */ |
| 235 | } |
| 236 | |
| 237 | |
| 238 | /* |
no test coverage detected