aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2016-10-10 21:07:39 +0100
committerJoão Valverde <j@v6e.pt>2016-10-24 19:08:06 +0000
commit749ffd94d496561b269007a0fe0813d8be7df1bc (patch)
tree04b9b76f2bfed5349740434671a53f49f7b6f0ba /epan/packet.c
parente226abdbb05b37564599c6b92cd669b40749f2f6 (diff)
Remove some code duplication in packet.c
Change-Id: I60d71e0e4e7f3c35bec33910ecf4230569a1718c Reviewed-on: https://code.wireshark.org/review/18438 Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 50b24d7d85..28410f8e0d 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -2841,31 +2841,30 @@ dissector_handle_get_dissector_name(const dissector_handle_t handle)
return handle->name;
}
-/* Create an anonymous handle for a new dissector. */
-dissector_handle_t
-create_dissector_handle(dissector_t dissector, const int proto)
+static dissector_handle_t
+new_dissector_handle(dissector_t dissector, int proto, const char *name)
{
struct dissector_handle *handle;
handle = wmem_new(wmem_epan_scope(), struct dissector_handle);
- handle->name = NULL;
+ handle->name = name;
handle->dissector = dissector;
handle->protocol = find_protocol_by_id(proto);
-
return handle;
}
-dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
- const int proto, const char* name)
+/* Create an anonymous handle for a new dissector. */
+dissector_handle_t
+create_dissector_handle(dissector_t dissector, const int proto)
{
- struct dissector_handle *handle;
-
- handle = wmem_new(wmem_epan_scope(), struct dissector_handle);
- handle->name = name;
- handle->dissector = dissector;
- handle->protocol = find_protocol_by_id(proto);
+ return new_dissector_handle(dissector, proto, NULL);
+}
- return handle;
+dissector_handle_t
+create_dissector_handle_with_name(dissector_t dissector,
+ const int proto, const char* name)
+{
+ return new_dissector_handle(dissector, proto, name);
}
/* Destroy an anonymous handle for a dissector. */