Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(lua/proxy_wasm) localize non-localized functions #583

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading