diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-01 01:22:23 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-01 01:22:23 -0300 |
commit | 95f3eefa5b03df5e14a30e81965a29a8b044f525 (patch) | |
tree | 46a1bf6ae6d5388300d887fa822363034c76ef6b | |
parent | e82bdb24f3727fbecb3d0596c1a8abc0af4cc687 (diff) | |
download | lua-95f3eefa5b03df5e14a30e81965a29a8b044f525.tar.gz lua-95f3eefa5b03df5e14a30e81965a29a8b044f525.tar.bz2 lua-95f3eefa5b03df5e14a30e81965a29a8b044f525.zip |
small optimization
-rw-r--r-- | lobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.16 2005/07/11 14:00:14 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.17 2005/07/31 17:11:50 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 | */ |
@@ -91,6 +91,7 @@ int luaO_str2d (const char *s, lua_Number *result) { | |||
91 | char *endptr; | 91 | char *endptr; |
92 | *result = lua_str2number(s, &endptr); | 92 | *result = lua_str2number(s, &endptr); |
93 | if (endptr == s) return 0; /* conversion failed */ | 93 | if (endptr == s) return 0; /* conversion failed */ |
94 | if (*endptr == '\0') return 1; /* most common case */ | ||
94 | while (isspace(cast(unsigned char, *endptr))) endptr++; | 95 | while (isspace(cast(unsigned char, *endptr))) endptr++; |
95 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ | 96 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ |
96 | return 1; | 97 | return 1; |