Browse Source

reinstate external visibility of inet_ntoa_r,
and add it to arpa/inet.h header.

Denis Vlasenko 17 years ago
parent
commit
fe86551422
2 changed files with 5 additions and 1 deletions
  1. 2 0
      include/arpa/inet.h
  2. 3 1
      libc/inet/addr.c

+ 2 - 0
include/arpa/inet.h

@@ -52,6 +52,8 @@ extern in_addr_t inet_network (__const char *__cp) __THROW;
 /* Convert Internet number in IN to ASCII representation.  The return value
 /* Convert Internet number in IN to ASCII representation.  The return value
    is a pointer to an internal array containing the string.  */
    is a pointer to an internal array containing the string.  */
 extern char *inet_ntoa (struct in_addr __in) __THROW;
 extern char *inet_ntoa (struct in_addr __in) __THROW;
+/* Recursion-safe flavor */
+extern char *inet_ntoa_r (struct in_addr __in, char *__buf) __THROW;
 
 
 /* Convert from presentation format of an Internet number in buffer
 /* Convert from presentation format of an Internet number in buffer
    starting at CP to the binary network format and store result for
    starting at CP to the binary network format and store result for

+ 3 - 1
libc/inet/addr.c

@@ -122,7 +122,8 @@ libc_hidden_def(inet_addr)
 
 
 #define INET_NTOA_MAX_LEN	16	/* max 12 digits + 3 '.'s + 1 nul */
 #define INET_NTOA_MAX_LEN	16	/* max 12 digits + 3 '.'s + 1 nul */
 
 
-static char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN])
+libc_hidden_proto(inet_ntoa_r)
+char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN])
 {
 {
 	in_addr_t addr = ntohl(in.s_addr);
 	in_addr_t addr = ntohl(in.s_addr);
 	int i;
 	int i;
@@ -141,6 +142,7 @@ static char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN])
 
 
 	return p+1;
 	return p+1;
 }
 }
+libc_hidden_def(inet_ntoa_r)
 
 
 libc_hidden_proto(inet_ntoa)
 libc_hidden_proto(inet_ntoa)
 char *inet_ntoa(struct in_addr in)
 char *inet_ntoa(struct in_addr in)