diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-19 11:37:09 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-19 11:37:09 -0300 |
| commit | 8704fca0c9f7a0c1c916d13ea03f6253daa6b13a (patch) | |
| tree | c95194426a03c02cbfe15633afe4a04da84be49a | |
| parent | 325e44d87e87ee14f2d683cd327d13ed8e6cd59b (diff) | |
| download | lua-8704fca0c9f7a0c1c916d13ea03f6253daa6b13a.tar.gz lua-8704fca0c9f7a0c1c916d13ea03f6253daa6b13a.tar.bz2 lua-8704fca0c9f7a0c1c916d13ea03f6253daa6b13a.zip | |
in 'luaL_checkversion_' check numeric types first. (Other tests
depend on correct numeric type.)
| -rw-r--r-- | lauxlib.c | 7 |
1 files changed, 3 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.265 2014/07/16 14:51:36 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.266 2014/07/17 12:30:53 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -952,13 +952,12 @@ LUALIB_API lua_State *luaL_newstate (void) { | |||
| 952 | 952 | ||
| 953 | LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { | 953 | LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { |
| 954 | const lua_Number *v = lua_version(L); | 954 | const lua_Number *v = lua_version(L); |
| 955 | if (sz != LUAL_NUMSIZES) /* check numeric types */ | ||
| 956 | luaL_error(L, "core and library have incompatible numeric types"); | ||
| 955 | if (v != lua_version(NULL)) | 957 | if (v != lua_version(NULL)) |
| 956 | luaL_error(L, "multiple Lua VMs detected"); | 958 | luaL_error(L, "multiple Lua VMs detected"); |
| 957 | else if (*v != ver) | 959 | else if (*v != ver) |
| 958 | luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", | 960 | luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", |
| 959 | ver, *v); | 961 | ver, *v); |
| 960 | /* check numeric types */ | ||
| 961 | if (sz != LUAL_NUMSIZES) | ||
| 962 | luaL_error(L, "core and library have incompatible numeric types"); | ||
| 963 | } | 962 | } |
| 964 | 963 | ||
