Skip to content

Commit 5ab594c

Browse files
committed
Optimize smart_str_append_scalar() for true/false
There is no point in having both cases together just to branch on them again to figure out what to print.
1 parent ccda8b1 commit 5ab594c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Zend/zend_smart_str.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,11 @@ ZEND_API void ZEND_FASTCALL smart_str_append_scalar(smart_str *dest, const zval
208208
break;
209209

210210
case IS_TRUE:
211+
smart_str_appendl(dest, "true", sizeof("true")-1);
212+
break;
213+
211214
case IS_FALSE:
212-
smart_str_appends(dest, Z_TYPE_P(value) == IS_TRUE ? "true" : "false");
215+
smart_str_appendl(dest, "false", sizeof("false")-1);
213216
break;
214217

215218
case IS_DOUBLE:

0 commit comments

Comments
 (0)