com php-src: Eliminated redundand code: ext/pcre/php_pcre.c
| From: | Dmitry Stogov | Date: | Mon, 13 Nov 2017 22:43:54 +0000 |
| Subject: | com php-src: Eliminated redundand code: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100216@lists.php.net to get a copy of this message | ||
Commit: 81dd6de3a9ae4ddd5a7652258301b67d175986f7
Author: Dmitry Stogov <dmitry@zend.com> Tue, 14 Nov 2017 01:43:54 +0300
Parents: 48cee6d1e9b6b0ddb1ab6b63cdde528384469d62
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=81dd6de3a9ae4ddd5a7652258301b67d175986f7
Log:
Eliminated redundand code
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index ffde13e..1da619a 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1019,16 +1019,16 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, size_t
sub
match_data = mdata;
} else {
match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
- }
- if (!match_data) {
- PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
- if (subpat_names) {
- efree(subpat_names);
- }
- if (match_sets) {
- efree(match_sets);
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ if (subpat_names) {
+ efree(subpat_names);
+ }
+ if (match_sets) {
+ efree(match_sets);
+ }
+ RETURN_FALSE;
}
- RETURN_FALSE;
}
do {
@@ -1041,7 +1041,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, size_t
sub
break;
}
count = pcre2_jit_match(pce->re, subject, subject_len, start_offset2,
- no_utf_check|g_notempty, match_data, mctx);
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
count = pcre2_match(pce->re, subject, subject_len, start_offset2,
@@ -1507,13 +1507,13 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string
*su
match_data = mdata;
} else {
match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
- }
- if (!match_data) {
- PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
- if (subpat_names) {
- efree(subpat_names);
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ if (subpat_names) {
+ efree(subpat_names);
+ }
+ return NULL;
}
- return NULL;
}
while (1) {
@@ -1522,7 +1522,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string
*su
if (PCRE_G(jit) && (pce->preg_options & PREG_JIT)
&& no_utf_check && !g_notempty) {
count = pcre2_jit_match(pce->re, subject, subject_len, start_offset,
- no_utf_check|g_notempty, match_data, mctx);
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
count = pcre2_match(pce->re, subject, subject_len, start_offset,
@@ -1754,14 +1754,14 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce,
zend_strin
match_data = mdata;
} else {
match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
- }
- if (!match_data) {
- PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
- if (subpat_names) {
- efree(subpat_names);
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ if (subpat_names) {
+ efree(subpat_names);
+ }
+ mdata_used = old_mdata_used;
+ return NULL;
}
- mdata_used = old_mdata_used;
- return NULL;
}
while (1) {
@@ -1770,7 +1770,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce,
zend_strin
if (PCRE_G(jit) && (pce->preg_options & PREG_JIT)
&& no_utf_check && !g_notempty) {
count = pcre2_jit_match(pce->re, subject, subject_len, start_offset,
- no_utf_check|g_notempty, match_data, mctx);
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
count = pcre2_match(pce->re, subject, subject_len, start_offset,
@@ -2406,10 +2406,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, zend_string
*subject_str,
match_data = mdata;
} else {
match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
- }
- if (!match_data) {
- PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
- return;
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ return;
+ }
}
/* Get next piece if no limit or limit not yet reached and something matched*/
@@ -2418,7 +2418,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, zend_string
*subject_str,
if (PCRE_G(jit) && (pce->preg_options & PREG_JIT)
&& no_utf_check && !g_notempty) {
count = pcre2_jit_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), start_offset,
- no_utf_check|g_notempty, match_data, mctx);
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
count = pcre2_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), start_offset,
@@ -2708,10 +2708,10 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval
*return
match_data = mdata;
} else {
match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
- }
- if (!match_data) {
- PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
- return;
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ return;
+ }
}
/* Go through the input array */
@@ -2724,7 +2724,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval
*return
if (PCRE_G(jit) && (pce->preg_options && PREG_JIT)
&& no_utf_check) {
count = pcre2_jit_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), 0,
- no_utf_check, match_data, mctx);
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
count = pcre2_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), 0,