aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-09 12:50:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-09 12:50:59 -0300
commita7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7 (patch)
tree46c3a143f3b703023d884e769485080862a3c27d /lauxlib.h
parent511d53a826760dd11cd82947184583e2d094e2d2 (diff)
downloadlua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.tar.gz
lua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.tar.bz2
lua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.zip
Uses of "likely" in macros active to all users
The use of 'l_likely' in auxlib macros 'luaL_argcheck' and 'luaL_argexpected' should not be restricted to Lua's own code. For that, 'l_likely' was renamed to 'luai_likely' to be exported to external code.
Diffstat (limited to 'lauxlib.h')
-rw-r--r--lauxlib.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/lauxlib.h b/lauxlib.h
index 9058e262..72f70e7d 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -12,6 +12,7 @@
12#include <stddef.h> 12#include <stddef.h>
13#include <stdio.h> 13#include <stdio.h>
14 14
15#include "luaconf.h"
15#include "lua.h" 16#include "lua.h"
16 17
17 18
@@ -122,10 +123,6 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
122** =============================================================== 123** ===============================================================
123*/ 124*/
124 125
125#if !defined(l_likely)
126#define l_likely(x) x
127#endif
128
129 126
130#define luaL_newlibtable(L,l) \ 127#define luaL_newlibtable(L,l) \
131 lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) 128 lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
@@ -134,10 +131,10 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
134 (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) 131 (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
135 132
136#define luaL_argcheck(L, cond,arg,extramsg) \ 133#define luaL_argcheck(L, cond,arg,extramsg) \
137 ((void)(l_likely(cond) || luaL_argerror(L, (arg), (extramsg)))) 134 ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg))))
138 135
139#define luaL_argexpected(L,cond,arg,tname) \ 136#define luaL_argexpected(L,cond,arg,tname) \
140 ((void)(l_likely(cond) || luaL_typeerror(L, (arg), (tname)))) 137 ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname))))
141 138
142#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) 139#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
143#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) 140#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))