Skip to content

Commit f0fa9c7

Browse files
zend_ast.c: use smart_str_appendc for appending single characters (#18703)
Slightly more performant
1 parent 0cdd3c3 commit f0fa9c7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Zend/zend_ast.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d
18711871
smart_str_appends(str, " {\n");
18721872
zend_ast_export_stmt(str, decl->child[2], indent + 1);
18731873
zend_ast_export_indent(str, indent);
1874-
smart_str_appends(str, "}");
1874+
smart_str_appendc(str, '}');
18751875
}
18761876

18771877
static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *ast, int indent) {
@@ -1899,7 +1899,7 @@ static ZEND_COLD void zend_ast_export_attributes(smart_str *str, zend_ast *ast,
18991899
for (i = 0; i < list->children; i++) {
19001900
smart_str_appends(str, "#[");
19011901
zend_ast_export_attribute_group(str, list->child[i], indent);
1902-
smart_str_appends(str, "]");
1902+
smart_str_appendc(str, ']');
19031903

19041904
if (newlines) {
19051905
smart_str_appendc(str, '\n');
@@ -2060,7 +2060,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
20602060
case ZEND_AST_OP_ARRAY:
20612061
smart_str_appends(str, "Closure(");
20622062
smart_str_append(str, zend_ast_get_op_array(ast)->op_array->function_name);
2063-
smart_str_appends(str, ")");
2063+
smart_str_appendc(str, ')');
20642064
break;
20652065
case ZEND_AST_CONSTANT_CLASS:
20662066
smart_str_appendl(str, "__CLASS__", sizeof("__CLASS__")-1);
@@ -2427,9 +2427,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
24272427
case ZEND_AST_CALL: {
24282428
zend_ast *left = ast->child[0];
24292429
if (left->kind == ZEND_AST_ARROW_FUNC || left->kind == ZEND_AST_CLOSURE) {
2430-
smart_str_appends(str, "(");
2430+
smart_str_appendc(str, '(');
24312431
zend_ast_export_ns_name(str, left, 0, indent);
2432-
smart_str_appends(str, ")");
2432+
smart_str_appendc(str, ')');
24332433
} else {
24342434
zend_ast_export_ns_name(str, left, 0, indent);
24352435
}
@@ -2679,9 +2679,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
26792679
smart_str_appends(str, " {\n");
26802680
zend_ast_export_ex(str, ast->child[1], 0, indent + 1);
26812681
zend_ast_export_indent(str, indent);
2682-
smart_str_appends(str, "}");
2682+
smart_str_appendc(str, '}');
26832683
} else {
2684-
smart_str_appends(str, ";");
2684+
smart_str_appendc(str, ';');
26852685
}
26862686
break;
26872687
case ZEND_AST_TRAIT_PRECEDENCE:

0 commit comments

Comments
 (0)