lua-users home
lua-l archive

Re: Avoid useless cast on call luaS_newlstr

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Maybe Lua never has to convert such large numbers.
The current limit is 44, you are worried that 32000 [or 2M] can be too
little?
> 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.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /