diff options
author | Jani Taskinen <jani@php.net> | 2007-10-05 15:00:09 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2007-10-05 15:00:09 +0000 |
commit | aa3eee1dce8c4391051a7f290057403e9c261bf4 (patch) | |
tree | 912a1cecd18ff15a953a394a686fccad26df404a | |
parent | 3a5817e972462ee051447af9c97b1c0611bad9b3 (diff) | |
download | php-git-aa3eee1dce8c4391051a7f290057403e9c261bf4.tar.gz |
MFH:- Moved the old regex functions to own extension: ereg
-rw-r--r-- | configure.in | 17 | ||||
-rw-r--r-- | ext/ereg/CREDITS | 2 | ||||
-rw-r--r-- | ext/ereg/config.w32 | 7 | ||||
-rw-r--r-- | ext/ereg/config0.m4 | 56 | ||||
-rw-r--r-- | ext/ereg/ereg.c (renamed from ext/standard/reg.c) | 168 | ||||
-rw-r--r-- | ext/ereg/php_ereg.h (renamed from ext/standard/reg.h) | 27 | ||||
-rw-r--r-- | ext/ereg/php_regex.h (renamed from main/php_regex.h) | 16 | ||||
-rw-r--r-- | ext/ereg/regex/COPYRIGHT (renamed from regex/COPYRIGHT) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/README (renamed from regex/README) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/WHATSNEW (renamed from regex/WHATSNEW) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/cclass.h (renamed from regex/cclass.h) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/cname.h (renamed from regex/cname.h) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/debug.c (renamed from regex/debug.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/debug.ih (renamed from regex/debug.ih) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/engine.c (renamed from regex/engine.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/engine.ih (renamed from regex/engine.ih) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/main.c (renamed from regex/main.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/main.ih (renamed from regex/main.ih) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/mkh (renamed from regex/mkh) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regcomp.c (renamed from regex/regcomp.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regcomp.ih (renamed from regex/regcomp.ih) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regerror.c (renamed from regex/regerror.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regerror.ih (renamed from regex/regerror.ih) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.3 (renamed from regex/regex.3) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.7 (renamed from regex/regex.7) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.dsp (renamed from regex/regex.dsp) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.dsw (renamed from regex/regex.dsw) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.h (renamed from regex/regex.h) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex.mak (renamed from regex/regex.mak) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regex2.h (renamed from regex/regex2.h) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regexec.c (renamed from regex/regexec.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/regfree.c (renamed from regex/regfree.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/split.c (renamed from regex/split.c) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/tests (renamed from regex/tests) | 0 | ||||
-rw-r--r-- | ext/ereg/regex/utils.h (renamed from regex/utils.h) | 2 | ||||
-rw-r--r-- | ext/ereg/tests/001.phpt (renamed from ext/standard/tests/reg/001.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/002.phpt (renamed from ext/standard/tests/reg/002.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/003.phpt (renamed from ext/standard/tests/reg/003.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/004.phpt (renamed from ext/standard/tests/reg/004.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/005.phpt (renamed from ext/standard/tests/reg/005.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/006.phpt (renamed from ext/standard/tests/reg/006.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/007.phpt (renamed from ext/standard/tests/reg/007.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/008.phpt (renamed from ext/standard/tests/reg/008.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/009.phpt (renamed from ext/standard/tests/reg/009.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/010.phpt (renamed from ext/standard/tests/reg/010.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/011.phpt (renamed from ext/standard/tests/reg/011.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/012.phpt (renamed from ext/standard/tests/reg/012.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/013.phpt (renamed from ext/standard/tests/reg/013.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/014.phpt (renamed from ext/standard/tests/reg/014.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/015.phpt (renamed from ext/standard/tests/reg/015.phpt) | 0 | ||||
-rw-r--r-- | ext/ereg/tests/016.phpt (renamed from ext/standard/tests/reg/016.phpt) | 0 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 1 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 62 | ||||
-rw-r--r-- | ext/standard/browscap.c | 2 | ||||
-rw-r--r-- | ext/standard/config.m4 | 48 | ||||
-rw-r--r-- | ext/standard/config.w32 | 2 | ||||
-rw-r--r-- | ext/standard/html.c | 1 | ||||
-rw-r--r-- | ext/standard/php_standard.h | 1 | ||||
-rw-r--r-- | ext/standard/string.c | 1 | ||||
-rw-r--r-- | main/php.h | 6 | ||||
-rw-r--r-- | regex/regex_extra.h | 23 | ||||
-rw-r--r-- | sapi/apache/php_apache_http.h | 2 | ||||
-rw-r--r-- | sapi/apache_hooks/php_apache_http.h | 2 | ||||
-rw-r--r-- | win32/build/config.w32 | 4 |
64 files changed, 228 insertions, 222 deletions
diff --git a/configure.in b/configure.in index 68d44dc9d0..e8251e86c4 100644 --- a/configure.in +++ b/configure.in @@ -11,9 +11,9 @@ dnl ## Diversion 2 is the initial checking of OS features, programs, dnl ## libraries and so on. dnl ## In diversion 3 we check for compile-time options to the PHP -dnl ## core and how to deal with different system dependencies. This -dnl ## includes what regex library is used and whether debugging or short -dnl ## tags are enabled, and the default behaviour of php.ini options. +dnl ## core and how to deal with different system dependencies. +dnl ## This includes whether debugging or short tags are enabled +dnl ## and the default behaviour of php.ini options. dnl ## This is also where an SAPI interface is selected (choosing between dnl ## Apache module, CGI etc.) @@ -270,10 +270,9 @@ fi divert(3) dnl ## In diversion 3 we check for compile-time options to the PHP -dnl ## core and how to deal with different system dependencies. This -dnl ## includes what regex library is used and whether debugging or short -dnl ## tags are enabled, and the default behaviour of php.ini options. - +dnl ## core and how to deal with different system dependencies. +dnl ## This includes whether debugging or short tags are enabled +dnl ## and the default behaviour of php.ini options. dnl Starting system checks. dnl ------------------------------------------------------------------------- @@ -518,7 +517,6 @@ putenv \ realpath \ random \ rand_r \ -regcomp \ res_search \ scandir \ setitimer \ @@ -1292,7 +1290,7 @@ esac PHP_SUBST(all_targets) PHP_SUBST(install_targets) -PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/ regex/]) +PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/]) PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c) @@ -1345,7 +1343,6 @@ fi PHP_ADD_SOURCES_X(Zend, zend_execute.c,,PHP_GLOBAL_OBJS,,$flag) PHP_ADD_BUILD_DIR(main main/streams) -PHP_ADD_BUILD_DIR(regex) PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI sapi/cli) PHP_ADD_BUILD_DIR(TSRM) PHP_ADD_BUILD_DIR(Zend) diff --git a/ext/ereg/CREDITS b/ext/ereg/CREDITS new file mode 100644 index 0000000000..9cd0ac2d1b --- /dev/null +++ b/ext/ereg/CREDITS @@ -0,0 +1,2 @@ +ereg +Rasmus Lerdorf, Jim Winstead, Jaakko Hyvätti diff --git a/ext/ereg/config.w32 b/ext/ereg/config.w32 new file mode 100644 index 0000000000..9a25368df0 --- /dev/null +++ b/ext/ereg/config.w32 @@ -0,0 +1,7 @@ +// $Id$ +// vim:ft=javascript + +EXTENSION("ereg", "ereg.c", false /* never shared */, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex"); +ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c regerror.c regfree.c", "ereg"); +AC_DEFINE('REGEX', 1, 'Bundled regex'); +AC_DEFINE('HSREGEX', 1, 'Bundled regex'); diff --git a/ext/ereg/config0.m4 b/ext/ereg/config0.m4 new file mode 100644 index 0000000000..f4f8190932 --- /dev/null +++ b/ext/ereg/config0.m4 @@ -0,0 +1,56 @@ +dnl $Id$ +dnl config.m4 for extension ereg + +dnl +dnl Check for regex library type +dnl +PHP_ARG_WITH(regex,, +[ --with-regex=TYPE regex library type: system, php. [TYPE=php] + WARNING: Do NOT use unless you know what you are doing!], php, no) + +case $PHP_REGEX in + system) + if test "$PHP_SAPI" = "apache" || test "$PHP_SAPI" = "apache2filter" || test "$PHP_SAPI" = "apache2handler"; then + REGEX_TYPE=php + else + REGEX_TYPE=system + fi + ;; + yes | php) + REGEX_TYPE=php + ;; + *) + REGEX_TYPE=php + AC_MSG_WARN([Invalid regex library type selected. Using default value: php]) + ;; +esac + +AC_MSG_CHECKING([which regex library to use]) +AC_MSG_RESULT([$REGEX_TYPE]) + +if test "$REGEX_TYPE" = "php"; then + ereg_regex_sources="regex/regcomp.c regex/regexec.c regex/regerror.c regex/regfree.c" + ereg_regex_headers="regex/" + PHP_EREG_CFLAGS="-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp" +fi + +PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS) +PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers]) + +if test "$REGEX_TYPE" = "php"; then + AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ]) + AC_DEFINE(HSREGEX,1,[ ]) + AC_DEFINE(REGEX,1,[ ]) + PHP_ADD_BUILD_DIR([$ext_builddir/regex], 1) + PHP_ADD_INCLUDE([$ext_srcdir/regex]) +elif test "$REGEX_TYPE" = "system"; then + AC_DEFINE(REGEX,0,[ ]) + dnl Check if field re_magic exists in struct regex_t + AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [ + AC_TRY_COMPILE([#include <sys/types.h> +#include <regex.h>], [regex_t rt; rt.re_magic;], + [ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])]) + if test "$ac_cv_regex_t_re_magic" = "yes"; then + AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1) + fi +fi diff --git a/ext/standard/reg.c b/ext/ereg/ereg.c index f47f8d48af..d21d1b0c78 100644 --- a/ext/standard/reg.c +++ b/ext/ereg/ereg.c @@ -22,18 +22,96 @@ #include <stdio.h> #include <ctype.h> #include "php.h" -#include "php_string.h" -#include "reg.h" +#include "ext/standard/php_string.h" +#include "php_ereg.h" #include "ext/standard/info.h" -ZEND_DECLARE_MODULE_GLOBALS(reg) +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ereg, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(1, registers) /* ARRAY_INFO(1, registers, 1) */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_eregi, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(1, registers) /* ARRAY_INFO(1, registers, 1) */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_ereg_replace, 0) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, replacement) + ZEND_ARG_INFO(0, string) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_eregi_replace, 0) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, replacement) + ZEND_ARG_INFO(0, string) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_split, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, limit) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_spliti, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(0, limit) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_sql_regcase, 0) + ZEND_ARG_INFO(0, string) +ZEND_END_ARG_INFO() +/* }}} */ + +/* {{{ Function table */ +const zend_function_entry ereg_functions[] = { + PHP_FE(ereg, arginfo_ereg) + PHP_FE(ereg_replace, arginfo_ereg_replace) + PHP_FE(eregi, arginfo_eregi) + PHP_FE(eregi_replace, arginfo_eregi_replace) + PHP_FE(split, arginfo_split) + PHP_FE(spliti, arginfo_spliti) + PHP_FE(sql_regcase, arginfo_sql_regcase) + {NULL, NULL, NULL} +}; +/* }}} */ +/* {{{ reg_cache */ typedef struct { regex_t preg; int cflags; } reg_cache; - static int reg_magic = 0; +/* }}} */ + +ZEND_DECLARE_MODULE_GLOBALS(ereg) + +/* {{{ Module entry */ +zend_module_entry ereg_module_entry = { + STANDARD_MODULE_HEADER, + "ereg", + ereg_functions, + PHP_MINIT(ereg), + PHP_MSHUTDOWN(ereg), + NULL, + NULL, + PHP_MINFO(ereg), + NO_VERSION_YET, + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ /* {{{ _php_regcomp */ @@ -44,7 +122,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) reg_cache *rc = NULL; TSRMLS_FETCH(); - if(zend_hash_find(®(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == SUCCESS + if(zend_hash_find(&EREG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == SUCCESS && rc->cflags == cflags) { #ifdef HAVE_REGEX_T_RE_MAGIC /* @@ -52,7 +130,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) * is, we flush it and compile the pattern from scratch. */ if (rc->preg.re_magic != reg_magic) { - zend_hash_clean(®(ht_rc)); + zend_hash_clean(&EREG(ht_rc)); } else { memcpy(preg, &rc->preg, sizeof(*preg)); return r; @@ -71,7 +149,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) * it's good. */ if (!reg_magic) reg_magic = preg->re_magic; - zend_hash_update(®(ht_rc), (char *) pattern, patlen+1, + zend_hash_update(&EREG(ht_rc), (char *) pattern, patlen+1, (void *) &rcp, sizeof(rcp), NULL); } #else @@ -83,7 +161,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) rcp.cflags = cflags; memcpy(&rcp.preg, preg, sizeof(*preg)); - zend_hash_update(®(ht_rc), (char *) pattern, patlen+1, + zend_hash_update(&EREG(ht_rc), (char *) pattern, patlen+1, (void *) &rcp, sizeof(rcp), NULL); } } @@ -92,7 +170,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) } /* }}} */ -static void _free_reg_cache(reg_cache *rc) +static void _free_ereg_cache(reg_cache *rc) { regfree(&rc->preg); } @@ -102,45 +180,47 @@ static void _free_reg_cache(reg_cache *rc) #undef regcomp #define regcomp(a, b, c) _php_regcomp(a, b, c) -static void php_reg_init_globals(zend_reg_globals *reg_globals TSRMLS_DC) +static void php_ereg_init_globals(zend_ereg_globals *ereg_globals TSRMLS_DC) { - zend_hash_init(®_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1); + zend_hash_init(&ereg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_ereg_cache, 1); } -static void php_reg_destroy_globals(zend_reg_globals *reg_globals TSRMLS_DC) +static void php_ereg_destroy_globals(zend_ereg_globals *ereg_globals TSRMLS_DC) { - zend_hash_destroy(®_globals->ht_rc); + zend_hash_destroy(&ereg_globals->ht_rc); } -PHP_MINIT_FUNCTION(regex) +PHP_MINIT_FUNCTION(ereg) { - ZEND_INIT_MODULE_GLOBALS(reg, php_reg_init_globals, php_reg_destroy_globals); + ZEND_INIT_MODULE_GLOBALS(ereg, php_ereg_init_globals, php_ereg_destroy_globals); return SUCCESS; } -PHP_MSHUTDOWN_FUNCTION(regex) +PHP_MSHUTDOWN_FUNCTION(ereg) { #ifndef ZTS - php_reg_destroy_globals(®_globals TSRMLS_CC); + php_ereg_destroy_globals(&ereg_globals TSRMLS_CC); #endif return SUCCESS; } -PHP_MINFO_FUNCTION(regex) +PHP_MINFO_FUNCTION(ereg) { + php_info_print_table_start(); #if HSREGEX php_info_print_table_row(2, "Regex Library", "Bundled library enabled"); #else php_info_print_table_row(2, "Regex Library", "System library enabled"); #endif + php_info_print_table_end(); } -/* {{{ php_reg_eprint - * php_reg_eprint - convert error number to name +/* {{{ php_ereg_eprint + * php_ereg_eprint - convert error number to name */ -static void php_reg_eprint(int err, regex_t *re) { +static void php_ereg_eprint(int err, regex_t *re) { char *buf = NULL, *message = NULL; size_t len; size_t buf_len; @@ -198,7 +278,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) int argc = ZEND_NUM_ARGS(); if (argc < 2 || argc > 3 || - zend_get_parameters_ex(argc, ®ex, &findin, &array) == FAILURE) { + zend_get_parameters_ex(argc, ®ex, &findin, &array) == FAILURE) { WRONG_PARAM_COUNT; } @@ -221,7 +301,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (err) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); RETURN_FALSE; } @@ -235,7 +315,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) /* actually execute the regular expression */ err = regexec(&re, string, re.re_nsub+1, subs, 0); if (err && err != REG_NOMATCH) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); regfree(&re); efree(subs); RETURN_FALSE; @@ -292,15 +372,15 @@ PHP_FUNCTION(eregi) } /* }}} */ -/* {{{ php_reg_replace +/* {{{ php_ereg_replace * this is the meat and potatoes of regex replacement! */ -PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended) +PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended) { regex_t re; regmatch_t *subs; char *buf, /* buf is where we build the replaced string */ - *nbuf, /* nbuf is used when we grow the buffer */ + *nbuf, /* nbuf is used when we grow the buffer */ *walkbuf; /* used to walk buf when replacing backrefs */ const char *walk; /* used to walk replacement string for backrefs */ int buf_len; @@ -318,7 +398,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha err = regcomp(&re, pattern, copts); if (err) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); return ((char *) -1); } @@ -337,7 +417,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha err = regexec(&re, &string[pos], re.re_nsub+1, subs, (pos ? REG_NOTBOL : 0)); if (err && err != REG_NOMATCH) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); efree(subs); efree(buf); regfree(&re); @@ -358,7 +438,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) { if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) { new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so; - } + } walk += 2; } else { new_l++; @@ -438,9 +518,9 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha } /* }}} */ -/* {{{ php_ereg_replace +/* {{{ php_do_ereg_replace */ -static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) +static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) { zval **arg_pattern, **arg_replace, @@ -451,7 +531,7 @@ static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) char *ret; if (ZEND_NUM_ARGS() != 3 || - zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) { + zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) { WRONG_PARAM_COUNT; } @@ -486,7 +566,7 @@ static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) string = STR_EMPTY_ALLOC(); /* do the actual work */ - ret = php_reg_replace(pattern, replace, string, icase, 1); + ret = php_ereg_replace(pattern, replace, string, icase, 1); if (ret == (char *) -1) { RETVAL_FALSE; } else { @@ -504,7 +584,7 @@ static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) Replace regular expression */ PHP_FUNCTION(ereg_replace) { - php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); + php_do_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ @@ -512,7 +592,7 @@ PHP_FUNCTION(ereg_replace) Case insensitive replace regular expression */ PHP_FUNCTION(eregi_replace) { - php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); + php_do_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ @@ -528,27 +608,27 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) int argc = ZEND_NUM_ARGS(); if (argc < 2 || argc > 3 || - zend_get_parameters_ex(argc, &spliton, &str, &arg_count) == FAILURE) { + zend_get_parameters_ex(argc, &spliton, &str, &arg_count) == FAILURE) { WRONG_PARAM_COUNT; } - + if (argc > 2) { convert_to_long_ex(arg_count); count = Z_LVAL_PP(arg_count); } - + if (icase) copts = REG_ICASE; - - convert_to_string_ex(spliton); - convert_to_string_ex(str); + + convert_to_string_ex(spliton); + convert_to_string_ex(str); strp = Z_STRVAL_PP(str); endp = strp + Z_STRLEN_PP(str); err = regcomp(&re, Z_STRVAL_PP(spliton), REG_EXTENDED | copts); if (err) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); RETURN_FALSE; } @@ -590,7 +670,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) /* see if we encountered an error */ if (err && err != REG_NOMATCH) { - php_reg_eprint(err, &re); + php_ereg_eprint(err, &re); regfree(&re); zend_hash_destroy(Z_ARRVAL_P(return_value)); efree(Z_ARRVAL_P(return_value)); diff --git a/ext/standard/reg.h b/ext/ereg/php_ereg.h index a577db8a96..19c7f426bf 100644 --- a/ext/standard/reg.h +++ b/ext/ereg/php_ereg.h @@ -19,10 +19,15 @@ /* $Id$ */ -#ifndef REG_H -#define REG_H +#ifndef EREG_H +#define EREG_H -PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended); +#include "php_regex.h" + +extern zend_module_entry ereg_module_entry; +#define phpext_ereg_ptr &ereg_module_entry + +PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended); PHP_FUNCTION(ereg); PHP_FUNCTION(eregi); @@ -32,19 +37,19 @@ PHP_FUNCTION(split); PHP_FUNCTION(spliti); PHPAPI PHP_FUNCTION(sql_regcase); -ZEND_BEGIN_MODULE_GLOBALS(reg) +ZEND_BEGIN_MODULE_GLOBALS(ereg) HashTable ht_rc; -ZEND_END_MODULE_GLOBALS(reg) - -PHP_MINIT_FUNCTION(regex); -PHP_MSHUTDOWN_FUNCTION(regex); -PHP_MINFO_FUNCTION(regex); +ZEND_END_MODULE_GLOBALS(ereg) +/* Module functions */ +PHP_MINIT_FUNCTION(ereg); +PHP_MSHUTDOWN_FUNCTION(ereg); +PHP_MINFO_FUNCTION(ereg); #ifdef ZTS -#define REG(v) TSRMG(reg_globals_id, zend_reg_globals *, v) +#define EREG(v) TSRMG(ereg_globals_id, zend_ereg_globals *, v) #else -#define REG(v) (reg_globals.v) +#define EREG(v) (ereg_globals.v) #endif #endif /* REG_H */ diff --git a/main/php_regex.h b/ext/ereg/php_regex.h index 3537d6ab87..8f6362dc5b 100644 --- a/main/php_regex.h +++ b/ext/ereg/php_regex.h @@ -27,15 +27,14 @@ * 1.. bundled regex */ -#if REGEX -/* get aliases */ -#include "regex/regex_extra.h" -#include "regex/regex.h" +#if (REGEX == 1) +/* Define aliases */ +#define regexec php_regexec +#define regerror php_regerror +#define regfree php_regfree +#define regcomp php_regcomp -/* get rid of aliases */ -#define PHP_NO_ALIASES -#include "regex/regex_extra.h" -#undef PHP_NO_ALIASES +#include "ext/ereg/regex/regex.h" #undef _PCREPOSIX_H #define _PCREPOSIX_H 1 @@ -55,6 +54,7 @@ #ifndef _H_REGEX #define _H_REGEX 1 /* This one is for AIX */ #endif + #elif REGEX == 0 #include <regex.h> #ifndef _REGEX_H_ diff --git a/regex/COPYRIGHT b/ext/ereg/regex/COPYRIGHT index d43362fbfc..d43362fbfc 100644 --- a/regex/COPYRIGHT +++ b/ext/ereg/regex/COPYRIGHT diff --git a/regex/README b/ext/ereg/regex/README index cea9b67b66..cea9b67b66 100644 --- a/regex/README +++ b/ext/ereg/regex/README diff --git a/regex/WHATSNEW b/ext/ereg/regex/WHATSNEW index 6e82e1dae0..6e82e1dae0 100644 --- a/regex/WHATSNEW +++ b/ext/ereg/regex/WHATSNEW diff --git a/regex/cclass.h b/ext/ereg/regex/cclass.h index df41694b04..df41694b04 100644 --- a/regex/cclass.h +++ b/ext/ereg/regex/cclass.h diff --git a/regex/cname.h b/ext/ereg/regex/cname.h index 670b273882..670b273882 100644 --- a/regex/cname.h +++ b/ext/ereg/regex/cname.h diff --git a/regex/debug.c b/ext/ereg/regex/debug.c index 3db93ef293..3db93ef293 100644 --- a/regex/debug.c +++ b/ext/ereg/regex/debug.c diff --git a/regex/debug.ih b/ext/ereg/regex/debug.ih index 5f40ff7917..5f40ff7917 100644 --- a/regex/debug.ih +++ b/ext/ereg/regex/debug.ih diff --git a/regex/engine.c b/ext/ereg/regex/engine.c index 0682267f61..0682267f61 100644 --- a/regex/engine.c +++ b/ext/ereg/regex/engine.c diff --git a/regex/engine.ih b/ext/ereg/regex/engine.ih index 9a301838bc..9a301838bc 100644 --- a/regex/engine.ih +++ b/ext/ereg/regex/engine.ih diff --git a/regex/main.c b/ext/ereg/regex/main.c index 657338a2c1..657338a2c1 100644 --- a/regex/main.c +++ b/ext/ereg/regex/main.c diff --git a/regex/main.ih b/ext/ereg/regex/main.ih index 5a0118ac44..5a0118ac44 100644 --- a/regex/main.ih +++ b/ext/ereg/regex/main.ih diff --git a/regex/mkh b/ext/ereg/regex/mkh index 252b246c7b..252b246c7b 100644 --- a/regex/mkh +++ b/ext/ereg/regex/mkh diff --git a/regex/regcomp.c b/ext/ereg/regex/regcomp.c index d72cc82940..d72cc82940 100644 --- a/regex/regcomp.c +++ b/ext/ereg/regex/regcomp.c diff --git a/regex/regcomp.ih b/ext/ereg/regex/regcomp.ih index c93d32e51d..c93d32e51d 100644 --- a/regex/regcomp.ih +++ b/ext/ereg/regex/regcomp.ih diff --git a/regex/regerror.c b/ext/ereg/regex/regerror.c index 6c8e064c4a..6c8e064c4a 100644 --- a/regex/regerror.c +++ b/ext/ereg/regex/regerror.c diff --git a/regex/regerror.ih b/ext/ereg/regex/regerror.ih index 2cb668c24f..2cb668c24f 100644 --- a/regex/regerror.ih +++ b/ext/ereg/regex/regerror.ih diff --git a/regex/regex.3 b/ext/ereg/regex/regex.3 index 100c8a7f71..100c8a7f71 100644 --- a/regex/regex.3 +++ b/ext/ereg/regex/regex.3 diff --git a/regex/regex.7 b/ext/ereg/regex/regex.7 index d89012bda1..d89012bda1 100644 --- a/regex/regex.7 +++ b/ext/ereg/regex/regex.7 diff --git a/regex/regex.dsp b/ext/ereg/regex/regex.dsp index e8f1ad4299..e8f1ad4299 100644 --- a/regex/regex.dsp +++ b/ext/ereg/regex/regex.dsp diff --git a/regex/regex.dsw b/ext/ereg/regex/regex.dsw index 7b7df8126c..7b7df8126c 100644 --- a/regex/regex.dsw +++ b/ext/ereg/regex/regex.dsw diff --git a/regex/regex.h b/ext/ereg/regex/regex.h index b39c5e178c..b39c5e178c 100644 --- a/regex/regex.h +++ b/ext/ereg/regex/regex.h diff --git a/regex/regex.mak b/ext/ereg/regex/regex.mak index b87ded340b..b87ded340b 100644 --- a/regex/regex.mak +++ b/ext/ereg/regex/regex.mak diff --git a/regex/regex2.h b/ext/ereg/regex/regex2.h index 4996f96ecd..4996f96ecd 100644 --- a/regex/regex2.h +++ b/ext/ereg/regex/regex2.h diff --git a/regex/regexec.c b/ext/ereg/regex/regexec.c index bbfe094c96..bbfe094c96 100644 --- a/regex/regexec.c +++ b/ext/ereg/regex/regexec.c diff --git a/regex/regfree.c b/ext/ereg/regex/regfree.c index 9fd618a13b..9fd618a13b 100644 --- a/regex/regfree.c +++ b/ext/ereg/regex/regfree.c diff --git a/regex/split.c b/ext/ereg/regex/split.c index 188bdb775b..188bdb775b 100644 --- a/regex/split.c +++ b/ext/ereg/regex/split.c diff --git a/regex/tests b/ext/ereg/regex/tests index c05846177f..c05846177f 100644 --- a/regex/tests +++ b/ext/ereg/regex/tests diff --git a/regex/utils.h b/ext/ereg/regex/utils.h index cd4a96025f..66ae78437e 100644 --- a/regex/utils.h +++ b/ext/ereg/regex/utils.h @@ -1,7 +1,5 @@ /* utility definitions */ -#include "regex_extra.h" - #ifdef _POSIX2_RE_DUP_MAX #define DUPMAX _POSIX2_RE_DUP_MAX #else diff --git a/ext/standard/tests/reg/001.phpt b/ext/ereg/tests/001.phpt index 13c50d0d1e..13c50d0d1e 100644 --- a/ext/standard/tests/reg/001.phpt +++ b/ext/ereg/tests/001.phpt diff --git a/ext/standard/tests/reg/002.phpt b/ext/ereg/tests/002.phpt index abe9e063d8..abe9e063d8 100644 --- a/ext/standard/tests/reg/002.phpt +++ b/ext/ereg/tests/002.phpt diff --git a/ext/standard/tests/reg/003.phpt b/ext/ereg/tests/003.phpt index 4257f0d27e..4257f0d27e 100644 --- a/ext/standard/tests/reg/003.phpt +++ b/ext/ereg/tests/003.phpt diff --git a/ext/standard/tests/reg/004.phpt b/ext/ereg/tests/004.phpt index 3e535c6a9d..3e535c6a9d 100644 --- a/ext/standard/tests/reg/004.phpt +++ b/ext/ereg/tests/004.phpt diff --git a/ext/standard/tests/reg/005.phpt b/ext/ereg/tests/005.phpt index ee9ccc6da4..ee9ccc6da4 100644 --- a/ext/standard/tests/reg/005.phpt +++ b/ext/ereg/tests/005.phpt diff --git a/ext/standard/tests/reg/006.phpt b/ext/ereg/tests/006.phpt index cae349672e..cae349672e 100644 --- a/ext/standard/tests/reg/006.phpt +++ b/ext/ereg/tests/006.phpt diff --git a/ext/standard/tests/reg/007.phpt b/ext/ereg/tests/007.phpt index beb3cdc159..beb3cdc159 100644 --- a/ext/standard/tests/reg/007.phpt +++ b/ext/ereg/tests/007.phpt diff --git a/ext/standard/tests/reg/008.phpt b/ext/ereg/tests/008.phpt index 9a0cedabc5..9a0cedabc5 100644 --- a/ext/standard/tests/reg/008.phpt +++ b/ext/ereg/tests/008.phpt diff --git a/ext/standard/tests/reg/009.phpt b/ext/ereg/tests/009.phpt index 528606f3c8..528606f3c8 100644 --- a/ext/standard/tests/reg/009.phpt +++ b/ext/ereg/tests/009.phpt diff --git a/ext/standard/tests/reg/010.phpt b/ext/ereg/tests/010.phpt index f6f8909f73..f6f8909f73 100644 --- a/ext/standard/tests/reg/010.phpt +++ b/ext/ereg/tests/010.phpt diff --git a/ext/standard/tests/reg/011.phpt b/ext/ereg/tests/011.phpt index 65554b302f..65554b302f 100644 --- a/ext/standard/tests/reg/011.phpt +++ b/ext/ereg/tests/011.phpt diff --git a/ext/standard/tests/reg/012.phpt b/ext/ereg/tests/012.phpt index 88ad5992ad..88ad5992ad 100644 --- a/ext/standard/tests/reg/012.phpt +++ b/ext/ereg/tests/012.phpt diff --git a/ext/standard/tests/reg/013.phpt b/ext/ereg/tests/013.phpt index a2d9ee0099..a2d9ee0099 100644 --- a/ext/standard/tests/reg/013.phpt +++ b/ext/ereg/tests/013.phpt diff --git a/ext/standard/tests/reg/014.phpt b/ext/ereg/tests/014.phpt index d2a32451a9..d2a32451a9 100644 --- a/ext/standard/tests/reg/014.phpt +++ b/ext/ereg/tests/014.phpt diff --git a/ext/standard/tests/reg/015.phpt b/ext/ereg/tests/015.phpt index c255ddf05b..c255ddf05b 100644 --- a/ext/standard/tests/reg/015.phpt +++ b/ext/ereg/tests/015.phpt diff --git a/ext/standard/tests/reg/016.phpt b/ext/ereg/tests/016.phpt index c354ab26fc..c354ab26fc 100644 --- a/ext/standard/tests/reg/016.phpt +++ b/ext/ereg/tests/016.phpt diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 92ceec2683..4a405471a7 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -36,6 +36,7 @@ #include "php_ini.h" #include "ext/standard/php_standard.h" #include "ext/standard/php_smart_str.h" +#include "ext/ereg/php_regex.h" #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 588af8b595..6119e74fb8 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2203,54 +2203,6 @@ static ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ reg.c */ -static -ZEND_BEGIN_ARG_INFO_EX(arginfo_ereg, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(1, registers) /* ARRAY_INFO(1, registers, 1) */ -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO_EX(arginfo_eregi, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(1, registers) /* ARRAY_INFO(1, registers, 1) */ -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO(arginfo_ereg_replace, 0) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, replacement) - ZEND_ARG_INFO(0, string) -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO(arginfo_eregi_replace, 0) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, replacement) - ZEND_ARG_INFO(0, string) -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO_EX(arginfo_split, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, limit) -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO_EX(arginfo_spliti, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, limit) -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO(arginfo_sql_regcase, 0) - ZEND_ARG_INFO(0, string) -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ sha1.c */ static ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1) @@ -3202,6 +3154,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(similar_text, arginfo_similar_text) PHP_FE(explode, arginfo_explode) PHP_FE(implode, arginfo_implode) + PHP_FALIAS(join, implode, arginfo_implode) PHP_FE(setlocale, arginfo_setlocale) PHP_FE(localeconv, arginfo_localeconv) @@ -3478,16 +3431,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(is_scalar, arginfo_is_scalar) PHP_FE(is_callable, arginfo_is_callable) - /* functions from reg.c */ - PHP_FE(ereg, arginfo_ereg) - PHP_FE(ereg_replace, arginfo_ereg_replace) - PHP_FE(eregi, arginfo_eregi) - PHP_FE(eregi_replace, arginfo_eregi_replace) - PHP_FE(split, arginfo_split) - PHP_FE(spliti, arginfo_spliti) - PHP_FALIAS(join, implode, arginfo_implode) - PHP_FE(sql_regcase, arginfo_sql_regcase) - /* functions from dl.c */ PHP_FE(dl, arginfo_dl) @@ -4043,7 +3986,6 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ register_html_constants(INIT_FUNC_ARGS_PASSTHRU); register_string_constants(INIT_FUNC_ARGS_PASSTHRU); - PHP_MINIT(regex)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(file)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(pack)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(browscap)(INIT_FUNC_ARGS_PASSTHRU); @@ -4121,7 +4063,6 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */ UNREGISTER_INI_ENTRIES(); - PHP_MSHUTDOWN(regex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); @@ -4234,7 +4175,6 @@ PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */ PHP_MINFO_FUNCTION(basic) /* {{{ */ { php_info_print_table_start(); - PHP_MINFO(regex)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); PHP_MINFO(dl)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); PHP_MINFO(mail)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); php_info_print_table_end(); diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 9737007974..96f4d95bf1 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -19,7 +19,7 @@ /* $Id$ */ #include "php.h" -#include "php_regex.h" +#include "ext/ereg/php_regex.h" #include "php_browscap.h" #include "php_ini.h" #include "php_string.h" diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 11c3ee3191..462ac15dd9 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -208,52 +208,6 @@ AC_FUNC_FNMATCH divert(5)dnl dnl -dnl Check for regex library type -dnl -PHP_ARG_WITH(regex,, -[ --with-regex=TYPE regex library type: system, apache, php. [TYPE=php] - WARNING: Do NOT use unless you know what you are doing!], php, no) - -case $PHP_REGEX in - system) - if test "$PHP_SAPI" = "apache" || test "$PHP_SAPI" = "apache2filter" || test "$PHP_SAPI" = "apache2handler"; then - REGEX_TYPE=php - else - REGEX_TYPE=system - fi - ;; - apache) - REGEX_TYPE=apache - ;; - php) - REGEX_TYPE=php - ;; - *) - REGEX_TYPE=php - AC_MSG_WARN(Invalid regex library type selected. Using default value: php) - ;; -esac - -if test "$REGEX_TYPE" = "php"; then - AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ]) - AC_DEFINE(HSREGEX,1,[ ]) - AC_DEFINE(REGEX,1,[ ]) - PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c) -elif test "$REGEX_TYPE" = "system"; then - AC_DEFINE(REGEX,0,[ ]) - dnl Check if field re_magic exists in struct regex_t - AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [ - AC_TRY_COMPILE([#include <sys/types.h> -#include <regex.h>], [regex_t rt; rt.re_magic;], - [ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])]) - if test "$ac_cv_regex_t_re_magic" = "yes"; then - AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1) - fi -fi -AC_MSG_CHECKING([which regex library to use]) -AC_MSG_RESULT([$REGEX_TYPE]) - -dnl dnl round fuzz dnl AC_MSG_CHECKING([whether rounding works as expected]) @@ -502,7 +456,7 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32. flock_compat.c formatted_print.c fsock.c head.c html.c image.c \ info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \ microtime.c pack.c pageinfo.c quot_print.c rand.c \ - reg.c soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \ + soundex.c string.c scanf.c syslog.c type.c uniqid.c url.c \ url_scanner.c var.c versioning.c assert.c strnatcmp.c levenshtein.c \ incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \ http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \ diff --git a/ext/standard/config.w32 b/ext/standard/config.w32 index bbfde2c88c..81352ea5e3 100644 --- a/ext/standard/config.w32 +++ b/ext/standard/config.w32 @@ -10,7 +10,7 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \ crc32.c crypt.c cyr_convert.c datetime.c dir.c dl.c dns.c exec.c \ file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \ info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c microtime.c \ - pack.c pageinfo.c quot_print.c rand.c reg.c soundex.c \ + pack.c pageinfo.c quot_print.c rand.c soundex.c \ string.c scanf.c syslog.c type.c uniqid.c url.c url_scanner.c var.c \ versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \ url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \ diff --git a/ext/standard/html.c b/ext/standard/html.c index 0160cef571..dbacf6bb13 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -37,7 +37,6 @@ #else #include <php_config.h> #endif -#include "reg.h" #include "html.h" #include "php_string.h" #include "SAPI.h" diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h index 2ad546b128..9474eb32e8 100644 --- a/ext/standard/php_standard.h +++ b/ext/standard/php_standard.h @@ -24,7 +24,6 @@ #include "base64.h" #include "php_dir.h" #include "dns.h" -#include "reg.h" #include "php_mail.h" #include "md5.h" #include "sha1.h" diff --git a/ext/standard/string.c b/ext/standard/string.c index bb9fc79b5e..45c36d5c0c 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -24,7 +24,6 @@ #include <stdio.h> #include "php.h" -#include "reg.h" #include "php_rand.h" #include "php_string.h" #include "php_variables.h" diff --git a/main/php.h b/main/php.h index c8da102584..f56fc17613 100644 --- a/main/php.h +++ b/main/php.h @@ -71,8 +71,6 @@ #define PHP_OS PHP_UNAME #endif -#include "php_regex.h" - #if HAVE_ASSERT_H #if PHP_DEBUG #undef NDEBUG @@ -193,10 +191,6 @@ typedef unsigned int socklen_t; char *strerror(int); #endif -#if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H) -#include "regex/regex_extra.h" -#endif - #if HAVE_PWD_H # ifdef PHP_WIN32 #include "win32/param.h" diff --git a/regex/regex_extra.h b/regex/regex_extra.h deleted file mode 100644 index d668f7613f..0000000000 --- a/regex/regex_extra.h +++ /dev/null @@ -1,23 +0,0 @@ -/* do not frame this - we must be able to include this file multiple times */ - -#undef regexec -#undef regerror -#undef regfree -#undef regcomp - -#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX)) - -#ifndef PHP_WIN32 - -#ifndef PHP_NO_ALIASES - -#define regexec php_regexec -#define regerror php_regerror -#define regfree php_regfree -#define regcomp php_regcomp - -#endif - -#endif - -#endif diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h index 8f144090a9..b6cb50e284 100644 --- a/sapi/apache/php_apache_http.h +++ b/sapi/apache/php_apache_http.h @@ -31,7 +31,7 @@ #endif #include "zend.h" -#include "php_regex.h" +#include "ext/ereg/php_regex.h" #include "php_compat.h" #ifdef HAVE_OPENSSL_EXT diff --git a/sapi/apache_hooks/php_apache_http.h b/sapi/apache_hooks/php_apache_http.h index 2a030482f6..23cf7fea69 100644 --- a/sapi/apache_hooks/php_apache_http.h +++ b/sapi/apache_hooks/php_apache_http.h @@ -11,7 +11,7 @@ #include "zend.h" #include "zend_stack.h" -#include "php_regex.h" +#include "ext/ereg/php_regex.h" #include "httpd.h" #include "http_config.h" diff --git a/win32/build/config.w32 b/win32/build/config.w32 index ce23f2eb7b..b71a70faec 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -99,7 +99,7 @@ if (PHP_PREFIX == '') { } DEFINE('PHP_PREFIX', PHP_PREFIX); -DEFINE("BASE_INCLUDES", "/I . /I main /I regex /I Zend /I TSRM /I ext "); +DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext "); // CFLAGS for building the PHP dll DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \ @@ -312,8 +312,6 @@ ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c ADD_SOURCES("win32", "crypt_win32.c glob.c md5crypt.c readdir.c \ registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c globals.c"); -ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c"); - STDOUT.WriteBlankLines(1); /* Can we build with IPv6 support? */ |