summaryrefslogtreecommitdiff
path: root/src/lj_str.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-11-09 12:09:54 +0100
committerMike Pall <mike>2010-11-09 12:09:54 +0100
commitad29c1f39feb55d4d443b9352448a12a1be8ee23 (patch)
tree685adbbcad3f65cacf636dda30bf1785191d9c6e /src/lj_str.c
parentfe21a42a92546416cc235511c4e1949d850c0139 (diff)
downloadluajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.gz
luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.bz2
luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.zip
Rename character type handling from lj_ctype* to lj_char*.
Diffstat (limited to 'src/lj_str.c')
-rw-r--r--src/lj_str.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lj_str.c b/src/lj_str.c
index 618687f5..5e69ed0d 100644
--- a/src/lj_str.c
+++ b/src/lj_str.c
@@ -16,7 +16,7 @@
16#include "lj_err.h" 16#include "lj_err.h"
17#include "lj_str.h" 17#include "lj_str.h"
18#include "lj_state.h" 18#include "lj_state.h"
19#include "lj_ctype.h" 19#include "lj_char.h"
20 20
21/* -- String interning ---------------------------------------------------- */ 21/* -- String interning ---------------------------------------------------- */
22 22
@@ -180,27 +180,27 @@ int LJ_FASTCALL lj_str_numconv(const char *s, TValue *n)
180{ 180{
181 lua_Number sign = 1; 181 lua_Number sign = 1;
182 const uint8_t *p = (const uint8_t *)s; 182 const uint8_t *p = (const uint8_t *)s;
183 while (lj_ctype_isspace(*p)) p++; 183 while (lj_char_isspace(*p)) p++;
184 if (*p == '-') { p++; sign = -1; } else if (*p == '+') { p++; } 184 if (*p == '-') { p++; sign = -1; } else if (*p == '+') { p++; }
185 if ((uint32_t)(*p - '0') < 10) { 185 if ((uint32_t)(*p - '0') < 10) {
186 uint32_t k = (uint32_t)(*p++ - '0'); 186 uint32_t k = (uint32_t)(*p++ - '0');
187 if (k == 0 && ((*p & ~0x20) == 'X')) { 187 if (k == 0 && ((*p & ~0x20) == 'X')) {
188 p++; 188 p++;
189 if (!lj_ctype_isxdigit(*p)) 189 if (!lj_char_isxdigit(*p))
190 return 0; /* Don't accept '0x' without hex digits. */ 190 return 0; /* Don't accept '0x' without hex digits. */
191 do { 191 do {
192 if (k >= 0x10000000) goto parsedbl; 192 if (k >= 0x10000000) goto parsedbl;
193 k = (k << 4) + (*p & 15u); 193 k = (k << 4) + (*p & 15u);
194 if (!lj_ctype_isdigit(*p)) k += 9; 194 if (!lj_char_isdigit(*p)) k += 9;
195 p++; 195 p++;
196 } while (lj_ctype_isxdigit(*p)); 196 } while (lj_char_isxdigit(*p));
197 } else { 197 } else {
198 while ((uint32_t)(*p - '0') < 10) { 198 while ((uint32_t)(*p - '0') < 10) {
199 if (k >= 0x19999999) goto parsedbl; 199 if (k >= 0x19999999) goto parsedbl;
200 k = k * 10u + (uint32_t)(*p++ - '0'); 200 k = k * 10u + (uint32_t)(*p++ - '0');
201 } 201 }
202 } 202 }
203 while (LJ_UNLIKELY(lj_ctype_isspace(*p))) p++; 203 while (LJ_UNLIKELY(lj_char_isspace(*p))) p++;
204 if (LJ_LIKELY(*p == '\0')) { 204 if (LJ_LIKELY(*p == '\0')) {
205 setnumV(n, sign * cast_num(k)); 205 setnumV(n, sign * cast_num(k));
206 return 1; 206 return 1;
@@ -213,7 +213,7 @@ parsedbl:
213 setnumV(&tv, lua_str2number(s, &endptr)); 213 setnumV(&tv, lua_str2number(s, &endptr));
214 if (endptr == s) return 0; /* Conversion failed. */ 214 if (endptr == s) return 0; /* Conversion failed. */
215 if (LJ_UNLIKELY(*endptr != '\0')) { 215 if (LJ_UNLIKELY(*endptr != '\0')) {
216 while (lj_ctype_isspace((uint8_t)*endptr)) endptr++; 216 while (lj_char_isspace((uint8_t)*endptr)) endptr++;
217 if (*endptr != '\0') return 0; /* Invalid trailing characters? */ 217 if (*endptr != '\0') return 0; /* Invalid trailing characters? */
218 } 218 }
219 if (LJ_LIKELY(!tvisnan(&tv))) 219 if (LJ_LIKELY(!tvisnan(&tv)))