[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Avoid useless cast on call luaS_newlstr
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 2 Oct 2020 09:58:16 -0300
> Maybe Lua never has to convert such large numbers.
The current limit is 44, you are worried that 32000 [or 2M] can be too
> But to satisfy luaS_newlstr, better pass the correct type?
> - int len = tostringbuff(obj, buff);
> + size_t len = tostringbuff(obj, buff);
'tostringbuff' gets its result from lua_integer2str or lua_number2str,
which get this length from sprintf (or snprintf), which returns int.
This change would only move the cast to another place.