Rename character type handling from lj_ctype* to lj_char*.
This commit is contained in:
14
src/lj_str.c
14
src/lj_str.c
@@ -16,7 +16,7 @@
|
||||
#include "lj_err.h"
|
||||
#include "lj_str.h"
|
||||
#include "lj_state.h"
|
||||
#include "lj_ctype.h"
|
||||
#include "lj_char.h"
|
||||
|
||||
/* -- String interning ---------------------------------------------------- */
|
||||
|
||||
@@ -180,27 +180,27 @@ int LJ_FASTCALL lj_str_numconv(const char *s, TValue *n)
|
||||
{
|
||||
lua_Number sign = 1;
|
||||
const uint8_t *p = (const uint8_t *)s;
|
||||
while (lj_ctype_isspace(*p)) p++;
|
||||
while (lj_char_isspace(*p)) p++;
|
||||
if (*p == '-') { p++; sign = -1; } else if (*p == '+') { p++; }
|
||||
if ((uint32_t)(*p - '0') < 10) {
|
||||
uint32_t k = (uint32_t)(*p++ - '0');
|
||||
if (k == 0 && ((*p & ~0x20) == 'X')) {
|
||||
p++;
|
||||
if (!lj_ctype_isxdigit(*p))
|
||||
if (!lj_char_isxdigit(*p))
|
||||
return 0; /* Don't accept '0x' without hex digits. */
|
||||
do {
|
||||
if (k >= 0x10000000) goto parsedbl;
|
||||
k = (k << 4) + (*p & 15u);
|
||||
if (!lj_ctype_isdigit(*p)) k += 9;
|
||||
if (!lj_char_isdigit(*p)) k += 9;
|
||||
p++;
|
||||
} while (lj_ctype_isxdigit(*p));
|
||||
} while (lj_char_isxdigit(*p));
|
||||
} else {
|
||||
while ((uint32_t)(*p - '0') < 10) {
|
||||
if (k >= 0x19999999) goto parsedbl;
|
||||
k = k * 10u + (uint32_t)(*p++ - '0');
|
||||
}
|
||||
}
|
||||
while (LJ_UNLIKELY(lj_ctype_isspace(*p))) p++;
|
||||
while (LJ_UNLIKELY(lj_char_isspace(*p))) p++;
|
||||
if (LJ_LIKELY(*p == '\0')) {
|
||||
setnumV(n, sign * cast_num(k));
|
||||
return 1;
|
||||
@@ -213,7 +213,7 @@ parsedbl:
|
||||
setnumV(&tv, lua_str2number(s, &endptr));
|
||||
if (endptr == s) return 0; /* Conversion failed. */
|
||||
if (LJ_UNLIKELY(*endptr != '\0')) {
|
||||
while (lj_ctype_isspace((uint8_t)*endptr)) endptr++;
|
||||
while (lj_char_isspace((uint8_t)*endptr)) endptr++;
|
||||
if (*endptr != '\0') return 0; /* Invalid trailing characters? */
|
||||
}
|
||||
if (LJ_LIKELY(!tvisnan(&tv)))
|
||||
|
||||
Reference in New Issue
Block a user