Skip to content

Commit 1979e2b

Browse files
committed
Add UNEXPECTED macro
1 parent 2d46c38 commit 1979e2b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/standard/string.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ PHP_FUNCTION(stristr)
17421742

17431743
found = php_stristr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(haystack), ZSTR_LEN(needle));
17441744

1745-
if (!found) {
1745+
if (UNEXPECTED(!found)) {
17461746
RETURN_FALSE;
17471747
}
17481748
found_offset = found - ZSTR_VAL(haystack);
@@ -1770,7 +1770,7 @@ PHP_FUNCTION(strstr)
17701770

17711771
found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
17721772

1773-
if (!found) {
1773+
if (UNEXPECTED(!found)) {
17741774
RETURN_FALSE;
17751775
}
17761776
found_offset = found - ZSTR_VAL(haystack);
@@ -1858,7 +1858,7 @@ PHP_FUNCTION(strpos)
18581858
ZSTR_VAL(needle), ZSTR_LEN(needle),
18591859
ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
18601860

1861-
if (!found) {
1861+
if (UNEXPECTED(!found)) {
18621862
RETURN_FALSE;
18631863
}
18641864
RETURN_LONG(found - ZSTR_VAL(haystack));
@@ -1890,7 +1890,7 @@ PHP_FUNCTION(stripos)
18901890
found = (char*)php_memnistr(ZSTR_VAL(haystack) + offset,
18911891
ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
18921892

1893-
if (!found) {
1893+
if (UNEXPECTED(!found)) {
18941894
RETURN_FALSE;
18951895
}
18961896
RETURN_LONG(found - ZSTR_VAL(haystack));
@@ -1935,7 +1935,7 @@ PHP_FUNCTION(strrpos)
19351935

19361936
found = zend_memnrstr(p, ZSTR_VAL(needle), ZSTR_LEN(needle), e);
19371937

1938-
if (!found) {
1938+
if (UNEXPECTED(!found)) {
19391939
RETURN_FALSE;
19401940
}
19411941
RETURN_LONG(found - ZSTR_VAL(haystack));
@@ -2037,7 +2037,7 @@ PHP_FUNCTION(strrchr)
20372037
ZEND_PARSE_PARAMETERS_END();
20382038

20392039
found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack));
2040-
if (!found) {
2040+
if (UNEXPECTED(!found)) {
20412041
RETURN_FALSE;
20422042
}
20432043
found_offset = found - ZSTR_VAL(haystack);

0 commit comments

Comments
 (0)