summaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_column.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/wslua/wslua_column.c')
-rw-r--r--epan/wslua/wslua_column.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/epan/wslua/wslua_column.c b/epan/wslua/wslua_column.c
index 5ae0c4cc..b5712299 100644
--- a/epan/wslua/wslua_column.c
+++ b/epan/wslua/wslua_column.c
@@ -22,11 +22,11 @@
/* WSLUA_CONTINUE_MODULE Pinfo */
-static GPtrArray* outstanding_Column = NULL;
-static GPtrArray* outstanding_Columns = NULL;
+static GPtrArray* outstanding_Column;
+static GPtrArray* outstanding_Columns;
-CLEAR_OUTSTANDING(Column,expired, TRUE)
-CLEAR_OUTSTANDING(Columns,expired, TRUE)
+CLEAR_OUTSTANDING(Column,expired, true)
+CLEAR_OUTSTANDING(Columns,expired, true)
#define PUSH_COLUMN(L,c) {g_ptr_array_add(outstanding_Column,c);pushColumn(L,c);}
@@ -40,11 +40,11 @@ void Push_Columns(lua_State *L, Columns c)
WSLUA_CLASS_DEFINE(Column,FAIL_ON_NULL("Column")); /* A Column in the packet list. */
struct col_names_t {
- const gchar* name;
+ const char* name;
int id;
};
-// Duplicated belown in Columns__newindex.
+// Duplicated below in Columns__newindex.
static const struct col_names_t colnames[] = {
{"number",COL_NUMBER},
{"abs_time",COL_ABS_TIME},
@@ -91,7 +91,7 @@ static const struct col_names_t colnames[] = {
{NULL,0}
};
-static gint col_name_to_id(const gchar* name) {
+static int col_name_to_id(const char* name) {
const struct col_names_t* cn;
for(cn = colnames; cn->name; cn++) {
if (g_str_equal(cn->name,name)) {
@@ -102,7 +102,7 @@ static gint col_name_to_id(const gchar* name) {
return 0;
}
-static const gchar* col_id_to_name(gint id) {
+static const char* col_id_to_name(int id) {
const struct col_names_t* cn;
for(cn = colnames; cn->name; cn++) {
if ( cn->id == id ) {
@@ -115,7 +115,7 @@ static const gchar* col_id_to_name(gint id) {
WSLUA_METAMETHOD Column__tostring(lua_State *L) {
Column c = checkColumn(L,1);
- const gchar* text;
+ const char* text;
if (!c->cinfo) {
text = col_id_to_name(c->col);
@@ -136,7 +136,7 @@ static int Column__gc(lua_State* L) {
if (!col) return 0;
if (!col->expired)
- col->expired = TRUE;
+ col->expired = true;
else
g_free(col);
@@ -159,7 +159,7 @@ WSLUA_METHOD Column_set(lua_State *L) {
/* Sets the text of a Column. */
#define WSLUA_ARG_Column_set_TEXT 2 /* The text to which to set the Column. */
Column c = checkColumn(L,1);
- const gchar* s = luaL_checkstring(L,WSLUA_ARG_Column_set_TEXT);
+ const char* s = luaL_checkstring(L,WSLUA_ARG_Column_set_TEXT);
if (!(c->cinfo))
return 0;
@@ -173,7 +173,7 @@ WSLUA_METHOD Column_append(lua_State *L) {
/* Appends text to a Column. */
#define WSLUA_ARG_Column_append_TEXT 2 /* The text to append to the Column. */
Column c = checkColumn(L,1);
- const gchar* s = luaL_checkstring(L,WSLUA_ARG_Column_append_TEXT);
+ const char* s = luaL_checkstring(L,WSLUA_ARG_Column_append_TEXT);
if (!(c->cinfo))
return 0;
@@ -187,7 +187,7 @@ WSLUA_METHOD Column_prepend(lua_State *L) {
/* Prepends text to a Column. */
#define WSLUA_ARG_Column_prepend_TEXT 2 /* The text to prepend to the Column. */
Column c = checkColumn(L,1);
- const gchar* s = luaL_checkstring(L,WSLUA_ARG_Column_prepend_TEXT);
+ const char* s = luaL_checkstring(L,WSLUA_ARG_Column_prepend_TEXT);
if (!(c->cinfo))
return 0;
@@ -198,10 +198,7 @@ WSLUA_METHOD Column_prepend(lua_State *L) {
}
WSLUA_METHOD Column_fence(lua_State *L) {
- /* Sets Column text fence, to prevent overwriting.
-
- @since 1.10.6
- */
+ /* Sets Column text fence, to prevent overwriting. */
Column c = checkColumn(L,1);
if (c->cinfo)
@@ -211,10 +208,7 @@ WSLUA_METHOD Column_fence(lua_State *L) {
}
WSLUA_METHOD Column_clear_fence(lua_State *L) {
- /* Clear Column text fence.
-
- @since 1.11.3
- */
+ /* Clear Column text fence. */
Column c = checkColumn(L,1);
if (c->cinfo)
@@ -244,6 +238,9 @@ WSLUA_META Column_meta[] = {
int Column_register(lua_State *L) {
WSLUA_REGISTER_CLASS(Column);
+ if (outstanding_Column != NULL) {
+ g_ptr_array_unref(outstanding_Column);
+ }
outstanding_Column = g_ptr_array_new();
return 0;
}
@@ -361,7 +358,7 @@ WSLUA_METAMETHOD Columns__index(lua_State *L) {
Column c = (Column)g_malloc(sizeof(struct _wslua_col_info));
c->cinfo = NULL;
c->col = col_name_to_id(colname);
- c->expired = FALSE;
+ c->expired = false;
PUSH_COLUMN(L,c);
return 1;
@@ -378,7 +375,7 @@ WSLUA_METAMETHOD Columns__index(lua_State *L) {
Column c = (Column)g_malloc(sizeof(struct _wslua_col_info));
c->cinfo = cols->cinfo;
c->col = col_name_to_id(colname);
- c->expired = FALSE;
+ c->expired = false;
PUSH_COLUMN(L,c);
return 1;
@@ -402,7 +399,7 @@ static int Columns__gc(lua_State* L) {
if (!cols) return 0;
if (!cols->expired)
- cols->expired = TRUE;
+ cols->expired = true;
else
g_free(cols);
@@ -421,6 +418,9 @@ WSLUA_META Columns_meta[] = {
int Columns_register(lua_State *L) {
WSLUA_REGISTER_META(Columns);
+ if (outstanding_Columns != NULL) {
+ g_ptr_array_unref(outstanding_Columns);
+ }
outstanding_Columns = g_ptr_array_new();
return 0;
}