diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h index 35ed62df3e..8211d839c5 100644 --- a/epan/wslua/wslua.h +++ b/epan/wslua/wslua.h @@ -362,10 +362,10 @@ typedef gchar* Struct; * WSLUA_CLASS_DEFINE must be used with a trailing ';' * (a dummy typedef is used to be syntactically correct) */ -#define WSLUA_CLASS_DEFINE(C,check_code,push_code) \ - WSLUA_CLASS_DEFINE_BASE(C,check_code,push_code,NULL) +#define WSLUA_CLASS_DEFINE(C,check_code) \ + WSLUA_CLASS_DEFINE_BASE(C,check_code,NULL) -#define WSLUA_CLASS_DEFINE_BASE(C,check_code,push_code,retval) \ +#define WSLUA_CLASS_DEFINE_BASE(C,check_code,retval) \ C to##C(lua_State* L, int idx) { \ C* v = (C*)lua_touserdata (L, idx); \ if (!v) luaL_error(L, "bad argument %d (%s expected, got %s)", idx, #C, lua_typename(L, lua_type(L, idx))); \ @@ -383,7 +383,6 @@ C* push##C(lua_State* L, C v) { \ luaL_checkstack(L,2,"Unable to grow stack\n"); \ p = (C*)lua_newuserdata(L,sizeof(C)); *p = v; \ luaL_getmetatable(L, #C); lua_setmetatable(L, -2); \ - push_code; \ return p; \ }\ gboolean is##C(lua_State* L,int i) { \ diff --git a/epan/wslua/wslua_address.c b/epan/wslua/wslua_address.c index 0516884b43..d4e5694f36 100644 --- a/epan/wslua/wslua_address.c +++ b/epan/wslua/wslua_address.c @@ -36,7 +36,7 @@ /* WSLUA_CONTINUE_MODULE Pinfo */ -WSLUA_CLASS_DEFINE(Address,FAIL_ON_NULL("Address"),NOP); /* Represents an address. */ +WSLUA_CLASS_DEFINE(Address,FAIL_ON_NULL("Address")); /* Represents an address. */ WSLUA_CONSTRUCTOR Address_ip(lua_State* L) { /* Creates an Address Object representing an IP address. */ diff --git a/epan/wslua/wslua_byte_array.c b/epan/wslua/wslua_byte_array.c index 5390fc366e..59c932ffa6 100644 --- a/epan/wslua/wslua_byte_array.c +++ b/epan/wslua/wslua_byte_array.c @@ -36,7 +36,7 @@ /* WSLUA_CONTINUE_MODULE Tvb */ -WSLUA_CLASS_DEFINE(ByteArray,FAIL_ON_NULL("ByteArray"),NOP); +WSLUA_CLASS_DEFINE(ByteArray,FAIL_ON_NULL("ByteArray")); WSLUA_CONSTRUCTOR ByteArray_new(lua_State* L) { /* Creates a `ByteArray` object. diff --git a/epan/wslua/wslua_capture_info.c b/epan/wslua/wslua_capture_info.c index c0b295c339..a05d9e44e0 100644 --- a/epan/wslua/wslua_capture_info.c +++ b/epan/wslua/wslua_capture_info.c @@ -34,7 +34,7 @@ /* WSLUA_CONTINUE_MODULE File */ -WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wth),NOP); +WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wth)); /* A `CaptureInfo` object, passed into Lua as an argument by `FileHandler` callback function `read_open()`, `read()`, `seek_read()`, `seq_read_close()`, and `read_close()`. @@ -300,7 +300,7 @@ int CaptureInfo_register(lua_State* L) { } -WSLUA_CLASS_DEFINE(CaptureInfoConst,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfoConst",wdh),NOP); +WSLUA_CLASS_DEFINE(CaptureInfoConst,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfoConst",wdh)); /* A `CaptureInfoConst` object, passed into Lua as an argument to the `FileHandler` callback function `write_open()`. diff --git a/epan/wslua/wslua_column.c b/epan/wslua/wslua_column.c index 2a1e781c3d..cd7e712b7b 100644 --- a/epan/wslua/wslua_column.c +++ b/epan/wslua/wslua_column.c @@ -48,7 +48,7 @@ void Push_Columns(lua_State *L, Columns c) } -WSLUA_CLASS_DEFINE(Column,FAIL_ON_NULL("Column"),NOP); /* A Column in the packet list. */ +WSLUA_CLASS_DEFINE(Column,FAIL_ON_NULL("Column")); /* A Column in the packet list. */ struct col_names_t { const gchar* name; @@ -261,7 +261,7 @@ int Column_register(lua_State *L) { } -WSLUA_CLASS_DEFINE(Columns,NOP,NOP); +WSLUA_CLASS_DEFINE(Columns,NOP); /* The Columns of the packet list. */ WSLUA_METAMETHOD Columns__tostring(lua_State *L) { diff --git a/epan/wslua/wslua_dir.c b/epan/wslua/wslua_dir.c index 9965a2f498..708683e124 100644 --- a/epan/wslua/wslua_dir.c +++ b/epan/wslua/wslua_dir.c @@ -29,7 +29,7 @@ #include "wslua.h" #include -WSLUA_CLASS_DEFINE(Dir,FAIL_ON_NULL("Dir"),NOP); /* A Directory object, as well as associated functions. */ +WSLUA_CLASS_DEFINE(Dir,FAIL_ON_NULL("Dir")); /* A Directory object, as well as associated functions. */ WSLUA_CONSTRUCTOR Dir_make(lua_State* L) { /* Creates a directory. diff --git a/epan/wslua/wslua_dissector.c b/epan/wslua/wslua_dissector.c index dbdf6e3956..0f0fe8ec14 100644 --- a/epan/wslua/wslua_dissector.c +++ b/epan/wslua/wslua_dissector.c @@ -38,7 +38,7 @@ /* WSLUA_CONTINUE_MODULE Proto */ -WSLUA_CLASS_DEFINE(Dissector,NOP,NOP); +WSLUA_CLASS_DEFINE(Dissector,NOP); /* A refererence to a dissector, used to call a dissector against a packet or a part of it. */ @@ -160,7 +160,7 @@ int Dissector_register(lua_State* L) { return 0; } -WSLUA_CLASS_DEFINE(DissectorTable,NOP,NOP); +WSLUA_CLASS_DEFINE(DissectorTable,NOP); /* A table of subdissectors of a particular protocol (e.g. TCP subdissectors like http, smtp, sip are added to table "tcp.port"). diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c index 8d61a087d9..8c0681f0c0 100644 --- a/epan/wslua/wslua_dumper.c +++ b/epan/wslua/wslua_dumper.c @@ -41,7 +41,7 @@ #include "wslua.h" #include -WSLUA_CLASS_DEFINE(PseudoHeader,NOP,NOP); +WSLUA_CLASS_DEFINE(PseudoHeader,NOP); /* A pseudoheader to be used to save captured frames. */ @@ -178,7 +178,7 @@ int PseudoHeader_register(lua_State* L) { } -WSLUA_CLASS_DEFINE(Dumper,FAIL_ON_NULL("Dumper already closed"),NOP); +WSLUA_CLASS_DEFINE(Dumper,FAIL_ON_NULL("Dumper already closed")); static GHashTable* dumper_encaps = NULL; #define DUMPER_ENCAP(d) GPOINTER_TO_INT(g_hash_table_lookup(dumper_encaps,d)) diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c index 48a5a6c6a3..d64513c5a2 100644 --- a/epan/wslua/wslua_field.c +++ b/epan/wslua/wslua_field.c @@ -34,7 +34,7 @@ #include "wslua.h" /* any call to checkFieldInfo() will now error on null or expired, so no need to check again */ -WSLUA_CLASS_DEFINE(FieldInfo,FAIL_ON_NULL_OR_EXPIRED("FieldInfo"),NOP); +WSLUA_CLASS_DEFINE(FieldInfo,FAIL_ON_NULL_OR_EXPIRED("FieldInfo")); /* An extracted Field from dissected packet data. A `FieldInfo` object can only be used within the callback functions of dissectors, post-dissectors, heuristic-dissectors, and taps. @@ -521,7 +521,7 @@ WSLUA_FUNCTION wslua_all_field_infos(lua_State* L) { return items_found; } -WSLUA_CLASS_DEFINE(Field,FAIL_ON_NULL("Field"),NOP); +WSLUA_CLASS_DEFINE(Field,FAIL_ON_NULL("Field")); /* A Field extractor to to obtain field values. A `Field` object can only be created *outside* of the callback functions of dissectors, post-dissectors, heuristic-dissectors, and taps. diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c index f1ad898169..508b8544df 100644 --- a/epan/wslua/wslua_file.c +++ b/epan/wslua/wslua_file.c @@ -41,7 +41,7 @@ */ -WSLUA_CLASS_DEFINE(File,FAIL_ON_NULL_OR_EXPIRED("File"),NOP); +WSLUA_CLASS_DEFINE(File,FAIL_ON_NULL_OR_EXPIRED("File")); /* A `File` object, passed into Lua as an argument by FileHandler callback functions (e.g., `read_open`, `read`, `write`, etc.). This behaves similarly to the diff --git a/epan/wslua/wslua_file_handler.c b/epan/wslua/wslua_file_handler.c index 1fced5dca5..35861036b0 100644 --- a/epan/wslua/wslua_file_handler.c +++ b/epan/wslua/wslua_file_handler.c @@ -31,7 +31,7 @@ /* WSLUA_CONTINUE_MODULE File */ -WSLUA_CLASS_DEFINE(FileHandler,NOP,NOP); +WSLUA_CLASS_DEFINE(FileHandler,NOP); /* A FileHandler object, created by a call to FileHandler.new(arg1, arg2, ...). The FileHandler object lets you create a file-format reader, or writer, or diff --git a/epan/wslua/wslua_frame_info.c b/epan/wslua/wslua_frame_info.c index ae6acc8016..1cebd4d5b2 100644 --- a/epan/wslua/wslua_frame_info.c +++ b/epan/wslua/wslua_frame_info.c @@ -31,7 +31,7 @@ /* WSLUA_CONTINUE_MODULE File */ -WSLUA_CLASS_DEFINE(FrameInfo,FAIL_ON_NULL_OR_EXPIRED("FrameInfo"),NOP); +WSLUA_CLASS_DEFINE(FrameInfo,FAIL_ON_NULL_OR_EXPIRED("FrameInfo")); /* A FrameInfo object, passed into Lua as an argument by FileHandler callback functions (e.g., `read`, `seek_read`, etc.). @@ -254,7 +254,7 @@ int FrameInfo_register(lua_State* L) { return 0; } -WSLUA_CLASS_DEFINE(FrameInfoConst,FAIL_ON_NULL_OR_EXPIRED("FrameInfo"),NOP); +WSLUA_CLASS_DEFINE(FrameInfoConst,FAIL_ON_NULL_OR_EXPIRED("FrameInfo")); /* A constant FrameInfo object, passed into Lua as an argument by the FileHandler write callback function. This has similar attributes/properties as FrameInfo, but the fields can diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c index ab091092cb..7732e4e235 100644 --- a/epan/wslua/wslua_gui.c +++ b/epan/wslua/wslua_gui.c @@ -282,7 +282,7 @@ WSLUA_FUNCTION wslua_new_dialog(lua_State* L) { /* Pops up a new dialog */ -WSLUA_CLASS_DEFINE(ProgDlg,FAIL_ON_NULL("ProgDlg"),NOP); /* Manages a progress bar dialog. */ +WSLUA_CLASS_DEFINE(ProgDlg,FAIL_ON_NULL("ProgDlg")); /* Manages a progress bar dialog. */ WSLUA_CONSTRUCTOR ProgDlg_new(lua_State* L) { /* Creates a new `ProgDlg` progress dialog. */ #define WSLUA_OPTARG_ProgDlg_new_TITLE 2 /* Title of the new window, defaults to "Progress". */ @@ -410,7 +410,7 @@ int ProgDlg_register(lua_State* L) { -WSLUA_CLASS_DEFINE(TextWindow,FAIL_ON_NULL_OR_EXPIRED("TextWindow"),NOP); /* Manages a text window. */ +WSLUA_CLASS_DEFINE(TextWindow,FAIL_ON_NULL_OR_EXPIRED("TextWindow")); /* Manages a text window. */ /* XXX: button and close callback data is being leaked */ /* XXX: lua callback function and TextWindow are not garbage collected because diff --git a/epan/wslua/wslua_int64.c b/epan/wslua/wslua_int64.c index 1304d10840..c2ddaab856 100644 --- a/epan/wslua/wslua_int64.c +++ b/epan/wslua/wslua_int64.c @@ -57,7 +57,7 @@ either expressed or implied, of the FreeBSD Project. #define IS_LITTLE_ENDIAN FALSE #endif -WSLUA_CLASS_DEFINE_BASE(Int64,NOP,NOP,0); +WSLUA_CLASS_DEFINE_BASE(Int64,NOP,0); /* `Int64` represents a 64 bit signed integer. @@ -611,7 +611,7 @@ LUALIB_API int Int64_register(lua_State* L) { -WSLUA_CLASS_DEFINE_BASE(UInt64,NOP,NOP,0); +WSLUA_CLASS_DEFINE_BASE(UInt64,NOP,0); /* `UInt64` represents a 64 bit unsigned integer, similar to `Int64`. For details, see: [[https://wiki.wireshark.org/LuaAPI/Int64]]. diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c index d65fde263c..85caa7316c 100644 --- a/epan/wslua/wslua_listener.c +++ b/epan/wslua/wslua_listener.c @@ -32,7 +32,7 @@ #include "wslua.h" -WSLUA_CLASS_DEFINE(Listener,FAIL_ON_NULL("Listener"),NOP); +WSLUA_CLASS_DEFINE(Listener,FAIL_ON_NULL("Listener")); /* A `Listener` is called once for every packet that matches a certain filter or has a certain tap. It can read the tree, the packet's `Tvb` buffer as well as the tapped data, but it cannot diff --git a/epan/wslua/wslua_nstime.c b/epan/wslua/wslua_nstime.c index 0c9abdb677..e04524151d 100644 --- a/epan/wslua/wslua_nstime.c +++ b/epan/wslua/wslua_nstime.c @@ -35,7 +35,7 @@ /* WSLUA_CONTINUE_MODULE Pinfo */ -WSLUA_CLASS_DEFINE(NSTime,FAIL_ON_NULL("NSTime"),NOP); +WSLUA_CLASS_DEFINE(NSTime,FAIL_ON_NULL("NSTime")); /* NSTime represents a nstime_t. This is an object with seconds and nanoseconds. */ WSLUA_CONSTRUCTOR NSTime_new(lua_State *L) { diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index ac3e6c0b5a..b86d9f5b87 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -61,7 +61,7 @@ Pinfo* push_Pinfo(lua_State* L, packet_info* ws_pinfo) { #define PUSH_PRIVATE_TABLE(L,c) {g_ptr_array_add(outstanding_PrivateTable,c);pushPrivateTable(L,c);} -WSLUA_CLASS_DEFINE(PrivateTable,FAIL_ON_NULL_OR_EXPIRED("PrivateTable"),NOP); +WSLUA_CLASS_DEFINE(PrivateTable,FAIL_ON_NULL_OR_EXPIRED("PrivateTable")); /* PrivateTable represents the pinfo->private_table. */ WSLUA_METAMETHOD PrivateTable__tostring(lua_State* L) { @@ -165,7 +165,7 @@ int PrivateTable_register(lua_State* L) { } -WSLUA_CLASS_DEFINE(Pinfo,FAIL_ON_NULL_OR_EXPIRED("Pinfo"),NOP); +WSLUA_CLASS_DEFINE(Pinfo,FAIL_ON_NULL_OR_EXPIRED("Pinfo")); /* Packet information. */ static int Pinfo__tostring(lua_State *L) { lua_pushstring(L,"a Pinfo"); return 1; } diff --git a/epan/wslua/wslua_pref.c b/epan/wslua/wslua_pref.c index daa9f5a062..d28427c381 100644 --- a/epan/wslua/wslua_pref.c +++ b/epan/wslua/wslua_pref.c @@ -34,7 +34,7 @@ /* WSLUA_CONTINUE_MODULE Proto */ -WSLUA_CLASS_DEFINE(Pref,NOP,NOP); /* A preference of a Protocol. */ +WSLUA_CLASS_DEFINE(Pref,NOP); /* A preference of a Protocol. */ static range_t* get_range(lua_State *L, int idx_r, int idx_m); @@ -327,7 +327,7 @@ WSLUA_REGISTER Pref_register(lua_State* L) { return 0; } -WSLUA_CLASS_DEFINE(Prefs,NOP,NOP); /* The table of preferences of a protocol. */ +WSLUA_CLASS_DEFINE(Prefs,NOP); /* The table of preferences of a protocol. */ WSLUA_METAMETHOD Prefs__newindex(lua_State* L) { /* Creates a new preference. */ diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 1bfacbb831..6bdecd4392 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -77,7 +77,7 @@ void clear_outstanding_FuncSavers(void) { } -WSLUA_CLASS_DEFINE(Proto,FAIL_ON_NULL("Proto"),NOP); +WSLUA_CLASS_DEFINE(Proto,FAIL_ON_NULL("Proto")); /* A new protocol in Wireshark. Protocols have more uses, the main one is to dissect a protocol. But they can also be just dummies used to register preferences for diff --git a/epan/wslua/wslua_proto_expert.c b/epan/wslua/wslua_proto_expert.c index 4c11754b3c..07ea90251d 100644 --- a/epan/wslua/wslua_proto_expert.c +++ b/epan/wslua/wslua_proto_expert.c @@ -35,7 +35,7 @@ /* WSLUA_CONTINUE_MODULE Proto */ -WSLUA_CLASS_DEFINE(ProtoExpert,FAIL_ON_NULL("null ProtoExpert"),NOP); +WSLUA_CLASS_DEFINE(ProtoExpert,FAIL_ON_NULL("null ProtoExpert")); /* A Protocol expert info field, to be used when adding items to the dissection tree. @since 1.11.3 diff --git a/epan/wslua/wslua_proto_field.c b/epan/wslua/wslua_proto_field.c index bf50093856..4e5f2a822e 100644 --- a/epan/wslua/wslua_proto_field.c +++ b/epan/wslua/wslua_proto_field.c @@ -35,7 +35,7 @@ /* WSLUA_CONTINUE_MODULE Proto */ -WSLUA_CLASS_DEFINE(ProtoField,FAIL_ON_NULL("null ProtoField"),NOP); +WSLUA_CLASS_DEFINE(ProtoField,FAIL_ON_NULL("null ProtoField")); /* A Protocol field (to be used when adding items to the dissection tree). */ static const wslua_ft_types_t ftenums[] = { diff --git a/epan/wslua/wslua_struct.c b/epan/wslua/wslua_struct.c index 17fe055896..8f85def523 100644 --- a/epan/wslua/wslua_struct.c +++ b/epan/wslua/wslua_struct.c @@ -162,7 +162,7 @@ /* The following line is here so that make-reg.pl does the right thing. This 'Struct' class isn't really a class, so it doesn't have the checkStruct/pushStruct/etc. functions the following macro would generate; but it does need to be registered and such, so... - WSLUA_CLASS_DEFINE_BASE(Struct,NOP,NOP,0); + WSLUA_CLASS_DEFINE_BASE(Struct,NOP,0); */ /* basic integer type - yes this is system-specific size - it's meant to be */ diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c index 25322d53ac..1ca9794a55 100644 --- a/epan/wslua/wslua_tree.c +++ b/epan/wslua/wslua_tree.c @@ -64,7 +64,7 @@ TreeItem create_TreeItem(proto_tree* tree, proto_item* item) CLEAR_OUTSTANDING(TreeItem, expired, TRUE) -WSLUA_CLASS_DEFINE(TreeItem,FAIL_ON_NULL_OR_EXPIRED("TreeItem"),NOP); +WSLUA_CLASS_DEFINE(TreeItem,FAIL_ON_NULL_OR_EXPIRED("TreeItem")); /* ++TreeItem++s represent information in the packet-details pane of Wireshark, and the packet details view of Tshark. A `TreeItem` represents a node in the tree, which might also be a subtree and have a list of diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c index 21dd6a8b76..1f06dd1160 100644 --- a/epan/wslua/wslua_tvb.c +++ b/epan/wslua/wslua_tvb.c @@ -59,7 +59,7 @@ * */ -WSLUA_CLASS_DEFINE(Tvb,FAIL_ON_NULL_OR_EXPIRED("Tvb"),NOP); +WSLUA_CLASS_DEFINE(Tvb,FAIL_ON_NULL_OR_EXPIRED("Tvb")); /* A `Tvb` represents the packet's buffer. It is passed as an argument to listeners and dissectors, and can be used to extract information (via `TvbRange`) from the packet's data. @@ -330,7 +330,7 @@ int Tvb_register(lua_State* L) { -WSLUA_CLASS_DEFINE(TvbRange,FAIL_ON_NULL("TvbRange"),NOP); +WSLUA_CLASS_DEFINE(TvbRange,FAIL_ON_NULL("TvbRange")); /* A `TvbRange` represents a usable range of a `Tvb` and is used to extract data from the `Tvb` that generated it.