diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-15 16:44:43 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-15 16:44:43 -0300 |
| commit | cf22133b69c9974060d3b488046461a8523b7fe7 (patch) | |
| tree | 2096c5896338b851fc8fb864b3c56964933cc6d3 | |
| parent | b7be05ad276360ab4f5464e344079662fcebb13c (diff) | |
| download | lua-cf22133b69c9974060d3b488046461a8523b7fe7.tar.gz lua-cf22133b69c9974060d3b488046461a8523b7fe7.tar.bz2 lua-cf22133b69c9974060d3b488046461a8523b7fe7.zip | |
no need to avoid calling ctype functions as now they are implemented
by us (no inefficiencies due to accessing locale information)
| -rw-r--r-- | lobject.c | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.37 2010/04/05 16:26:37 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.38 2010/04/13 20:48:12 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -112,10 +112,8 @@ int luaO_str2d (const char *s, lua_Number *result) { | |||
| 112 | if (endptr == s) return 0; /* conversion failed */ | 112 | if (endptr == s) return 0; /* conversion failed */ |
| 113 | if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ | 113 | if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ |
| 114 | *result = cast_num(strtoul(s, &endptr, 16)); | 114 | *result = cast_num(strtoul(s, &endptr, 16)); |
| 115 | if (*endptr == '\0') return 1; /* most common case */ | ||
| 116 | while (lisspace(cast(unsigned char, *endptr))) endptr++; | 115 | while (lisspace(cast(unsigned char, *endptr))) endptr++; |
| 117 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ | 116 | return (*endptr == '\0'); /* OK if no trailing characters */ |
| 118 | return 1; | ||
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | 119 | ||
