diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-10-18 09:51:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-10-18 09:51:44 -0300 |
commit | e5cfa7a3672eecfd81fb290faac9ac60c76e7231 (patch) | |
tree | 59dc6d9f10b2361b8156db93e0528bb21097df6e | |
parent | aae16127470f266e1852dad7ad99d72e0671addc (diff) | |
download | lua-e5cfa7a3672eecfd81fb290faac9ac60c76e7231.tar.gz lua-e5cfa7a3672eecfd81fb290faac9ac60c76e7231.tar.bz2 lua-e5cfa7a3672eecfd81fb290faac9ac60c76e7231.zip |
use of parentheses around macro parameters in call lists, to avoid
problems with comma expressions
-rw-r--r-- | lauxlib.h | 16 | ||||
-rw-r--r-- | lua.h | 28 |
2 files changed, 22 insertions, 22 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.71 2004/09/21 16:54:32 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.72 2004/09/29 21:00:25 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 | */ |
@@ -84,15 +84,15 @@ LUALIB_API const char *luaL_setfield (lua_State *L, int idx, const char *fname); | |||
84 | */ | 84 | */ |
85 | 85 | ||
86 | #define luaL_argcheck(L, cond,numarg,extramsg) \ | 86 | #define luaL_argcheck(L, cond,numarg,extramsg) \ |
87 | ((void)((cond) || luaL_argerror(L, numarg,extramsg))) | 87 | ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) |
88 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) | 88 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) |
89 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) | 89 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) |
90 | #define luaL_checkint(L,n) ((int)luaL_checkinteger(L, n)) | 90 | #define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) |
91 | #define luaL_optint(L,n,d) ((int)luaL_optinteger(L, n,d)) | 91 | #define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) |
92 | #define luaL_checklong(L,n) ((long)luaL_checkinteger(L, n)) | 92 | #define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) |
93 | #define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, n,d)) | 93 | #define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) |
94 | 94 | ||
95 | #define luaL_typename(L,i) lua_typename(L,lua_type(L,(i))) | 95 | #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) |
96 | 96 | ||
97 | /* | 97 | /* |
98 | ** {====================================================== | 98 | ** {====================================================== |
@@ -137,7 +137,7 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B); | |||
137 | 137 | ||
138 | #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) | 138 | #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) |
139 | 139 | ||
140 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref) | 140 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) |
141 | 141 | ||
142 | 142 | ||
143 | #endif | 143 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.192 2004/06/04 15:30:53 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.193 2004/09/15 20:39:42 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil | 4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil |
5 | ** http://www.lua.org mailto:info@lua.org | 5 | ** http://www.lua.org mailto:info@lua.org |
@@ -251,26 +251,26 @@ LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud); | |||
251 | 251 | ||
252 | #define lua_newtable(L) lua_createtable(L, 0, 0) | 252 | #define lua_newtable(L) lua_createtable(L, 0, 0) |
253 | 253 | ||
254 | #define lua_register(L,n,f) (lua_pushcfunction(L,f), lua_setglobal(L,n)) | 254 | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) |
255 | 255 | ||
256 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) | 256 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
257 | 257 | ||
258 | #define lua_strlen(L,i) lua_objsize(L,i) | 258 | #define lua_strlen(L,i) lua_objsize(L, (i)) |
259 | 259 | ||
260 | #define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION) | 260 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) |
261 | #define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE) | 261 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) |
262 | #define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA) | 262 | #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) |
263 | #define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL) | 263 | #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) |
264 | #define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN) | 264 | #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) |
265 | #define lua_isthread(L,n) (lua_type(L,n) == LUA_TTHREAD) | 265 | #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) |
266 | #define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE) | 266 | #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) |
267 | #define lua_isnoneornil(L, n) (lua_type(L,n) <= 0) | 267 | #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) |
268 | 268 | ||
269 | #define lua_pushliteral(L, s) \ | 269 | #define lua_pushliteral(L, s) \ |
270 | lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) | 270 | lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) |
271 | 271 | ||
272 | #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, s) | 272 | #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) |
273 | #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, s) | 273 | #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) |
274 | 274 | ||
275 | 275 | ||
276 | 276 | ||