Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src XNS5.2/POSIX-2001: change the size argument to inet_ntop fro...



details:   https://anonhg.NetBSD.org/src/rev/a25b81a9b170
branches:  trunk
changeset: 526954:a25b81a9b170
user:      kleink <kleink%NetBSD.org@localhost>
date:      Tue May 14 18:57:31 2002 +0000

description:
XNS5.2/POSIX-2001: change the size argument to inet_ntop from size_t to
socklen_t.

diffstat:

 include/arpa/inet.h      |  13 +++++++++++--
 lib/libc/net/inet.3      |   4 ++--
 lib/libc/net/inet_ntop.c |  16 +++++++++-------
 3 files changed, 22 insertions(+), 11 deletions(-)

diffs (110 lines):

diff -r 0a6c0d539395 -r a25b81a9b170 include/arpa/inet.h
--- a/include/arpa/inet.h       Tue May 14 18:26:37 2002 +0000
+++ b/include/arpa/inet.h       Tue May 14 18:57:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet.h,v 1.11 2002/04/26 15:32:45 bjh21 Exp $  */
+/*     $NetBSD: inet.h,v 1.12 2002/05/14 18:57:31 kleink Exp $ */
 
 /*
  * ++Copyright++ 1983, 1993
@@ -71,6 +71,15 @@
 #include <sys/cdefs.h>
 #include <netinet/in.h>
 
+#include <sys/ansi.h>
+
+#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
+#ifndef socklen_t
+typedef __socklen_t    socklen_t;
+#define socklen_t      __socklen_t
+#endif
+#endif /* !_XOPEN_SOURCE || (_XOPEN_SOURCE 0) >= 500 */
+
 __BEGIN_DECLS
 unsigned long   inet_addr __P((const char *));
 unsigned long   inet_lnaof __P((struct in_addr));
@@ -79,7 +88,7 @@
 unsigned long   inet_network __P((const char *));
 char           *inet_ntoa __P((struct in_addr));
 #if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
-const char     *inet_ntop __P((int, const void *, char *, size_t));
+const char     *inet_ntop __P((int, const void *, char *, socklen_t));
 int             inet_pton __P((int, const char *, void *));
 #endif
 #if !defined(_XOPEN_SOURCE)
diff -r 0a6c0d539395 -r a25b81a9b170 lib/libc/net/inet.3
--- a/lib/libc/net/inet.3       Tue May 14 18:26:37 2002 +0000
+++ b/lib/libc/net/inet.3       Tue May 14 18:57:31 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: inet.3,v 1.16 2002/02/07 07:00:21 ross Exp $
+.\"    $NetBSD: inet.3,v 1.17 2002/05/14 18:57:31 kleink Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -71,7 +71,7 @@
 .Ft char *
 .Fn inet_ntoa "struct in_addr in"
 .Ft const char *
-.Fn inet_ntop "int af" "const void *src" "char *dst" "size_t size"
+.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size"
 .Ft int
 .Fn inet_pton "int af" "const char *src" "void *dst"
 .Sh DESCRIPTION
diff -r 0a6c0d539395 -r a25b81a9b170 lib/libc/net/inet_ntop.c
--- a/lib/libc/net/inet_ntop.c  Tue May 14 18:26:37 2002 +0000
+++ b/lib/libc/net/inet_ntop.c  Tue May 14 18:57:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet_ntop.c,v 1.9 2000/01/22 22:19:16 mycroft Exp $    */
+/*     $NetBSD: inet_ntop.c,v 1.10 2002/05/14 18:57:31 kleink Exp $    */
 
 /* Copyright (c) 1996 by Internet Software Consortium.
  *
@@ -21,7 +21,7 @@
 #if 0
 static char rcsid[] = "Id: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp ";
 #else
-__RCSID("$NetBSD: inet_ntop.c,v 1.9 2000/01/22 22:19:16 mycroft Exp $");
+__RCSID("$NetBSD: inet_ntop.c,v 1.10 2002/05/14 18:57:31 kleink Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -54,8 +54,10 @@
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
-static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
+static const char *inet_ntop4 __P((const u_char *src, char *dst,
+                                  socklen_t size));
+static const char *inet_ntop6 __P((const u_char *src, char *dst,
+                                  socklen_t size));
 
 /* char *
  * inet_ntop(af, src, dst, size)
@@ -70,7 +72,7 @@
        int af;
        const void *src;
        char *dst;
-       size_t size;
+       socklen_t size;
 {
 
        _DIAGASSERT(src != NULL);
@@ -103,7 +105,7 @@
 inet_ntop4(src, dst, size)
        const u_char *src;
        char *dst;
-       size_t size;
+       socklen_t size;
 {
        static const char fmt[] = "%u.%u.%u.%u";
        char tmp[sizeof "255.255.255.255"];
@@ -129,7 +131,7 @@
 inet_ntop6(src, dst, size)
        const u_char *src;
        char *dst;
-       size_t size;
+       socklen_t size;
 {
        /*
         * Note that int32_t and int16_t need only be "at least" large enough



Home | Main Index | Thread Index | Old Index