diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-12-11 19:52:15 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-12-14 05:19:59 +0000 |
commit | bfac7647976ef606ec2c98715e6b7d8f19f6b94e (patch) | |
tree | e883e21d0b66ed297101dcea512b26e3ffa430e6 /epan/wslua | |
parent | 3d0f9a4397125af15f40ab29e3fd1ad0ae2aae1a (diff) |
Lua: Cleanup ProtoField_time
Reverted some unneeded changes from 7f074364 because it's currently
only used for FT_ABSOLUTE_TIME.
Also fixed some small indent issues.
Change-Id: I923e35bf8ad4e991518bee973b87d4be06137463
Reviewed-on: https://code.wireshark.org/review/12539
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/wslua_proto_field.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/epan/wslua/wslua_proto_field.c b/epan/wslua/wslua_proto_field.c index 61861e93c1..bf50093856 100644 --- a/epan/wslua/wslua_proto_field.c +++ b/epan/wslua/wslua_proto_field.c @@ -763,10 +763,10 @@ PROTOFIELD_BOOL(bool,FT_BOOLEAN) static int ProtoField_time(lua_State* L,enum ftenum type) { ProtoField f; - const gchar* abbr = NULL; + const gchar* abbr = check_field_name(L,1,type); const gchar* name = luaL_optstring(L,2,abbr); unsigned base = (unsigned)luaL_optinteger(L,3,ABSOLUTE_TIME_LOCAL); - const gchar* blob = NULL; + const gchar* blob = luaL_optstring(L,4,NULL); if (!name[0]) { luaL_argerror(L, 2, "cannot be an empty string"); @@ -774,15 +774,10 @@ static int ProtoField_time(lua_State* L,enum ftenum type) { } if (type == FT_ABSOLUTE_TIME) { - abbr = check_field_name(L,1,type); - blob = luaL_optstring(L,4,NULL); - if (base < ABSOLUTE_TIME_LOCAL || base > ABSOLUTE_TIME_DOY_UTC) { - luaL_argerror(L, 3, "Base must be either LOCAL, UTC, or DOY_UTC"); - return 0; - } - } else { - abbr = check_field_name(L,1,type); - blob = luaL_optstring(L,3,NULL); + if (base < ABSOLUTE_TIME_LOCAL || base > ABSOLUTE_TIME_DOY_UTC) { + luaL_argerror(L, 3, "Base must be either LOCAL, UTC, or DOY_UTC"); + return 0; + } } f = g_new(wslua_field_t,1); @@ -796,9 +791,9 @@ static int ProtoField_time(lua_State* L,enum ftenum type) { f->base = base; f->mask = 0; if (blob && strcmp(blob, f->name) != 0) { - f->blob = g_strdup(blob); + f->blob = g_strdup(blob); } else { - f->blob = NULL; + f->blob = NULL; } pushProtoField(L,f); @@ -845,9 +840,9 @@ static int ProtoField_other(lua_State* L,enum ftenum type) { f->base = BASE_NONE; f->mask = 0; if (blob && strcmp(blob, f->name) != 0) { - f->blob = g_strdup(blob); + f->blob = g_strdup(blob); } else { - f->blob = NULL; + f->blob = NULL; } pushProtoField(L,f); |