diff options
author | Anders Broman <anders.broman@ericsson.com> | 2009-10-25 11:43:30 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2009-10-25 11:43:30 +0000 |
commit | 88bb44a51e350c9749323242482dc5e944697d8f (patch) | |
tree | a19835aec094d07536c6def639d5d5d236f0a1cd /epan/dissectors/packet-x25.c | |
parent | 337896f4c6777bc0b84a2e017ebcbb52100a312b (diff) |
From Jakub Zawadzki:
Cleanup dissector code - use proper memory functions.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4164
svn path=/trunk/; revision=30691
Diffstat (limited to 'epan/dissectors/packet-x25.c')
-rw-r--r-- | epan/dissectors/packet-x25.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index 9a5782c2e5..f921529163 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -290,8 +290,6 @@ x25_hash_add_proto_end(guint16 vc, guint32 frame) static const char *clear_code(unsigned char code) { - static char *buffer; - if (code == 0x00 || (code & 0x80) == 0x80) return "DTE Originated"; if (code == 0x01) @@ -321,16 +319,11 @@ static const char *clear_code(unsigned char code) if (code == 0x39) return "Destination Absent"; - buffer=ep_alloc(32); - g_snprintf(buffer, 32, "Unknown %02X", code); - - return buffer; + return ep_strdup_printf("Unknown %02X", code); } static const char *clear_diag(unsigned char code) { - static char *buffer; - if (code == 0) return "No additional information"; if (code == 1) @@ -549,16 +542,11 @@ static const char *clear_diag(unsigned char code) if (code == 250) return "Reset - user resynchronization"; - buffer=ep_alloc(32); - g_snprintf(buffer, 32, "Unknown %d", code); - - return buffer; + return ep_strdup_printf("Unknown %d", code); } static const char *reset_code(unsigned char code) { - static char *buffer; - if (code == 0x00 || (code & 0x80) == 0x80) return "DTE Originated"; if (code == 0x01) @@ -578,16 +566,11 @@ static const char *reset_code(unsigned char code) if (code == 0x1D) return "Network out of order"; - buffer=ep_alloc(32); - g_snprintf(buffer, 32, "Unknown %02X", code); - - return buffer; + return ep_strdup_printf("Unknown %02X", code); } static const char *restart_code(unsigned char code) { - static char *buffer; - if (code == 0x00 || (code & 0x80) == 0x80) return "DTE Originated"; if (code == 0x01) @@ -599,16 +582,11 @@ static const char *restart_code(unsigned char code) if (code == 0x7F) return "Registration/cancellation confirmed"; - buffer=ep_alloc(32); - g_snprintf(buffer, 32, "Unknown %02X", code); - - return buffer; + return ep_strdup_printf("Unknown %02X", code); } static const char *registration_code(unsigned char code) { - static char *buffer; - if (code == 0x03) return "Invalid facility request"; if (code == 0x05) @@ -618,10 +596,7 @@ static const char *registration_code(unsigned char code) if (code == 0x7F) return "Registration/cancellation confirmed"; - buffer=ep_alloc(32); - g_snprintf(buffer, 32, "Unknown %02X", code); - - return buffer; + return ep_strdup_printf("Unknown %02X", code); } static void |