From 15ad172a847fa667c57a4594ef4158405db9a984 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Tue, 31 Mar 2020 17:50:43 +0200 Subject: [HICN-554] hicn-light refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I36f2d393741d4502ce14d3791158e43e3e9cd4cf Signed-off-by: Jordan Augé --- lib/src/util/ip_address.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/src/util/ip_address.c') diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c index 49916547d..d4b34dc0b 100644 --- a/lib/src/util/ip_address.c +++ b/lib/src/util/ip_address.c @@ -302,10 +302,13 @@ ip_prefix_ntop(const ip_prefix_t * ip_prefix, char *dst, size_t size) } if (!s) return -1; - int rc = snprintf(dst, size, "%s/%d", ip_s, ip_prefix->len); - if (rc >= size) - return (int)size; - return rc; + return snprintf(dst, size, "%s/%d", ip_s, ip_prefix->len); +} + +int +ip_prefix_snprintf(char * s, size_t size, const ip_prefix_t * prefix) +{ + return ip_prefix_ntop(prefix, s, size); } int -- cgit 1.2.3-korg