From cf0868fec89a1fcac53ff8421f9cf0d9345310c5 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Sat, 30 Oct 1999 14:22:10 +0000 Subject: [PATCH] Clean up regex header file mess. php.h now explicitly includes php_regex.h and php_regex.h figures out which regex header files to include and defines symbols that prevents other stuff from including the wrong versions of regex header files. --- ext/ereg/ereg.c | 1 - ext/ereg/php_regex.h | 10 ++++++++++ ext/standard/browscap.c | 1 - ext/standard/reg.c | 1 - ext/standard/url.c | 1 - main/php.h | 1 + main/php_regex.h | 10 ++++++++++ sapi/apache/mod_php4.c | 5 +++-- sapi/apache/sapi_apache.c | 3 ++- 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index c9f84ed973..7f50ce3170 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -22,7 +22,6 @@ #include #include "php.h" #include "php3_string.h" -#include "php_regex.h" #include "reg.h" unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h index ff7b5cfcb1..427604b417 100644 --- a/ext/ereg/php_regex.h +++ b/ext/ereg/php_regex.h @@ -3,11 +3,21 @@ #if REGEX #include "regex/regex.h" +#ifndef REGEX_H #define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */ +#endif +#ifndef REGEX_H_ #define _REGEX_H_ 1 +#endif +#ifndef RX_H #define _RX_H 1 /* Try defining these for Linux to */ +#endif +#ifndef REGEXP_LIBRARY_H #define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */ +#endif +#ifndef H_REGEX #define _H_REGEX 1 /* This one is for AIX */ +#endif #else #include #endif diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index e9ba30f530..34c8630c4a 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -19,7 +19,6 @@ #include "php.h" #include "php3_browscap.h" #include "php_ini.h" -#include "php_regex.h" #include "zend_globals.h" diff --git a/ext/standard/reg.c b/ext/standard/reg.c index c9f84ed973..7f50ce3170 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -22,7 +22,6 @@ #include #include "php.h" #include "php3_string.h" -#include "php_regex.h" #include "reg.h" unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; diff --git a/ext/standard/url.c b/ext/standard/url.c index 612af418b8..315e088065 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -23,7 +23,6 @@ #include #include "php.h" -#include "php_regex.h" #include "url.h" #ifdef _OSD_POSIX diff --git a/main/php.h b/main/php.h index 98f1dfacb6..104983efb4 100644 --- a/main/php.h +++ b/main/php.h @@ -73,6 +73,7 @@ extern unsigned char second_arg_allow_ref[]; #define THREAD_LS #endif +#include "php_regex.h" /* PHP's DEBUG value must match Zend's ZEND_DEBUG value */ #undef DEBUG diff --git a/main/php_regex.h b/main/php_regex.h index ff7b5cfcb1..427604b417 100644 --- a/main/php_regex.h +++ b/main/php_regex.h @@ -3,11 +3,21 @@ #if REGEX #include "regex/regex.h" +#ifndef REGEX_H #define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */ +#endif +#ifndef REGEX_H_ #define _REGEX_H_ 1 +#endif +#ifndef RX_H #define _RX_H 1 /* Try defining these for Linux to */ +#endif +#ifndef REGEXP_LIBRARY_H #define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */ +#endif +#ifndef H_REGEX #define _H_REGEX 1 /* This one is for AIX */ +#endif #else #include #endif diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index aff778db0b..5d693a3982 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -19,6 +19,9 @@ */ /* $Id$ */ +#include "zend.h" +#include "php.h" + #include "httpd.h" #include "http_config.h" #if MODULE_MAGIC_NUMBER > 19980712 @@ -34,8 +37,6 @@ #include "http_request.h" #include "http_log.h" -#include "zend.h" -#include "php.h" #include "php_ini.h" #include "php_globals.h" #include "SAPI.h" diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index 0e8b8029af..3676b2d13a 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -21,6 +21,8 @@ */ /* $Id$ */ +#include "php.h" + #include "httpd.h" #include "http_config.h" #if MODULE_MAGIC_NUMBER > 19980712 @@ -37,7 +39,6 @@ #include "http_log.h" #include "zend.h" -#include "php.h" #include "php_ini.h" #include "php_globals.h" #include "SAPI.h" -- 2.40.0