| 151 | |
| 152 | |
| 153 | int 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 |
no test coverage detected