mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Eliminated redundand code
This commit is contained in:
parent
48cee6d1e9
commit
81dd6de3a9
@ -1019,7 +1019,6 @@ 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) {
|
||||
@ -1030,6 +1029,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, size_t sub
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
/* Execute the regular expression. */
|
||||
@ -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,7 +1507,6 @@ 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) {
|
||||
@ -1515,6 +1514,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* Execute the regular expression. */
|
||||
@ -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,7 +1754,6 @@ 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) {
|
||||
@ -1763,6 +1762,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
|
||||
mdata_used = old_mdata_used;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* Execute the regular expression. */
|
||||
@ -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,11 +2406,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get next piece if no limit or limit not yet reached and something matched*/
|
||||
while ((limit_val == -1 || limit_val > 1)) {
|
||||
@ -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,11 +2708,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go through the input array */
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user