mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Remove some deadcode and use tor_inet_aton uniformly.
svn:r18422
This commit is contained in:
parent
2ebdf91a52
commit
fe987d3a17
@ -97,12 +97,6 @@
|
||||
#include "strlcat.c"
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
/* This is used by inet_addr, but apparently Solaris doesn't define it
|
||||
* anyplace. */
|
||||
#define INADDR_NONE ((unsigned long) -1)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
/** Try to create a memory mapping for <b>filename</b> and return it. On
|
||||
* failure, return NULL. Sets errno properly, using ERANGE to mean
|
||||
@ -1274,25 +1268,6 @@ tor_inet_aton(const char *str, struct in_addr* addr)
|
||||
if (d < 0 || d > 255) return 0;
|
||||
addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
|
||||
return 1;
|
||||
|
||||
#if 0
|
||||
#ifdef HAVE_INET_ATON
|
||||
return inet_aton(c, addr);
|
||||
#else
|
||||
uint32_t r;
|
||||
tor_assert(c);
|
||||
tor_assert(addr);
|
||||
if (strcmp(c, "255.255.255.255") == 0) {
|
||||
addr->s_addr = 0xFFFFFFFFu;
|
||||
return 1;
|
||||
}
|
||||
r = inet_addr(c);
|
||||
if (r == INADDR_NONE)
|
||||
return 0;
|
||||
addr->s_addr = r;
|
||||
return 1;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Given <b>af</b>==AF_INET and <b>src</b> a struct in_addr, or
|
||||
|
@ -355,20 +355,7 @@ error_is_eagain(int err)
|
||||
{
|
||||
return err == EAGAIN || err == WSAEWOULDBLOCK;
|
||||
}
|
||||
static int
|
||||
inet_aton(const char *c, struct in_addr *addr)
|
||||
{
|
||||
uint32_t r;
|
||||
if (strcmp(c, "255.255.255.255") == 0) {
|
||||
addr->s_addr = 0xffffffffu;
|
||||
} else {
|
||||
r = inet_addr(c);
|
||||
if (r == INADDR_NONE)
|
||||
return 0;
|
||||
addr->s_addr = r;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#define inet_aton(c, addr) tor_inet_aton((c), (addr))
|
||||
#define CLOSE_SOCKET(x) closesocket(x)
|
||||
#else
|
||||
#define last_error(sock) (errno)
|
||||
|
Loading…
Reference in New Issue
Block a user