From: Greg Stein Date: Sat, 10 Feb 2001 13:05:29 +0000 (+0000) Subject: Clean up some of the includes: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6afd185ea032a0d44c196bebd7c4e913945f6e1d;p=apache Clean up some of the includes: - explicitly include apr_lib.h since ap_config.h doesn't - use apr_want.h where possible - use APR_HAVE_ where possible - remove some unneeded includes git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88060 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/util_filter.h b/include/util_filter.h index 803a4aad4b..5914bf2a94 100644 --- a/include/util_filter.h +++ b/include/util_filter.h @@ -55,17 +55,18 @@ #ifndef AP_FILTER_H #define AP_FILTER_H -#ifdef __cplusplus -extern "C" { -#endif +#include "apr.h" +#include "apr_buckets.h" + +#include "httpd.h" -#ifdef APR_HAVE_STDARG_H +#if APR_HAVE_STDARG_H #include #endif -#include "httpd.h" -#include "apr.h" -#include "apr_buckets.h" +#ifdef __cplusplus +extern "C" { +#endif /** * @package Apache filter library diff --git a/modules/aaa/mod_access.c b/modules/aaa/mod_access.c index 10ddd77e93..11ef94e354 100644 --- a/modules/aaa/mod_access.c +++ b/modules/aaa/mod_access.c @@ -65,23 +65,22 @@ #include "apr_strings.h" #include "apr_network_io.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "ap_config.h" #include "httpd.h" #include "http_core.h" #include "http_config.h" #include "http_log.h" #include "http_request.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif -#ifdef HAVE_NETINET_IN_H + +#if APR_HAVE_NETINET_IN_H #include #endif - -#ifdef HAVE_ARPA_INET_H +#if APR_HAVE_ARPA_INET_H #include #endif diff --git a/modules/aaa/mod_auth.c b/modules/aaa/mod_auth.c index 9cd7c526bd..5644340689 100644 --- a/modules/aaa/mod_auth.c +++ b/modules/aaa/mod_auth.c @@ -70,9 +70,11 @@ * no control is passed along. */ -#include "ap_config.h" #include "apr_strings.h" #include "apr_md5.h" +#include "apr_lib.h" + +#include "ap_config.h" #include "httpd.h" #include "http_config.h" #include "http_core.h" diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index be071da380..a22614546f 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -101,7 +101,6 @@ #endif #include "httpd.h" #include "http_config.h" -#include "http_conf_globals.h" #include "http_core.h" #include "http_request.h" #include "http_log.h" diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c index 4ef2f1aed8..d5466d1af4 100644 --- a/modules/dav/fs/lock.c +++ b/modules/dav/fs/lock.c @@ -61,6 +61,9 @@ #include "apr_file_io.h" #include "apr_uuid.h" +#define APR_WANT_MEMFUNC +#include "apr_want.h" + #include "httpd.h" #include "http_log.h" diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 169be916dc..7aa02fd587 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -80,6 +80,11 @@ ** so that we can keep the connection open. */ +#include "apr_strings.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "httpd.h" #include "http_config.h" #include "http_core.h" @@ -88,7 +93,6 @@ #include "http_protocol.h" #include "http_request.h" #include "util_script.h" -#include "apr_strings.h" #include "mod_dav.h" diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index 8e9572ed40..22b1e2282e 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -57,6 +57,11 @@ ** - various utilities, repository-independent */ +#include "apr_strings.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "mod_dav.h" #include "http_request.h" @@ -65,8 +70,6 @@ #include "http_log.h" #include "http_protocol.h" -#include "apr_strings.h" - DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status, int error_id, const char *desc) { diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 09acb6d196..206960ebcf 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -69,6 +69,7 @@ #include "apr_thread_proc.h" #include "apr_hash.h" #include "apr_user.h" +#include "apr_lib.h" #define CORE_PRIVATE diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index dd8ef9ecd4..f7bdb1060a 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -64,9 +64,17 @@ * * Adapted to Apache by rst. * - * Version sort added by Martin Pool . */ + * Version sort added by Martin Pool . + */ #include "apr_strings.h" +#include "apr_fnmatch.h" +#include "apr_strings.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "ap_config.h" #include "httpd.h" #include "http_config.h" @@ -76,14 +84,7 @@ #include "http_log.h" #include "http_main.h" #include "util_script.h" -#include "apr_fnmatch.h" -#include "apr_strings.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif + module AP_MODULE_DECLARE_DATA autoindex_module; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index accca9fadf..55b9cbbf36 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -66,16 +66,13 @@ #include "apr.h" #include "apr_strings.h" #include "apr_buckets.h" +#include "apr_lib.h" #define APR_WANT_STDIO /* for sscanf */ #define APR_WANT_STRFUNC #define APR_WANT_MEMFUNC #include "apr_want.h" -#if APR_HAVE_STDARG_H -#include -#endif - #define CORE_PRIVATE #include "util_filter.h" #include "ap_config.h" @@ -94,7 +91,10 @@ #include "mod_core.h" -#ifdef HAVE_UNISTD_H +#if APR_HAVE_STDARG_H +#include +#endif +#if APR_HAVE_UNISTD_H #include #endif diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 1a71bc56f4..14d51d26b4 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -70,6 +70,9 @@ #include "apr_file_io.h" #include "apr_fnmatch.h" +#define APR_WANT_STRFUNC +#include "apr_want.h" + #define CORE_PRIVATE #include "ap_config.h" #include "httpd.h" @@ -84,7 +87,7 @@ #include "mod_core.h" -#ifdef APR_HAVE_STDARG_H +#if APR_HAVE_STDARG_H #include #endif diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index 6b103aae7a..3318027a50 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -179,24 +179,27 @@ * * --- rst */ -#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b" - #include "apr_strings.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "ap_config.h" #include "httpd.h" #include "http_config.h" #include "http_core.h" /* For REMOTE_NAME */ #include "http_log.h" #include "http_protocol.h" -#ifdef HAVE_UNISTD_H + +#if APR_HAVE_UNISTD_H #include #endif #ifdef HAVE_LIMITS_H #include #endif -#ifdef HAVE_STRINGS_H -#include -#endif + +#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b" module AP_MODULE_DECLARE_DATA config_log_module; diff --git a/modules/mappers/mod_alias.c b/modules/mappers/mod_alias.c index a7915d67b6..ea31c3398d 100644 --- a/modules/mappers/mod_alias.c +++ b/modules/mappers/mod_alias.c @@ -65,13 +65,16 @@ */ #include "apr_strings.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "ap_config.h" #include "httpd.h" #include "http_config.h" #include "http_request.h" -#ifdef HAVE_STRINGS_H -#include -#endif + typedef struct { const char *real; diff --git a/modules/mappers/mod_imap.c b/modules/mappers/mod_imap.c index 1ec4a349fa..2fbade814a 100644 --- a/modules/mappers/mod_imap.c +++ b/modules/mappers/mod_imap.c @@ -94,10 +94,11 @@ #include "apr.h" #include "apr_strings.h" +#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include /* for sscanf() */ -#endif +#define APR_WANT_STDIO /* for sscanf() */ +#define APR_WANT_STRFUNC +#include "apr_want.h" #include "ap_config.h" #include "httpd.h" @@ -108,12 +109,7 @@ #include "http_main.h" #include "http_log.h" #include "util_script.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif + #define IMAP_MAGIC_TYPE "application/x-httpd-imap" #define MAXVERTS 100 diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c index 3b4d691b1d..c6763bce26 100644 --- a/modules/mappers/mod_negotiation.c +++ b/modules/mappers/mod_negotiation.c @@ -66,10 +66,11 @@ #include "apr.h" #include "apr_strings.h" #include "apr_file_io.h" +#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include /* for EOF */ -#endif +#define APR_WANT_STDIO /* for EOF */ +#define APR_WANT_STRFUNC +#include "apr_want.h" #include "ap_config.h" #include "httpd.h" @@ -79,12 +80,7 @@ #include "http_core.h" #include "http_log.h" #include "util_script.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif + #define MAP_FILE_MAGIC_TYPE "application/x-type-map" diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 2253f90f9d..5b716c5075 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -88,6 +88,22 @@ ** www.engelschall.com */ +#include "apr.h" +#include "apr_strings.h" +#include "apr_user.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#define APR_WANT_IOVEC +#include "apr_want.h" + +#if APR_HAVE_UNISTD_H +#include +#endif +#if APR_HAVE_SYS_TYPES_H +#include +#endif + #include "ap_config.h" #include "httpd.h" #include "http_config.h" @@ -96,30 +112,11 @@ #include "http_log.h" #include "http_protocol.h" #include "mod_rewrite.h" -#include "apr_strings.h" -#include "apr_user.h" -#if !defined(OS2) && !defined(WIN32) +#if !defined(OS2) && !defined(WIN32) && !defined(BEOS) #include "unixd.h" #endif -#ifndef NO_WRITEV -#ifndef NETWARE -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#if APR_HAVE_SYS_UIO_H -#include -#endif -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif - /* ** +-------------------------------------------------------+ ** | | diff --git a/modules/mappers/mod_rewrite.h b/modules/mappers/mod_rewrite.h index fd70d37873..cb2b1f4c12 100644 --- a/modules/mappers/mod_rewrite.h +++ b/modules/mappers/mod_rewrite.h @@ -56,8 +56,8 @@ * University of Illinois, Urbana-Champaign. */ -#ifndef _MOD_REWRITE_H -#define _MOD_REWRITE_H 1 +#ifndef MOD_REWRITE_H +#define MOD_REWRITE_H 1 /* ** _ _ _ @@ -92,29 +92,31 @@ ** www.engelschall.com */ +#include "apr.h" + +#define APR_WANT_STRFUNC +#define APR_WANT_MEMFUNC +#include "apr_want.h" /* Include from the underlaying Unix system ... */ -#ifdef HAVE_STRING_H -#include -#endif -#ifdef APR_HAVE_STDARG_H +#if APR_HAVE_STDARG_H #include #endif -#ifdef HAVE_STDLIB_H +#if APR_HAVE_STDLIB_H #include #endif -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_CTYPE_H +#if APR_HAVE_CTYPE_H #include #endif -#ifndef NETWARE +#if APR_HAVE_SYS_TYPES_H #include #endif -/* are these needed anymore? rbb */ -#include -#include + +#include "ap_config.h" + +#ifdef HAVE_TIME_H +#include +#endif /* Include from the Apache server ... */ #define CORE_PRIVATE @@ -472,6 +474,4 @@ static int compare_lexicography(char *cpNum1, char *cpNum2); static char *find_closing_bracket(char *s, int left, int right); static char *find_char_in_brackets(char *s, int c, int left, int right); -#endif /* _MOD_REWRITE_H */ - -/*EOF*/ +#endif /* MOD_REWRITE_H */ diff --git a/server/log.c b/server/log.c index 9b7fec3798..6d641dd0a3 100644 --- a/server/log.c +++ b/server/log.c @@ -68,13 +68,18 @@ #include "apr_strings.h" #include "apr_errno.h" #include "apr_thread_proc.h" +#include "apr_lib.h" + +#define APR_WANT_STDIO +#define APR_WANT_STRFUNC +#include "apr_want.h" -#if APR_HAVE_STDIO_H -#include -#endif #if APR_HAVE_STDARG_H #include #endif +#if APR_HAVE_UNISTD_H +#include +#endif #define CORE_PRIVATE @@ -85,13 +90,6 @@ #include "http_log.h" #include "http_main.h" -#ifdef HAVE_STRINGS_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - typedef struct { char *t_name; int t_val; diff --git a/server/main.c b/server/main.c index c695622626..19c645ea2d 100644 --- a/server/main.c +++ b/server/main.c @@ -60,10 +60,10 @@ #include "apr_strings.h" #include "apr_getopt.h" #include "apr_general.h" +#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include -#endif +#define APR_WANT_STDIO +#include "apr_want.h" #define CORE_PRIVATE #include "ap_config.h" diff --git a/server/rfc1413.c b/server/rfc1413.c index 1279465c49..0239b26e01 100644 --- a/server/rfc1413.c +++ b/server/rfc1413.c @@ -82,17 +82,13 @@ #include "apr.h" #include "apr_network_io.h" #include "apr_strings.h" +#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include -#endif +#define APR_WANT_STDIO +#define APR_WANT_STRFUNC +#include "apr_want.h" #include "ap_config.h" - -#ifdef HAVE_STRING_H -#include -#endif - #include "httpd.h" /* for server_rec, conn_rec, etc. */ #include "http_log.h" /* for aplog_error */ #include "rfc1413.h" diff --git a/server/scoreboard.c b/server/scoreboard.c index 009cf28d2c..972a50ad05 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -56,8 +56,15 @@ * University of Illinois, Urbana-Champaign. */ +#include "apr.h" #include "apr_strings.h" #include "apr_portable.h" +#include "apr_lib.h" + +#if APR_HAVE_SYS_TYPES_H +#include +#endif + #include "ap_config.h" #include "httpd.h" #include "http_log.h" @@ -67,9 +74,6 @@ #include "mpm.h" #include "scoreboard.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL; AP_DECLARE_DATA const char *ap_scoreboard_fname=NULL; diff --git a/server/util.c b/server/util.c index cdd2892b71..012886e2d7 100644 --- a/server/util.c +++ b/server/util.c @@ -69,21 +69,23 @@ * #define DEBUG_CFG_LINES to trace every line read from the config files */ -#define CORE_PRIVATE - #include "apr.h" #include "apr_strings.h" +#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include /* for EOF */ -#endif -#if APR_HAVE_NETINET_IN_H -#include +#define APR_WANT_STDIO +#define APR_WANT_STRFUNC +#include "apr_want.h" + +#if APR_HAVE_UNISTD_H +#include #endif -#if APR_HAVE_SYS_SOCKET_H -#include +#if APR_HAVE_NETDB_H +#include /* for gethostbyname() */ #endif +#define CORE_PRIVATE + #include "ap_config.h" #include "apr_base64.h" #include "httpd.h" @@ -93,24 +95,12 @@ #include "http_config.h" #include "util_ebcdic.h" -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_GRP_H #include #endif -#ifdef HAVE_STRINGS_H -#include -#endif /* A bunch of functions in util.c scan strings looking for certain characters. * To make that more efficient we encode a lookup table. The test_char_table diff --git a/server/util_date.c b/server/util_date.c index 3967a6c02f..9a53646d31 100644 --- a/server/util_date.c +++ b/server/util_date.c @@ -67,16 +67,20 @@ * */ +#include "apr.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + +#if APR_HAVE_CTYPE_H +#include +#endif + #define CORE_PRIVATE #include "ap_config.h" #include "util_date.h" -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif /* * Compare a string to a mask diff --git a/server/util_debug.c b/server/util_debug.c index 0972832cfb..de5f469dbc 100644 --- a/server/util_debug.c +++ b/server/util_debug.c @@ -56,31 +56,46 @@ * University of Illinois, Urbana-Champaign. */ +#define APR_WANT_STRFUNC +#include "apr_want.h" + #include "httpd.h" #ifdef AP_DEBUG # undef strchr char *ap_strchr(char *s, int c) -{ return strchr(s,c); } +{ + return strchr(s,c); +} const char *ap_strchr_c(const char *s, int c) -{ return strchr(s,c); } +{ + return strchr(s,c); +} # undef strrchr char *ap_strrchr(char *s, int c) -{ return strrchr(s,c); } +{ + return strrchr(s,c); +} const char *ap_strrchr_c(const char *s, int c) -{ return strrchr(s,c); } +{ + return strrchr(s,c); +} #undef strstr char *ap_strstr(char *s, char *c) -{ return strstr(s,c); } +{ + return strstr(s,c); +} const char *ap_strstr_c(const char *s, const char *c) -{ return strstr(s,c); } +{ + return strstr(s,c); +} -#endif +#endif /* AP_DEBUG */ diff --git a/server/util_script.c b/server/util_script.c index 7ca5869a5b..9b4975c487 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -56,9 +56,19 @@ * University of Illinois, Urbana-Champaign. */ +#include "apr.h" +#include "apr_lib.h" +#include "apr_strings.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + +#if APR_HAVE_STDLIB_H +#include +#endif + #define CORE_PRIVATE #include "ap_config.h" -#include "apr_strings.h" #include "httpd.h" #include "http_config.h" #include "http_main.h" @@ -69,18 +79,6 @@ #include "util_script.h" #include "util_date.h" /* For parseHTTPdate() */ #include "util_ebcdic.h" -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif #ifdef OS2 #define INCL_DOS diff --git a/server/util_xml.c b/server/util_xml.c index c70e34e29f..a62230323b 100644 --- a/server/util_xml.c +++ b/server/util_xml.c @@ -63,9 +63,9 @@ #include "apr.h" #include "apr_strings.h" -#if APR_HAVE_STDIO_H -#include /* for fprintf(), sprintf() */ -#endif +#define APR_WANT_STDIO /* for fprintf(), sprintf() */ +#define APR_WANT_STRFUNC +#include "apr_want.h" #include "httpd.h" #include "http_protocol.h" diff --git a/server/vhost.c b/server/vhost.c index 2cae13abba..f82c986e18 100644 --- a/server/vhost.c +++ b/server/vhost.c @@ -61,6 +61,13 @@ * (configuration and run-time) */ +#include "apr.h" +#include "apr_strings.h" +#include "apr_lib.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + #define CORE_PRIVATE #include "ap_config.h" #include "httpd.h" @@ -69,23 +76,6 @@ #include "http_vhost.h" #include "http_protocol.h" #include "http_core.h" -#include "apr_strings.h" - -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif /* * After all the definitions there's an explanation of how it's all put