fix argument types for legacy function inet_makeaddr
authorRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 03:17:24 +0000 (22:17 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 03:17:24 +0000 (22:17 -0500)
the type int was taken from seemingly erroneous man pages. glibc uses
in_addr_t (uint32_t), and semantically, the arguments should be
unsigned.

include/arpa/inet.h
src/network/inet_legacy.c

index 5dcadaaea6ed2159934f95c40d5353f073e99834..37f8c11eed4de3722077ac7170ebaf834ef055f1 100644 (file)
@@ -20,7 +20,7 @@ int inet_pton (int, const char *__restrict, void *__restrict);
 const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
 
 int inet_aton (const char *, struct in_addr *);
-struct in_addr inet_makeaddr(int, int);
+struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
 in_addr_t inet_lnaof(struct in_addr);
 in_addr_t inet_netof(struct in_addr);
 
index 0a0ad6fc607446dc75a48a36786771998a1eb884..de5b75c1ae4deb23fa0fd08b55904015ff40e8c9 100644 (file)
@@ -16,9 +16,8 @@ int inet_aton(const char *cp, struct in_addr *inp)
        return 1;
 }
 
-struct in_addr inet_makeaddr(int net, int host)
+struct in_addr inet_makeaddr(in_addr_t n, in_addr_t h)
 {
-       uint32_t n = net, h = host;
        if (n < 256) h |= n<<24;
        else if (n < 65536) h |= n<<16;
        else h |= n<<8;