diff options
author | Michael Mann <mmann78@netscape.net> | 2015-02-11 22:16:01 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-02-16 12:47:02 +0000 |
commit | b2c81bb9e80aed27c32f29cc36f181149c57f18f (patch) | |
tree | 5bd982154ff7f958fde346a0810e8c16afcca8ab /epan/address_types.c | |
parent | b2d23ec2fb2fc314d4014b98cb324ae7c2f9b489 (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 worry about the wmem_allocator.
Change-Id: If976fe7b0c3f9cd053225096c2ac05418f061af6
Reviewed-on: https://code.wireshark.org/review/7081
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
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 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: |