aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-diameter.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-04-07 13:05:27 -0700
committerGerald Combs <gerald@wireshark.org>2016-04-07 22:36:28 +0000
commit90e1232672446e79e75e5c6877310a49f23ae228 (patch)
tree35a198bf526976a0928cef81f98c9a15587de03f /epan/dissectors/packet-diameter.c
parent71f2b6e1b4a7d011c55441decbc4a1ec27d9bd9c (diff)
Use faster string functions at startup.
Use wmem_strconcat and g_strconcat instead of wmem_strdup_printf and g_strdup_printf when we register various protocols. This shows a fairly significant speedup in the Visual Studio profiler. Change-Id: I98709329513daa66ad3665925dc69149c43df884 Reviewed-on: https://code.wireshark.org/review/14855 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/dissectors/packet-diameter.c')
-rw-r--r--epan/dissectors/packet-diameter.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 46c0037bb6..1d2100f1fa 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -1654,20 +1654,20 @@ build_address_avp(const avp_type_t *type _U_, guint32 code,
basic_avp_reginfo(a, name, FT_BYTES, BASE_NONE, NULL);
- reginfo(&(t->hf_address_type), wmem_strdup_printf(wmem_epan_scope(), "%s Address Family",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.addr_family",name)),
+ reginfo(&(t->hf_address_type), wmem_strconcat(wmem_epan_scope(), name, " Address Family", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".addr_family", NULL)),
NULL, FT_UINT16, (field_display_e)(BASE_DEC|BASE_EXT_STRING), &diameter_avp_data_addrfamily_vals_ext, 0);
- reginfo(&(t->hf_ipv4), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.IPv4",name)),
+ reginfo(&(t->hf_ipv4), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".IPv4", NULL)),
NULL, FT_IPv4, BASE_NONE, NULL, 0);
- reginfo(&(t->hf_ipv6), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.IPv6",name)),
+ reginfo(&(t->hf_ipv6), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".IPv6", NULL)),
NULL, FT_IPv6, BASE_NONE, NULL, 0);
- reginfo(&(t->hf_other), wmem_strdup_printf(wmem_epan_scope(), "%s Address",name),
- alnumerize(wmem_strdup_printf(wmem_epan_scope(), "diameter.%s.Bytes",name)),
+ reginfo(&(t->hf_other), wmem_strconcat(wmem_epan_scope(), name, " Address", NULL),
+ alnumerize(wmem_strconcat(wmem_epan_scope(), "diameter.", name, ".Bytes", NULL)),
NULL, FT_BYTES, BASE_NONE, NULL, 0);
g_ptr_array_add(build_dict.ett,ettp);
@@ -1733,7 +1733,7 @@ build_simple_avp(const avp_type_t *type, guint32 code, diam_vnd_t *vendor,
while (vs[i].strptr) {
i++;
}
- vs_ext = value_string_ext_new(vs, i+1, wmem_strdup_printf(wmem_epan_scope(), "%s_vals_ext",name));
+ vs_ext = value_string_ext_new(vs, i+1, wmem_strconcat(wmem_epan_scope(), name, "_vals_ext", NULL));
base = (field_display_e)(base|BASE_EXT_STRING);
}
@@ -1899,6 +1899,7 @@ dictionary_load(void)
/* load the dictionary */
dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "diameter" G_DIR_SEPARATOR_S, get_datafile_dir());
+ /* XXX We don't call ddict_free anywhere. */
d = ddict_scan(dir,"dictionary.xml",do_debug_parser);
g_free(dir);
if (d == NULL) {
@@ -1962,7 +1963,7 @@ dictionary_load(void)
dictionary.applications = value_string_ext_new((value_string *)wmem_array_get_raw(arr),
wmem_array_get_count(arr),
- wmem_strdup_printf(wmem_epan_scope(), "applications_vals_ext"));
+ wmem_strdup(wmem_epan_scope(), "applications_vals_ext"));
}
if ((v = d->vendors)) {