** 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. */
| 289 | ** means a hexadecimal numeral. |
| 290 | */ |
| 291 | static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { |
| 292 | char *endptr; |
| 293 | *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ |
| 294 | : lua_str2number(s, &endptr); |
| 295 | if (endptr == s) return NULL; /* nothing recognized? */ |
| 296 | while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ |
| 297 | return (*endptr == '\0') ? endptr : NULL; /* OK iff no trailing chars */ |
| 298 | } |
| 299 | |
| 300 | |
| 301 | /* |
no test coverage detected