summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-12-14 17:36:59 (GMT)
committerYang Tse <yangsita@gmail.com>2012-12-14 17:36:59 (GMT)
commit0c677f578e8be6050c976f3923b833fbe8fc9cfb (patch)
tree5953c9ef2d2eca4b27ddb1a3ac72d1f70429c4e6
parenta1035276c1354a2161cfe6c3050d6059060ff8bb (diff)
downloadc-ares-0c677f578e8be6050c976f3923b833fbe8fc9cfb.zip
c-ares-0c677f578e8be6050c976f3923b833fbe8fc9cfb.tar.gz
c-ares-0c677f578e8be6050c976f3923b833fbe8fc9cfb.tar.bz2
setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
Inclusion of these two header files now done in setup_once.h
-rw-r--r--acountry.c4
-rw-r--r--adig.c6
-rw-r--r--ahost.c5
-rw-r--r--ares__close_sockets.c4
-rw-r--r--ares__get_hostent.c3
-rw-r--r--ares_create_query.c3
-rw-r--r--ares_expand_name.c3
-rw-r--r--ares_expand_string.c3
-rw-r--r--ares_gethostbyaddr.c3
-rw-r--r--ares_gethostbyname.c3
-rw-r--r--ares_getnameinfo.c7
-rw-r--r--ares_init.c8
-rw-r--r--ares_nowarn.c3
-rw-r--r--ares_parse_a_reply.c3
-rw-r--r--ares_parse_aaaa_reply.c3
-rw-r--r--ares_parse_mx_reply.c3
-rw-r--r--ares_parse_naptr_reply.c3
-rw-r--r--ares_parse_ns_reply.c3
-rw-r--r--ares_parse_ptr_reply.c3
-rw-r--r--ares_parse_soa_reply.c3
-rw-r--r--ares_parse_srv_reply.c3
-rw-r--r--ares_parse_txt_reply.c3
-rw-r--r--ares_process.c6
-rw-r--r--ares_query.c3
-rw-r--r--ares_send.c3
-rw-r--r--inet_net_pton.c3
-rw-r--r--inet_ntop.c3
-rw-r--r--setup_once.h8
28 files changed, 9 insertions, 99 deletions
diff --git a/acountry.c b/acountry.c
index 6a20374..7a855c0 100644
--- a/acountry.c
+++ b/acountry.c
@@ -34,9 +34,6 @@
#include "ares_setup.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
@@ -44,7 +41,6 @@
#if defined(WIN32) && !defined(WATT32)
#include <winsock.h>
#else
- #include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
diff --git a/adig.c b/adig.c
index 19f6057..4783101 100644
--- a/adig.c
+++ b/adig.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
@@ -37,9 +34,6 @@
# include <arpa/nameser_compat.h>
#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
diff --git a/ahost.c b/ahost.c
index d415964..cb2bea1 100644
--- a/ahost.c
+++ b/ahost.c
@@ -17,14 +17,11 @@
#include "ares_setup.h"
#if !defined(WIN32) || defined(WATT32)
-#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#endif
+
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
diff --git a/ares__close_sockets.c b/ares__close_sockets.c
index e819e7d..d3d85ff 100644
--- a/ares__close_sockets.c
+++ b/ares__close_sockets.c
@@ -16,10 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include "ares.h"
#include "ares_private.h"
diff --git a/ares__get_hostent.c b/ares__get_hostent.c
index 94428ee..a9a80ef 100644
--- a/ares__get_hostent.c
+++ b/ares__get_hostent.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_create_query.c b/ares_create_query.c
index f41a0ef..8624e2f 100644
--- a/ares_create_query.c
+++ b/ares_create_query.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_expand_name.c b/ares_expand_name.c
index e69f1af..a66dfa9 100644
--- a/ares_expand_name.c
+++ b/ares_expand_name.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_expand_string.c b/ares_expand_string.c
index e55f53b..96d1be3 100644
--- a/ares_expand_string.c
+++ b/ares_expand_string.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_gethostbyaddr.c b/ares_gethostbyaddr.c
index 9971c4f..669a29d 100644
--- a/ares_gethostbyaddr.c
+++ b/ares_gethostbyaddr.c
@@ -15,9 +15,6 @@
*/
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_gethostbyname.c b/ares_gethostbyname.c
index 90f03a2..428b1ee 100644
--- a/ares_gethostbyname.c
+++ b/ares_gethostbyname.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c
index 351fb08..75cb7ed 100644
--- a/ares_getnameinfo.c
+++ b/ares_getnameinfo.c
@@ -22,9 +22,6 @@
# endif
#endif
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
@@ -47,10 +44,6 @@
#include <net/if.h>
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include "ares.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
diff --git a/ares_init.c b/ares_init.c
index 15d2934..aab1a50 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -21,10 +21,6 @@
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -46,10 +42,6 @@
# include <arpa/nameser_compat.h>
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#if defined(ANDROID) || defined(__ANDROID__)
#include <sys/system_properties.h>
/* From the Bionic sources */
diff --git a/ares_nowarn.c b/ares_nowarn.c
index dc33bcf..a4dce89 100644
--- a/ares_nowarn.c
+++ b/ares_nowarn.c
@@ -23,9 +23,6 @@
#if defined(__INTEL_COMPILER) && defined(__unix__)
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_a_reply.c b/ares_parse_a_reply.c
index 641ae79..9683ef5 100644
--- a/ares_parse_a_reply.c
+++ b/ares_parse_a_reply.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_aaaa_reply.c b/ares_parse_aaaa_reply.c
index d23676a..f5b6eae 100644
--- a/ares_parse_aaaa_reply.c
+++ b/ares_parse_aaaa_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_mx_reply.c b/ares_parse_mx_reply.c
index bc5e812..32d3af4 100644
--- a/ares_parse_mx_reply.c
+++ b/ares_parse_mx_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_naptr_reply.c b/ares_parse_naptr_reply.c
index 73a57a0..9315df7 100644
--- a/ares_parse_naptr_reply.c
+++ b/ares_parse_naptr_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_ns_reply.c b/ares_parse_ns_reply.c
index 1a4e801..553f253 100644
--- a/ares_parse_ns_reply.c
+++ b/ares_parse_ns_reply.c
@@ -20,9 +20,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_ptr_reply.c b/ares_parse_ptr_reply.c
index bb62b67..b505b92 100644
--- a/ares_parse_ptr_reply.c
+++ b/ares_parse_ptr_reply.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_soa_reply.c b/ares_parse_soa_reply.c
index 611a215..da1c6dc 100644
--- a/ares_parse_soa_reply.c
+++ b/ares_parse_soa_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_srv_reply.c b/ares_parse_srv_reply.c
index 6b2526c..9f61f19 100644
--- a/ares_parse_srv_reply.c
+++ b/ares_parse_srv_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_parse_txt_reply.c b/ares_parse_txt_reply.c
index 26737ed..dcc6473 100644
--- a/ares_parse_txt_reply.c
+++ b/ares_parse_txt_reply.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_process.c b/ares_process.c
index 25eb24c..2a02f16 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
@@ -44,9 +41,6 @@
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
diff --git a/ares_query.c b/ares_query.c
index 6104128..31084da 100644
--- a/ares_query.c
+++ b/ares_query.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/ares_send.c b/ares_send.c
index ab85a2d..1a450b1 100644
--- a/ares_send.c
+++ b/ares_send.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/inet_net_pton.c b/inet_net_pton.c
index f4e58f9..8199934 100644
--- a/inet_net_pton.c
+++ b/inet_net_pton.c
@@ -18,9 +18,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/inet_ntop.c b/inet_ntop.c
index e5ffb10..ea1ebb8 100644
--- a/inet_ntop.c
+++ b/inet_ntop.c
@@ -17,9 +17,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
diff --git a/setup_once.h b/setup_once.h
index bb261e7..3dad534 100644
--- a/setup_once.h
+++ b/setup_once.h
@@ -76,6 +76,14 @@
#include <stdbool.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
/*
* Definition of timeval struct for platforms that don't have it.