Lua: remove lua_data_handle

Use call_data_dissector directly for the same effect as lua_data_handle.

Remove the special case where DissectorTable.get_dissector() returns the
data dissector for an unsupported type. The documentation says that nil
is returned if the handle is not found, that seems more appropriate.

Change-Id: I128ef90b79bda925a4329202a0b9956e1cf16200
Reviewed-on: https://code.wireshark.org/review/34032
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Peter Wu 2019-07-20 22:24:56 +01:00 committed by Martin Kaiser
parent 4e2a63f543
commit a80b4fdd40
3 changed files with 2 additions and 7 deletions

View File

@ -124,8 +124,6 @@ static expert_field ei_lua_proto_deprecated_note = EI_INIT;
static expert_field ei_lua_proto_deprecated_warn = EI_INIT;
static expert_field ei_lua_proto_deprecated_error = EI_INIT;
dissector_handle_t lua_data_handle;
static gboolean
lua_pinfo_end(wmem_allocator_t *allocator _U_, wmem_cb_event_t event _U_,
void *user_data _U_)
@ -1037,8 +1035,6 @@ void wslua_init(register_cb cb, gpointer client_data) {
lua_tree = NULL;
lua_tvb = NULL;
lua_data_handle = find_dissector("data");
Proto_commit(L);
first_time = FALSE;

View File

@ -703,7 +703,6 @@ extern C shift##C(lua_State* L,int i)
extern packet_info* lua_pinfo;
extern TreeItem lua_tree;
extern tvbuff_t* lua_tvb;
extern dissector_handle_t lua_data_handle;
extern gboolean lua_initialized;
extern int lua_dissectors_table_ref;
extern int lua_heur_dissectors_table_ref;

View File

@ -561,7 +561,7 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) {
}
if (!handled) {
len = call_dissector(lua_data_handle,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree);
len = call_data_dissector(tvb->ws_tvb, pinfo->ws_pinfo, ti->tree);
}
/* XXX Are we sure about this??? is this the right/only thing to catch */
} CATCH_NONFATAL_ERRORS {
@ -583,7 +583,7 @@ WSLUA_METHOD DissectorTable_get_dissector (lua_State *L) {
DissectorTable dt = checkDissectorTable(L,1);
ftenum_t type;
dissector_handle_t handle = lua_data_handle;
dissector_handle_t handle = NULL;
if (!dt) return 0;