Skip to content

Commit

Permalink
refactor: avoided using the deprecated string.len() builtin.
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Jul 19, 2014
1 parent e8c8a4f commit 7a58d54
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/resty/dns/resolver.lua
Expand Up @@ -7,7 +7,6 @@ local udp = ngx.socket.udp
local rand = math.random
local char = string.char
local byte = string.byte
local strlen = string.len
local find = string.find
local gsub = string.gsub
local substr = string.sub
Expand Down Expand Up @@ -176,7 +175,7 @@ end


local function _encode_name(s)
return char(strlen(s)) .. s
return char(#s) .. s
end


Expand Down Expand Up @@ -279,7 +278,7 @@ end


local function parse_response(buf, id)
local n = strlen(buf)
local n = #buf
if n < 12 then
return nil, 'truncated';
end
Expand Down Expand Up @@ -655,7 +654,7 @@ local function _tcp_query(self, query, id)
end

query = concat(query, "")
local len = strlen(query)
local len = #query

local len_hi = char(rshift(len, 8))
local len_lo = char(band(len, 0xff))
Expand Down

0 comments on commit 7a58d54

Please sign in to comment.