From e7e2056d1a993a01c9d57fb2261066855d282d8f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 22 Mar 2019 10:29:18 +0100 Subject: [PATCH] Remove HAVE_PCRE/HAVE_BUNDLED_PCRE checks PCRE is always available. --- ext/mbstring/mbstring.c | 4 ++-- ext/pcre/php_pcre.c | 4 ---- ext/pcre/php_pcre.h | 8 -------- ext/spl/spl_iterators.c | 14 -------------- ext/spl/spl_iterators.h | 6 ------ main/SAPI.c | 2 -- main/internal_functions_win32.c | 4 ---- 7 files changed, 2 insertions(+), 40 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 004a1d40d6..48436550a4 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -60,7 +60,7 @@ # include "php_onig_compat.h" # include # undef UChar -#elif HAVE_PCRE || HAVE_BUNDLED_PCRE +#else # include "ext/pcre/php_pcre.h" #endif @@ -1043,7 +1043,7 @@ static void _php_mb_free_regex(void *opaque) onig_free((php_mb_regex_t *)opaque); } /* }}} */ -#elif HAVE_PCRE || HAVE_BUNDLED_PCRE +#else /* {{{ _php_mb_compile_regex */ static void *_php_mb_compile_regex(const char *pattern) { diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0da18b315a..fe79360f9a 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -24,8 +24,6 @@ #include "ext/standard/basic_functions.h" #include "zend_smart_str.h" -#if HAVE_PCRE || HAVE_BUNDLED_PCRE - #include "ext/standard/php_string.h" #define PREG_PATTERN_ORDER 1 @@ -3079,5 +3077,3 @@ PHPAPI pcre2_code *php_pcre_pce_re(pcre_cache_entry *pce) assert(NULL != pce); return pce->re; }/*}}}*/ - -#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */ diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index eca3ca5fdf..ba38a26a08 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -19,8 +19,6 @@ #ifndef PHP_PCRE_H #define PHP_PCRE_H -#if HAVE_PCRE || HAVE_BUNDLED_PCRE - #if HAVE_BUNDLED_PCRE #include "pcre2lib/pcre2.h" #else @@ -83,12 +81,6 @@ ZEND_END_MODULE_GLOBALS(pcre) PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre) #define PCRE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcre, v) -#else - -#define pcre_module_ptr NULL - -#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */ - #define phpext_pcre_ptr pcre_module_ptr #endif /* PHP_PCRE_H */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 8731afec56..56960770ed 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1521,7 +1521,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0); zend_restore_error_handling(&error_handling); return intern; -#if HAVE_PCRE || HAVE_BUNDLED_PCRE case DIT_RegexIterator: case DIT_RecursiveRegexIterator: { zend_string *regex; @@ -1551,7 +1550,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z php_pcre_pce_incref(intern->u.regex.pce); break; } -#endif case DIT_CallbackFilterIterator: case DIT_RecursiveCallbackFilterIterator: { _spl_cbfilter_it_intern *cfi = emalloc(sizeof(*cfi)); @@ -1953,7 +1951,6 @@ SPL_METHOD(ParentIterator, __construct) spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_ParentIterator, spl_ce_RecursiveIterator, DIT_ParentIterator); } /* }}} */ -#if HAVE_PCRE || HAVE_BUNDLED_PCRE /* {{{ proto RegexIterator::__construct(Iterator it, string regex [, int mode [, int flags [, int preg_flags]]]) Create an RegexIterator from another iterator and a regular expression */ SPL_METHOD(RegexIterator, __construct) @@ -2265,8 +2262,6 @@ SPL_METHOD(RecursiveRegexIterator, accept) zend_call_method_with_0_params(ZEND_THIS, spl_ce_RegexIterator, NULL, "accept", return_value); } -#endif - /* {{{ spl_dual_it_dtor */ static void spl_dual_it_dtor(zend_object *_object) { @@ -2304,7 +2299,6 @@ static void spl_dual_it_free_storage(zend_object *_object) zval_ptr_dtor(&object->u.caching.zcache); } -#if HAVE_PCRE || HAVE_BUNDLED_PCRE if (object->dit_type == DIT_RegexIterator || object->dit_type == DIT_RecursiveRegexIterator) { if (object->u.regex.pce) { php_pcre_pce_decref(object->u.regex.pce); @@ -2313,7 +2307,6 @@ static void spl_dual_it_free_storage(zend_object *_object) zend_string_release_ex(object->u.regex.regex, 0); } } -#endif if (object->dit_type == DIT_CallbackFilterIterator || object->dit_type == DIT_RecursiveCallbackFilterIterator) { if (object->u.cbfilter) { @@ -2403,7 +2396,6 @@ static const zend_function_entry spl_funcs_ParentIterator[] = { PHP_FE_END }; -#if HAVE_PCRE || HAVE_BUNDLED_PCRE ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it___construct, 0, 0, 2) ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0) ZEND_ARG_INFO(0, regex) @@ -2452,7 +2444,6 @@ static const zend_function_entry spl_funcs_RecursiveRegexIterator[] = { SPL_ME(RecursiveRegexIterator, getChildren, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) PHP_FE_END }; -#endif static inline int spl_limit_it_valid(spl_dual_it_object *intern) { @@ -3741,7 +3732,6 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_IMPLEMENTS(RecursiveIteratorIterator, OuterIterator); REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator); -#if HAVE_PCRE || HAVE_BUNDLED_PCRE REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); @@ -3753,10 +3743,6 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0); REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator); REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator); -#else - spl_ce_RegexIterator = NULL; - spl_ce_RecursiveRegexIterator = NULL; -#endif REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator); REGISTER_SPL_ITERATOR(EmptyIterator); diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 4e314eb203..af2f815538 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -21,9 +21,7 @@ #include "php.h" #include "php_spl.h" -#if HAVE_PCRE || HAVE_BUNDLED_PCRE #include "ext/pcre/php_pcre.h" -#endif #define spl_ce_Traversable zend_ce_traversable #define spl_ce_Iterator zend_ce_iterator @@ -71,10 +69,8 @@ typedef enum { DIT_NoRewindIterator, DIT_InfiniteIterator, DIT_AppendIterator, -#if HAVE_PCRE || HAVE_BUNDLED_PCRE DIT_RegexIterator, DIT_RecursiveRegexIterator, -#endif DIT_CallbackFilterIterator, DIT_RecursiveCallbackFilterIterator, DIT_Unknown = ~0 @@ -150,7 +146,6 @@ typedef struct _spl_dual_it_object { zval zarrayit; zend_object_iterator *iterator; } append; -#if HAVE_PCRE || HAVE_BUNDLED_PCRE struct { zend_long flags; zend_long preg_flags; @@ -159,7 +154,6 @@ typedef struct _spl_dual_it_object { regex_mode mode; int use_flags; } regex; -#endif _spl_cbfilter_it_intern *cbfilter; } u; zend_object std; diff --git a/main/SAPI.c b/main/SAPI.c index 05b7bbbbec..a5a68f8c68 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -27,9 +27,7 @@ #include "php_ini.h" #include "ext/standard/php_string.h" #include "ext/standard/pageinfo.h" -#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) #include "ext/pcre/php_pcre.h" -#endif #ifdef ZTS #include "TSRM.h" #endif diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index c67b6ae0b5..3a194582c4 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -62,9 +62,7 @@ #include "ext/iconv/php_iconv.h" #endif #include "ext/standard/reg.h" -#if HAVE_PCRE || HAVE_BUNDLED_PCRE #include "ext/pcre/php_pcre.h" -#endif #if HAVE_UODBC #include "ext/odbc/php_odbc.h" #endif @@ -136,9 +134,7 @@ static zend_module_entry * const php_builtin_extensions[] = { #if HAVE_UODBC ,phpext_odbc_ptr #endif -#if HAVE_PCRE || HAVE_BUNDLED_PCRE ,phpext_pcre_ptr -#endif ,phpext_reflection_ptr #if HAVE_PHP_SESSION ,phpext_session_ptr -- 2.40.0