Skip to content

Commit 5ad21c2

Browse files
committed
optimize: avoid NYI for functions returning to lower frame
TRACE --- (87/5) var.lua:95 -- NYI: return to lower frame TRACE --- (69/6) param.lua:66 -- NYI: return to lower frame
1 parent 6650f3a commit 5ad21c2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/resty/core/param.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ local FFI_AGAIN = base.FFI_AGAIN
1212
local FFI_OK = base.FFI_OK
1313
local get_request = base.get_request
1414
local get_string_buf = base.get_string_buf
15+
local error = error
16+
local assert = assert
1517
local getmetatable = getmetatable
1618
local ngx = ngx
1719
local ngx_phase = ngx.get_phase
@@ -43,7 +45,8 @@ local function get_setby_param(r, idx)
4345
return nil
4446
end
4547

46-
return ffi_str(data_p[0], len_p[0])
48+
local s = ffi_str(data_p[0], len_p[0])
49+
return s
4750
end
4851

4952

@@ -56,14 +59,16 @@ local function get_body_filter_param(r, idx)
5659
local buf = get_string_buf(len_p[0])
5760
assert(C.ngx_http_lua_ffi_copy_body_filter_param_body(r, buf)
5861
== FFI_OK)
59-
return ffi_str(buf, len_p[0])
62+
local s = ffi_str(buf, len_p[0])
63+
return s
6064
end
6165

6266
if len_p[0] == 0 then
6367
return ""
6468
end
6569

66-
return ffi_str(data_p[0], len_p[0])
70+
local s = ffi_str(data_p[0], len_p[0])
71+
return s
6772

6873
elseif idx == 2 then
6974
local rc = C.ngx_http_lua_ffi_get_body_filter_param_eof(r)

lib/resty/core/var.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ local function var_get(self, name)
9292
-- ngx.log(ngx.WARN, "rc = ", rc)
9393

9494
if rc == 0 then -- NGX_OK
95-
return ffi_str(value_ptr[0], value_len[0])
95+
local s = ffi_str(value_ptr[0], value_len[0])
96+
return s
9697
end
9798

9899
if rc == -5 then -- NGX_DECLINED

0 commit comments

Comments
 (0)