diff options
author | João Valverde <j@v6e.pt> | 2021-09-16 20:34:07 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2021-09-17 00:08:41 +0100 |
commit | 18c155a3cabd258313a6d9bf2547f25deac32a8a (patch) | |
tree | 0b9002b3ef5b9d51dc98dfd307bd8227ece6a065 /wsutil | |
parent | 364df939eabc7732ae2c050d1594310ad7155451 (diff) |
wsutil: Remove ip6_to_str_buf_with_pfx()
Writing a string prefix shouldn't require a specialized function here.
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/to_str.c | 18 | ||||
-rw-r--r-- | wsutil/to_str.h | 3 |
2 files changed, 0 insertions, 21 deletions
diff --git a/wsutil/to_str.c b/wsutil/to_str.c index 9077306055..8c6125b662 100644 --- a/wsutil/to_str.c +++ b/wsutil/to_str.c @@ -606,24 +606,6 @@ char *ip6_to_str(wmem_allocator_t *scope, const ws_in6_addr *ad) return buf; } -int -ip6_to_str_buf_with_pfx(const ws_in6_addr *addr, gchar *buf, int buf_size, const char *prefix) -{ - int bytes; /* the number of bytes which would be produced if the buffer was large enough. */ - gchar addr_buf[WS_INET6_ADDRSTRLEN]; - int len; - - if (prefix == NULL) - prefix = ""; - bytes = g_snprintf(buf, buf_size, "%s%s", prefix, ws_inet_ntop6(addr, addr_buf, sizeof(addr_buf))); - len = bytes - 1; - - if (len > buf_size - 1) { /* size minus nul terminator */ - len = (int)g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_size); /* Let the unexpected value alert user */ - } - return len; -} - gchar * ipxnet_to_str_punct(wmem_allocator_t *allocator, const guint32 ad, const char punct) { diff --git a/wsutil/to_str.h b/wsutil/to_str.h index 08b3fe3678..a8d6f829fb 100644 --- a/wsutil/to_str.h +++ b/wsutil/to_str.h @@ -293,9 +293,6 @@ WS_DLL_PUBLIC void ip6_to_str_buf(const ws_in6_addr *ad, gchar *buf, size_t buf_ WS_DLL_PUBLIC char *ip6_to_str(wmem_allocator_t *scope, const ws_in6_addr *ad); -/* Returns length of the result. Takes a prefix to be inserted before the address. */ -WS_DLL_PUBLIC int ip6_to_str_buf_with_pfx(const ws_in6_addr *ad, gchar *buf, int buf_size, const char *prefix); - WS_DLL_PUBLIC gchar *ipxnet_to_str_punct(wmem_allocator_t *scope, const guint32 ad, const char punct); WS_DLL_PUBLIC gchar *eui64_to_str(wmem_allocator_t *scope, const guint64 ad); |