diff options
author | Michael Mann <mmann78@netscape.net> | 2015-01-07 00:19:55 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-01-07 18:01:15 +0000 |
commit | 493f03b4200f96f45fadf3302b1d3bfb5a95b409 (patch) | |
tree | 2d5ec8e610e120f5f4890d4b98eff32428f879db /epan | |
parent | 2139110e54daa9985c95f9298ee2397b5981909f (diff) |
Remove bytestring_to_ep_str
Use wmem equivalent bytestring_to_str
Change-Id: I1ec7509e3adb36ab0f65317459653cb3b4b11af8
Reviewed-on: https://code.wireshark.org/review/6368
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/address_to_str.c | 6 | ||||
-rw-r--r-- | epan/oids.c | 8 | ||||
-rw-r--r-- | epan/to_str.c | 32 | ||||
-rw-r--r-- | epan/to_str.h | 3 |
4 files changed, 8 insertions, 41 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c index 004e18a586..6d8f26d203 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -203,11 +203,11 @@ ipx_addr_to_str(const guint32 net, const guint8 *ad) name = get_ether_name_if_known(ad); if (name) { - buf = ep_strdup_printf("%s.%s", get_ipxnet_name(net), name); + buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(net), name); } else { - buf = ep_strdup_printf("%s.%s", get_ipxnet_name(net), - bytestring_to_ep_str(ad, 6, '\0')); + buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(net), + bytestring_to_str(wmem_packet_scope(), ad, 6, '\0')); } return buf; } diff --git a/epan/oids.c b/epan/oids.c index d1d270eee1..2e5ec06447 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -199,7 +199,9 @@ extern void oid_add_from_encoded(const char* name, const guint8 *oid, gint oid_l D(3,("\tOid (from encoded): %s %s ",name, oid_subid2string(subids,subids_len))); add_oid(name,OID_KIND_UNKNOWN,NULL,NULL,subids_len,subids); } else { - D(1,("Failed to add Oid: %s [%d]%s ",name?name:"NULL", oid_len,bytestring_to_ep_str(oid, oid_len, ':'))); + gchar* bytestr = (gchar*)bytestring_to_str(NULL, oid, oid_len, ':'); + D(1,("Failed to add Oid: %s [%d]%s ",name?name:"NULL", oid_len, bytestr)); + wmem_free(NULL, bytestr); } } @@ -1283,10 +1285,10 @@ char* oid_test_a2b(guint32 num_subids, guint32* subids) { "oid_string2encoded=[%d]%s \n" "oid_string2subid=%s \n " ,sub2str - ,sub2enc_len,bytestring_to_ep_str(sub2enc, sub2enc_len, ':') + ,sub2enc_len,bytestring_to_str(wmem_packet_scope(), sub2enc, sub2enc_len, ':') ,enc2sub ? oid_subid2string(enc2sub,enc2sub_len) : "-" ,enc2str - ,str2enc_len,bytestring_to_ep_str(str2enc, str2enc_len, ':') + ,str2enc_len,bytestring_to_str(wmem_packet_scope(), str2enc, str2enc_len, ':') ,str2sub ? oid_subid2string(str2sub,str2sub_len) : "-" ); } diff --git a/epan/to_str.c b/epan/to_str.c index 20e965a717..4b77ddc2f8 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -163,38 +163,6 @@ bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct) * the resulting string is (len-1) bytes shorter) */ const gchar * -bytestring_to_ep_str(const guint8 *ad, const guint32 len, const char punct) -{ - gchar *buf; - size_t buflen; - - if (!ad) - REPORT_DISSECTOR_BUG("Null pointer passed to bytestring_to_ep_str()"); - - /* XXX, Old code was using int as iterator... Why len is guint32 anyway?! (darkjames) */ - if ( ((int) len) < 0) - return ""; - - if (!len) - return ""; - - if (punct) - buflen=len*3; - else - buflen=len*2 + 1; - - buf=(gchar *)ep_alloc(buflen); - - if (punct) - bytes_to_hexstr_punct(buf, ad, len, punct); - else - bytes_to_hexstr(buf, ad, len); - - buf[buflen-1] = '\0'; - return buf; -} - -const gchar * bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct) { gchar *buf; diff --git a/epan/to_str.h b/epan/to_str.h index de3fc7084d..b1892dda1a 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -145,9 +145,6 @@ WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *allocator, const guint8 *bd, */ WS_DLL_PUBLIC gchar *bytes_to_ep_str_punct(const guint8 *bd, int bd_len, gchar punct); -/* Deprecated, use bytestring_to_str instead */ -WS_DLL_PUBLIC const gchar *bytestring_to_ep_str(const guint8 *, const guint32, const char punct); - WS_DLL_PUBLIC const gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct); #ifdef __cplusplus |