bugfix: don't use table.insert when nil can be insert

This commit is contained in:
云风
2013-09-02 11:18:42 +08:00
parent 56f6e0e62d
commit fb3dd69f03

View File

@@ -63,11 +63,10 @@ redcmd[42] = function(fd, data) -- '*'
for i = 1,n do
local line = readline(fd,"\r\n")
local bytes = tonumber(string.sub(line,2))
if bytes < 0 then
table.insert(bulk, nil)
else
if bytes >= 0 then
local data = readbytes(fd, bytes + 2)
table.insert(bulk, string.sub(data,1,-3))
-- bulk[i] = nil when bytes < 0
bulk[i] = string.sub(data,1,-3)
end
end
return true, bulk