From 8061eba5269d954dc7e2d6b8786384804f87f209 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 9 Dec 2003 05:06:22 +0000 Subject: Add "ip6_to_str_buf()", by analogy to "ip_to_str_buf()". svn path=/trunk/; revision=9216 --- epan/resolv.c | 4 ++-- epan/to_str.c | 10 ++++++++-- epan/to_str.h | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'epan') diff --git a/epan/resolv.c b/epan/resolv.c index b7b0b2891e..4a70b0c4ab 100644 --- a/epan/resolv.c +++ b/epan/resolv.c @@ -1,7 +1,7 @@ /* resolv.c * Routines for network object lookup * - * $Id: resolv.c,v 1.38 2003/11/20 05:04:57 guy Exp $ + * $Id: resolv.c,v 1.39 2003/12/09 05:06:22 guy Exp $ * * Laurent Deniel * @@ -441,7 +441,7 @@ static guchar *host_name_lookup6(struct e_in6_addr *addr, gboolean *found) /* unknown host or DNS timeout */ #endif /* INET6 */ *found = FALSE; - sprintf(name, "%s", ip6_to_str(addr)); + ip6_to_str_buf(addr, name); return (name); } diff --git a/epan/to_str.c b/epan/to_str.c index d0784246cc..5742eebb91 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -1,7 +1,7 @@ /* to_str.c * Routines for utilities to convert various other types to strings. * - * $Id: to_str.c,v 1.41 2003/12/08 23:40:13 guy Exp $ + * $Id: to_str.c,v 1.42 2003/12/09 05:06:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -245,10 +245,16 @@ ip6_to_str(const struct e_in6_addr *ad) { } strp=str[i]; - inet_ntop(AF_INET6, (const guchar*)ad, (gchar*)strp, INET6_ADDRSTRLEN); + ip6_to_str_buf(ad, strp); return strp; } +void +ip6_to_str_buf(const struct e_in6_addr *ad, gchar *buf) +{ + inet_ntop(AF_INET6, (const guchar*)ad, buf, INET6_ADDRSTRLEN); +} + gchar* ipx_addr_to_str(guint32 net, const guint8 *ad) { diff --git a/epan/to_str.h b/epan/to_str.h index 58f8fe91c4..3c2a84b9af 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -1,7 +1,7 @@ /* to_str.h * Definitions for utilities to convert various other types to strings. * - * $Id: to_str.h,v 1.20 2003/12/08 23:40:13 guy Exp $ + * $Id: to_str.h,v 1.21 2003/12/09 05:06:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -54,6 +54,7 @@ extern void ip_to_str_buf(const guint8 *, gchar *); extern gchar* fc_to_str(const guint8 *); extern gchar* fcwwn_to_str (const guint8 *); extern char* ip6_to_str(const struct e_in6_addr *); +extern void ip6_to_str_buf(const struct e_in6_addr *, gchar *); extern gchar* ipx_addr_to_str(guint32, const guint8 *); extern gchar* ipxnet_to_string(const guint8 *ad); extern gchar* ipxnet_to_str_punct(const guint32 ad, char punct); -- cgit v1.2.3