Skip to content

Commit 09d1026

Browse files
Branch prediction hints.
1 parent 3568c1b commit 09d1026

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ext/filter/filter.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ static unsigned int php_sapi_filter(int arg, const char *var, char **val, size_t
283283
zval *array_ptr = NULL, *orig_array_ptr = NULL;
284284
int retval = 0;
285285
int is_raw = (IF_G(default_filter) == FILTER_UNSAFE_RAW);
286-
size_t var_len = strlen(var);
287286

288287
assert(*val != NULL);
289288

@@ -314,15 +313,15 @@ static unsigned int php_sapi_filter(int arg, const char *var, char **val, size_t
314313
* to have the same (plain text) cookie name for the same path and we should not overwrite
315314
* more specific cookies with the less specific ones.
316315
*/
317-
if (arg == PARSE_COOKIE && orig_array_ptr &&
318-
zend_symtable_str_exists(Z_ARRVAL_P(orig_array_ptr), var, var_len)) {
316+
if (UNEXPECTED(arg == PARSE_COOKIE && orig_array_ptr &&
317+
zend_symtable_str_exists(Z_ARRVAL_P(orig_array_ptr), var, str_len(var)))) {
319318
return 0;
320319
}
321320

322321
/*
323322
* Fast path: if the default filter is UNSAFE_RAW, we can build a single zval, register it twice, and be done
324323
*/
325-
if (is_raw)
324+
if (EXPECTED(is_raw))
326325
{
327326
if (array_ptr || orig_array_ptr || retval)
328327
{

0 commit comments

Comments
 (0)