From 9300a5076d6f8e7bd5eef627d2ad35323211595d Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+ndossche@users.noreply.github.com> Date: Sun, 2 Nov 2025 15:07:15 +0100 Subject: [PATCH] Reduce code size of strripos() (#20358) Reduction of 1325 -> 1213 on x86-64 with GCC 15.2.1. --- ext/standard/string.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 386b3ec0f1f..6fb39c5a6bd 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2109,13 +2109,11 @@ PHP_FUNCTION(strripos) needle_dup = zend_string_tolower(needle); if ((found = (char *)zend_memnrstr(p, ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), e))) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); - zend_string_release_ex(needle_dup, 0); - zend_string_release_ex(haystack_dup, 0); } else { - zend_string_release_ex(needle_dup, 0); - zend_string_release_ex(haystack_dup, 0); - RETURN_FALSE; + RETVAL_FALSE; } + zend_string_release_ex(needle_dup, false); + zend_string_release_ex(haystack_dup, false); } /* }}} */