1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

zend_ast.c: use smart_str_appendc for appending single characters (#18703)

Slightly more performant
This commit is contained in:
DanielEScherzer
2025-05-29 11:11:00 -07:00
committed by GitHub
parent 0cdd3c32de
commit f0fa9c748a

View File

@@ -1871,7 +1871,7 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d
smart_str_appends(str, " {\n");
zend_ast_export_stmt(str, decl->child[2], indent + 1);
zend_ast_export_indent(str, indent);
smart_str_appends(str, "}");
smart_str_appendc(str, '}');
}
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,
for (i = 0; i < list->children; i++) {
smart_str_appends(str, "#[");
zend_ast_export_attribute_group(str, list->child[i], indent);
smart_str_appends(str, "]");
smart_str_appendc(str, ']');
if (newlines) {
smart_str_appendc(str, '\n');
@@ -2060,7 +2060,7 @@ tail_call:
case ZEND_AST_OP_ARRAY:
smart_str_appends(str, "Closure(");
smart_str_append(str, zend_ast_get_op_array(ast)->op_array->function_name);
smart_str_appends(str, ")");
smart_str_appendc(str, ')');
break;
case ZEND_AST_CONSTANT_CLASS:
smart_str_appendl(str, "__CLASS__", sizeof("__CLASS__")-1);
@@ -2427,9 +2427,9 @@ simple_list:
case ZEND_AST_CALL: {
zend_ast *left = ast->child[0];
if (left->kind == ZEND_AST_ARROW_FUNC || left->kind == ZEND_AST_CLOSURE) {
smart_str_appends(str, "(");
smart_str_appendc(str, '(');
zend_ast_export_ns_name(str, left, 0, indent);
smart_str_appends(str, ")");
smart_str_appendc(str, ')');
} else {
zend_ast_export_ns_name(str, left, 0, indent);
}
@@ -2679,9 +2679,9 @@ simple_list:
smart_str_appends(str, " {\n");
zend_ast_export_ex(str, ast->child[1], 0, indent + 1);
zend_ast_export_indent(str, indent);
smart_str_appends(str, "}");
smart_str_appendc(str, '}');
} else {
smart_str_appends(str, ";");
smart_str_appendc(str, ';');
}
break;
case ZEND_AST_TRAIT_PRECEDENCE: