Skip to content

Commit

Permalink
misc(lua/proxy_wasm) localize non-localized functions
Browse files Browse the repository at this point in the history
  • Loading branch information
casimiro committed Aug 9, 2024
1 parent fa4a249 commit 4642c59
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/resty/wasmx/proxy_wasm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ local pcall = pcall
local ffi_gc = ffi.gc
local ffi_new = ffi.new
local ffi_str = ffi.string
local ffi_cast = ffi.cast
local ffi_typeof = ffi.typeof
local tonumber = tonumber
local tostring = tostring
local getfenv = getfenv
Expand Down Expand Up @@ -77,8 +79,8 @@ else
end


local ffi_ops_type = ffi.typeof("ngx_wasm_plan_t *")
local ffi_pops_type = ffi.typeof("ngx_wasm_plan_t *[1]")
local ffi_ops_type = ffi_typeof("ngx_wasm_plan_t *")
local ffi_pops_type = ffi_typeof("ngx_wasm_plan_t *[1]")


function _M.new(filters)
Expand Down Expand Up @@ -119,13 +121,13 @@ function _M.new(filters)
local cconf = ffi_new("ngx_str_t", { data = config, len = #config })

local cfilter = cfilters[i - 1]
cfilter.name = ffi.cast("ngx_str_t *", cname)
cfilter.config = ffi.cast("ngx_str_t *", cconf)
cfilter.name = ffi_cast("ngx_str_t *", cname)
cfilter.config = ffi_cast("ngx_str_t *", cconf)
end

local plan = ffi_new(ffi_ops_type)
local pplan = ffi_new(ffi_pops_type, plan)
local pcfilters = ffi.cast("ngx_wasm_filter_t *", cfilters)
local pcfilters = ffi_cast("ngx_wasm_filter_t *", cfilters)
local errbuf, errlen = get_err_ptr()

local rc = C.ngx_http_wasm_ffi_plan_new(vm, pcfilters, nfilters,
Expand Down Expand Up @@ -334,7 +336,7 @@ do
end


c_props_setter = ffi.cast("ngx_proxy_wasm_properties_ffi_handler_pt",
c_props_setter = ffi_cast("ngx_proxy_wasm_properties_ffi_handler_pt",
function(r, ckey, cvalue, cerr)
set_r(r)

Expand Down Expand Up @@ -363,7 +365,7 @@ do
end)


c_props_getter = ffi.cast("ngx_proxy_wasm_properties_ffi_handler_pt",
c_props_getter = ffi_cast("ngx_proxy_wasm_properties_ffi_handler_pt",
function(r, ckey, cvalue, cerr)
set_r(r)

Expand Down

0 comments on commit 4642c59

Please sign in to comment.