diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
commit | 0dc9fb3d4ab00d14bf45c597471e10e601efd4d4 (patch) | |
tree | ae44175ca8fd23548fcec5833098b535af5e372c /epan/dissectors/packet-rsvp.c | |
parent | f3407856f4fd97caf90655205cdb2c66991e75ba (diff) |
various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants
svn path=/trunk/; revision=15264
Diffstat (limited to 'epan/dissectors/packet-rsvp.c')
-rw-r--r-- | epan/dissectors/packet-rsvp.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 6811a5aa54..0341871ae6 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -70,10 +70,6 @@ #include <glib.h> -#ifdef NEED_SNPRINTF_H -# include "snprintf.h" -#endif - #include <epan/tvbuff.h> #include <epan/packet.h> #include <prefs.h> @@ -1257,31 +1253,31 @@ static char *summary_session (tvbuff_t *tvb, int offset) switch(tvb_get_guint8(tvb, offset+3)) { case RSVP_SESSION_TYPE_IPV4: - snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ", + g_snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_guint8(tvb, offset+8), tvb_get_ntohs(tvb, offset+10)); break; case RSVP_SESSION_TYPE_IPV4_LSP: - snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ", + g_snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), tvb_get_ntohl(tvb, offset+12)); break; case RSVP_SESSION_TYPE_IPV4_UNI: - snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ", + g_snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), ip_to_str(tvb_get_ptr(tvb, offset+12, 4))); break; case RSVP_SESSION_TYPE_IPV4_E_NNI: - snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ", + g_snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ", ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10), ip_to_str(tvb_get_ptr(tvb, offset+12, 4))); break; default: - snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3)); + g_snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3)); } return buf; @@ -1299,17 +1295,17 @@ static char *summary_template (tvbuff_t *tvb, int offset) switch(tvb_get_guint8(tvb, offset+3)) { case 1: - snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype, + g_snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype, ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10)); break; case 7: - snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype, + g_snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype, ip_to_str(tvb_get_ptr(tvb, offset+4, 4)), tvb_get_ntohs(tvb, offset+10)); break; default: - snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3)); + g_snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3)); } return buf; |