in place of snprintf.
* modules/inttostr (Files): Add lib/uinttostr.c.
* lib/uinttostr.c (inttostr): New file/function.
* lib/inttostr.h (uinttostr): Declare.
* m4/inttostr.m4: Add AC_LIBOBJ([uinttostr]).
* MODULES.html.sh (Numeric conversion functions <stdlib.h>):
Add uinttostr.
* modules/getaddrinfo (Depends-on): Remove snprintf. Add inttostr.
+2006-10-23 Jim Meyering <jim@meyering.net>
+
+ * lib/getaddrinfo.c (getnameinfo): Use new lightweight uinttostr,
+ in place of snprintf.
+
+ * modules/inttostr (Files): Add lib/uinttostr.c.
+ * lib/uinttostr.c (inttostr): New file/function.
+ * lib/inttostr.h (uinttostr): Declare.
+ * m4/inttostr.m4: Add AC_LIBOBJ([uinttostr]).
+ * MODULES.html.sh (Numeric conversion functions <stdlib.h>):
+ Add uinttostr.
+ * modules/getaddrinfo (Depends-on): Remove snprintf. Add inttostr.
+
2006-10-21 Paul Eggert <eggert@cs.ucla.edu>
* lib/canonicalize.c (ELOOP): Define if not already defined.
func_begin_table
func_module intprops
func_module inttostr
+ func_module uinttostr
func_module xstrtoimax
func_module xstrtoumax
func_end_table
#define N_(String) String
#include "inet_ntop.h"
-#include "snprintf.h"
+#include "intprops.h"
#include "strdup.h"
/* BeOS has AF_INET, but not PF_INET. */
#if HAVE_IPV6
case AF_INET6:
#endif
- if (snprintf (service, servicelen, "%d",
- ntohs (((const struct sockaddr_in *) sa)->sin_port))
- + 1 > servicelen)
- return EAI_OVERFLOW;
+ {
+ unsigned short int port
+ = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+ char buf[INT_BUFSIZE_BOUND (port)];
+ char const *s = uinttostr (port, buf);
+ if (strlen (s) + 1 > servicelen)
+ return EAI_OVERFLOW;
+ memcpy (service, s, strlen (s) + 1);
+ }
break;
}
char *offtostr (off_t, char *);
char *imaxtostr (intmax_t, char *);
char *umaxtostr (uintmax_t, char *);
+char *uinttostr (unsigned int, char *);
--- /dev/null
+#define inttostr uinttostr
+#define inttype unsigned int
+#include "inttostr.c"
-#serial 6
+#serial 7
dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_LIBOBJ([imaxtostr])
AC_LIBOBJ([offtostr])
AC_LIBOBJ([umaxtostr])
+ AC_LIBOBJ([uinttostr])
gl_PREREQ_INTTOSTR
gl_PREREQ_IMAXTOSTR
gl_PREREQ_OFFTOSTR
gl_PREREQ_UMAXTOSTR
+ gl_PREREQ_UINTTOSTR
])
# Prerequisites of lib/inttostr.h.
# Prerequisites of lib/umaxtostr.c.
AC_DEFUN([gl_PREREQ_UMAXTOSTR], [:])
+
+# Prerequisites of lib/uinttostr.c.
+AC_DEFUN([gl_PREREQ_UINTTOSTR], [:])
Depends-on:
gettext-h
-snprintf
+inet_ntop
+inttostr
socklen
stdbool
strdup
sys_socket
-inet_ntop
configure.ac:
gl_GETADDRINFO
lib/inttostr.h
lib/offtostr.c
lib/umaxtostr.c
+lib/uinttostr.c
m4/inttostr.m4
Depends-on: