wslua: Drop unused "push_code" macro parameter

Reduce noise, no caller has used this parameter since its introduction.
Msotly automated regex search and replace.

Change-Id: I4b1180bfee8544b38d19c9c440ff5b9b0dc080b2
Reviewed-on: https://code.wireshark.org/review/14790
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2016-04-03 10:58:44 +02:00 committed by Anders Broman
parent cecb227af5
commit f6e223c895
24 changed files with 37 additions and 38 deletions

View File

@ -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) { \

View File

@ -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. */

View File

@ -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.

View File

@ -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()`.

View File

@ -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) {

View File

@ -29,7 +29,7 @@
#include "wslua.h"
#include <wsutil/file_util.h>
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.

View File

@ -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").

View File

@ -41,7 +41,7 @@
#include "wslua.h"
#include <math.h>
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))

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]].

View File

@ -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

View File

@ -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) {

View File

@ -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; }

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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[] = {

View File

@ -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 */

View File

@ -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

View File

@ -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.