diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-05-06 14:17:09 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-05-06 14:17:09 -0300 |
| commit | b22a4280c68517988650c31f93d37d7c45b08703 (patch) | |
| tree | e26d2759f7b39af85e76ad1ceb1bbbde8180323f | |
| parent | 29fe3abda2f59005c94f9ad0f9b287bfcbacb710 (diff) | |
| download | lua-b22a4280c68517988650c31f93d37d7c45b08703.tar.gz lua-b22a4280c68517988650c31f93d37d7c45b08703.tar.bz2 lua-b22a4280c68517988650c31f93d37d7c45b08703.zip | |
macro 'nvalue' removed + cast to void added to avoid warnings
with 'clang'
| -rw-r--r-- | lvm.c | 13 |
1 files changed, 8 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.167 2013/04/29 17:12:50 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.168 2013/05/02 12:31:26 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -48,9 +48,11 @@ int luaV_tostring (lua_State *L, StkId obj) { | |||
| 48 | return 0; | 48 | return 0; |
| 49 | else { | 49 | else { |
| 50 | char s[LUAI_MAXNUMBER2STR]; | 50 | char s[LUAI_MAXNUMBER2STR]; |
| 51 | lua_Number n = nvalue(obj); | 51 | lua_Number n; |
| 52 | int l = lua_number2str(s, n); | 52 | int len; |
| 53 | setsvalue2s(L, obj, luaS_newlstr(L, s, l)); | 53 | (void)tonumber(obj, &n); |
| 54 | len = lua_number2str(s, n); | ||
| 55 | setsvalue2s(L, obj, luaS_newlstr(L, s, len)); | ||
| 54 | return 1; | 56 | return 1; |
| 55 | } | 57 | } |
| 56 | } | 58 | } |
| @@ -207,7 +209,8 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 207 | return 0; /* only numbers can be equal with different variants */ | 209 | return 0; /* only numbers can be equal with different variants */ |
| 208 | else { /* two numbers with different variants */ | 210 | else { /* two numbers with different variants */ |
| 209 | lua_Number n1, n2; | 211 | lua_Number n1, n2; |
| 210 | tonumber(t1, &n1); tonumber(t2, &n2); | 212 | lua_assert(ttisnumber(t1) && ttisnumber(t2)); |
| 213 | (void)tonumber(t1, &n1); (void)tonumber(t2, &n2); | ||
| 211 | return luai_numeq(n1, n2); | 214 | return luai_numeq(n1, n2); |
| 212 | } | 215 | } |
| 213 | } | 216 | } |
