Clean up inclusion of <netinet/in.h>

Make all #include <netinet/in.h> conditional upon HAVE_NETINET_IN_H

Remove unnecessary #include <netinet/in.h> from source files

Reformat include block in "serval.h" for readability
This commit is contained in:
Andrew Bettison 2013-11-12 11:39:06 +10:30
parent 13634f8748
commit ba0ab14c69
7 changed files with 36 additions and 40 deletions

1
lsif.c
View File

@ -46,7 +46,6 @@
#ifndef SIOCGIFCONF #ifndef SIOCGIFCONF
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
#include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#if __MACH__ #if __MACH__
#include <net/if_dl.h> #include <net/if_dl.h>

1
net.c
View File

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <fcntl.h> #include <fcntl.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <time.h> #include <time.h>
#include "serval.h" #include "serval.h"

2
net.h
View File

@ -21,7 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/types.h> // for size_t, ssize_t #include <sys/types.h> // for size_t, ssize_t
#include <sys/socket.h> // for struct sockaddr, socklen_t #include <sys/socket.h> // for struct sockaddr, socklen_t
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> // for struct in_addr #include <netinet/in.h> // for struct in_addr
#endif
#include <arpa/inet.h> // for in_addr_t #include <arpa/inet.h> // for in_addr_t
#include "log.h" // for __WHENCE__ and struct __sourceloc #include "log.h" // for __WHENCE__ and struct __sourceloc

View File

@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
/* Android doesn't have log2(), and we don't really need to do floating point /* Android doesn't have log2(), and we don't really need to do floating point

View File

@ -33,42 +33,41 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #ifdef WIN32
#include "win32/win32.h" # include "win32/win32.h"
#else #else
#include <unistd.h> # include <unistd.h>
#ifdef HAVE_SYS_SOCKET_H # ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif # endif
#ifdef HAVE_NET_ROUTE_H # ifdef HAVE_NET_ROUTE_H
#include <net/route.h> # include <net/route.h>
#endif # endif
#ifdef HAVE_LINUX_IF_H # ifdef HAVE_LINUX_IF_H
#include <linux/if.h> # include <linux/if.h>
#else # else
#ifdef HAVE_NET_IF_H # ifdef HAVE_NET_IF_H
#include <net/if.h> # include <net/if.h>
#endif # endif
#endif # endif
#ifdef HAVE_NETINET_IN_H # ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif # endif
#ifdef HAVE_LINUX_NETLINK_H # ifdef HAVE_LINUX_NETLINK_H
#include <linux/netlink.h> # include <linux/netlink.h>
#endif # endif
#ifdef HAVE_LINUX_RTNETLINK_H # ifdef HAVE_LINUX_RTNETLINK_H
#include <linux/rtnetlink.h> # include <linux/rtnetlink.h>
#endif # endif
#ifdef HAVE_IFADDRS_H # ifdef HAVE_IFADDRS_H
#include <ifaddrs.h> # include <ifaddrs.h>
#endif # endif
#ifdef HAVE_SYS_SOCKIO_H # ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h> # include <sys/sockio.h>
#endif # endif
# ifdef HAVE_SYS_UCRED_H
#ifdef HAVE_SYS_UCRED_H # include <sys/ucred.h>
#include <sys/ucred.h> # endif
#endif #endif //!WIN32
#endif
#if !defined(FORASTERISK) && !defined(s_addr) #if !defined(FORASTERISK) && !defined(s_addr)
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H

View File

@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "serval.h" #include "serval.h"