From b2c81bb9e80aed27c32f29cc36f181149c57f18f Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 11 Feb 2015 22:16:01 -0500 Subject: Make get_manuf_name return a const string. Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table. This will make name resolution of addresses perform a little better because it doesn't have to worry about the wmem_allocator. Change-Id: If976fe7b0c3f9cd053225096c2ac05418f061af6 Reviewed-on: https://code.wireshark.org/review/7081 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/address_types.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'epan/address_types.c') diff --git a/epan/address_types.c b/epan/address_types.c index 10fa0ca888..901670fc41 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -429,7 +429,7 @@ static gboolean fcwwn_to_str(const address* addr, gchar *buf, int buf_len) const guint8 *addrp = (const guint8*)addr->data; int fmt; guint8 oui[6]; - gchar *ethptr, *manuf_name; + gchar *ethptr; if (buf_len < 200) { /* This is mostly for manufacturer name */ g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len); /* Let the unexpected value alert user */ @@ -444,9 +444,7 @@ static gboolean fcwwn_to_str(const address* addr, gchar *buf, int buf_len) case FC_NH_NAA_IEEE_E: memcpy (oui, &addrp[2], 6); - manuf_name = get_manuf_name(NULL, oui); - g_snprintf (ethptr, buf_len-23, " (%s)", manuf_name); - wmem_free(NULL, manuf_name); + g_snprintf (ethptr, buf_len-23, " (%s)", get_manuf_name(oui)); break; case FC_NH_NAA_IEEE_R: @@ -457,9 +455,7 @@ static gboolean fcwwn_to_str(const address* addr, gchar *buf, int buf_len) oui[4] = ((addrp[4] & 0x0F) << 4) | ((addrp[5] & 0xF0) >> 4); oui[5] = ((addrp[5] & 0x0F) << 4) | ((addrp[6] & 0xF0) >> 4); - manuf_name = get_manuf_name(NULL, oui); - g_snprintf (ethptr, buf_len-23, " (%s)", manuf_name); - wmem_free(NULL, manuf_name); + g_snprintf (ethptr, buf_len-23, " (%s)", get_manuf_name(oui)); break; default: -- cgit v1.2.3