diff --git a/llex.c b/llex.c index 5a742cf6..e4bfa48d 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.41 2010/11/18 18:38:44 roberto Exp roberto $ +** $Id: llex.c,v 2.42 2010/12/06 21:08:36 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -286,13 +286,6 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { } -static int hexavalue (int c) { - if (lisdigit(c)) return c - '0'; - else if (lisupper(c)) return c - 'A' + 10; - else return c - 'a' + 10; -} - - static int readhexaesc (LexState *ls) { int c1, c2 = EOZ; if (!lisxdigit(c1 = next(ls)) || !lisxdigit(c2 = next(ls))) { @@ -302,7 +295,7 @@ static int readhexaesc (LexState *ls) { if (c2 != EOZ) save(ls, c2); lexerror(ls, "hexadecimal digit expected", TK_STRING); } - return (hexavalue(c1) << 4) + hexavalue(c2); + return (luaO_hexavalue(c1) << 4) + luaO_hexavalue(c2); } diff --git a/lobject.h b/lobject.h index 823b5cd2..864c613d 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.43 2010/11/26 14:32:31 roberto Exp roberto $ +** $Id: lobject.h,v 2.44 2010/12/06 21:08:36 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -413,6 +413,7 @@ LUAI_FUNC int luaO_ceillog2 (lu_int32 x); LUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2); LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); LUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result); +LUAI_FUNC int luaO_hexavalue (int c); LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp); LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);