Fixed dbuf variable scope in luaRedisGenericCommand().

I'm not sure if while the visibility is the inner block, the fact we
point to 'dbuf' is a problem or not, probably the stack var isx
guaranteed to live until the function returns. However obvious code is
better anyway.
This commit is contained in:
antirez 2014-06-04 18:57:12 +02:00
parent 3307db49bd
commit 3758f27bc1

View File

@ -232,11 +232,11 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
for (j = 0; j < argc; j++) {
char *obj_s;
size_t obj_len;
char dbuf[64];
if (lua_isnumber(lua,j+1)) {
/* We can't use lua_tolstring() for number -> string conversion
* since Lua uses a format specifier that loses precision. */
char dbuf[64];
lua_Number num = lua_tonumber(lua,j+1);
obj_len = snprintf(dbuf,sizeof(dbuf),"%.17g",(double)num);