[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4.2 New assorted suggestions (Part II)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 21 Nov 2020 14:38:21 -0300
> /* avoid strlen call or inline */
> lua_pushlstring(L, "cannot close standard file", sizeof("cannot close standard file") - 1);
I suggest you use lua_pushliteral for string literals; it's good documentation.
lua_pushliteral is currently defined as lua_pushstring but in Lua 5.2
and previous versions it was defined as
#define lua_pushliteral(L, s) lua_pushlstring(L, "" s,
(sizeof(s)/sizeof(char))-1)
See https://www.lua.org/source/5.2/lua.h.html#lua_pushliteral
You may want to redefine lua_pushliteral back to this if you are
worried about strlen on literals.
- References:
- Lua 5.4.2 New assorted suggestions (Part II), Ranier Vilela
- Re: Lua 5.4.2 New assorted suggestions (Part II), Dibyendu Majumdar
- Re: Lua 5.4.2 New assorted suggestions (Part II), Ranier Vilela
- Re: Lua 5.4.2 New assorted suggestions (Part II), Dibyendu Majumdar
- Re: Lua 5.4.2 New assorted suggestions (Part II), Ranier Vilela
- Re: Lua 5.4.2 New assorted suggestions (Part II), Chris Smith
- Re: Lua 5.4.2 New assorted suggestions (Part II), Luiz Henrique de Figueiredo
- Re: Lua 5.4.2 New assorted suggestions (Part II), eugeny gladkih
- Re: Lua 5.4.2 New assorted suggestions (Part II), Roberto Ierusalimschy
- Re: Lua 5.4.2 New assorted suggestions (Part II), Ranier Vilela