From 29bb6f65f1ac786b189ca6e860b463c5142bc486 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 20 Feb 2007 12:12:27 +0000 Subject: [PATCH] Move header file inclusion logic and definition of timeval struct for platforms that don't have it to setup_once.h --- ares/setup_once.h | 41 ++++++++++++++++++++++++++++++++++++++++ lib/setup_once.h | 41 ++++++++++++++++++++++++++++++++++++++++ lib/timeval.h | 21 -------------------- tests/libtest/testutil.c | 2 ++ tests/libtest/testutil.h | 20 -------------------- 5 files changed, 84 insertions(+), 41 deletions(-) diff --git a/ares/setup_once.h b/ares/setup_once.h index 41b42e900..32d8293ee 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -31,8 +31,49 @@ * Inclusion of common header files. */ +#include +#include +#include +#include +#include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +#ifdef WIN32 +#include +#include +#endif + + +/* + * Definition of timeval struct for platforms that don't have it. + */ + +#ifndef HAVE_STRUCT_TIMEVAL +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + /* * If we have the MSG_NOSIGNAL define, make sure we use diff --git a/lib/setup_once.h b/lib/setup_once.h index 2cf4ebea4..190b69ed7 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -38,8 +38,49 @@ * Inclusion of common header files. */ +#include +#include +#include +#include +#include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +#ifdef WIN32 +#include +#include +#endif + + +/* + * Definition of timeval struct for platforms that don't have it. + */ + +#ifndef HAVE_STRUCT_TIMEVAL +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + /* * If we have the MSG_NOSIGNAL define, make sure we use diff --git a/lib/timeval.h b/lib/timeval.h index 6c55a71ba..565409a2f 100644 --- a/lib/timeval.h +++ b/lib/timeval.h @@ -30,27 +30,6 @@ #include "setup.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -#ifndef HAVE_STRUCT_TIMEVAL -struct timeval { - long tv_sec; - long tv_usec; -}; -#endif - struct timeval curlx_tvnow(void); /* diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c index dc0211026..146660c71 100644 --- a/tests/libtest/testutil.c +++ b/tests/libtest/testutil.c @@ -21,6 +21,8 @@ * $Id$ ***************************************************************************/ +#include "setup.h" + #include "testutil.h" #ifndef HAVE_GETTIMEOFDAY diff --git a/tests/libtest/testutil.h b/tests/libtest/testutil.h index e248c1ebe..6f7839d24 100644 --- a/tests/libtest/testutil.h +++ b/tests/libtest/testutil.h @@ -25,26 +25,6 @@ #include "setup.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -#ifndef HAVE_STRUCT_TIMEVAL -struct timeval { - long tv_sec; - long tv_usec; -}; -#endif struct timeval tutil_tvnow(void);