diff options
author | Michael Mann <mmann78@netscape.net> | 2015-02-11 22:16:01 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-02-12 07:36:20 +0000 |
commit | 797ea88aefc2f45dba7e77d2dcaebe68ac1a4fac (patch) | |
tree | 94c34b167377a7ff494b16ab7a9fad5ebbcf7a79 /epan/address_types.c | |
parent | 297ef07b9b2f5b681234d0c31269996413262cbc (diff) |
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 work about the wmem_allocator.
Change-Id: I80f465ae0845290255a659ab63310ac3cc35506e
Reviewed-on: https://code.wireshark.org/review/7075
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/address_types.c')
-rw-r--r-- | epan/address_types.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/epan/address_types.c b/epan/address_types.c index 61d3f52a2d..4c447c6a94 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: |