[glibc] inet: Implement inet_ntoa on top of inet_ntop
Adhemerval Zanella
azanella@sourceware.org
Tue Jun 24 17:21:25 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=db94e6343ad03252a9e59df56614118fb7267ff8
commit db94e6343ad03252a9e59df56614118fb7267ff8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Jun 4 17:42:44 2025 -0300
inet: Implement inet_ntoa on top of inet_ntop
Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
Diff:
---
inet/inet_ntoa.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c
index a4543f630d..2efd24ef18 100644
--- a/inet/inet_ntoa.c
+++ b/inet/inet_ntoa.c
@@ -23,15 +23,12 @@
/* The interface of this function is completely stupid, it requires a
static buffer. We relax this a bit in that we allow one buffer for
each thread. */
-static __thread char buffer[18];
+static __thread char buffer[INET_ADDRSTRLEN];
char *
inet_ntoa (struct in_addr in)
{
- unsigned char *bytes = (unsigned char *) ∈
- __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
- bytes[0], bytes[1], bytes[2], bytes[3]);
-
+ __inet_ntop (AF_INET, &in, buffer, sizeof buffer);
return buffer;
}
More information about the Glibc-cvs
mailing list