Skip to content

Commit 9857f5d

Browse files
committed
use smart_str_append_literal() if appending a literal
1 parent 82278c7 commit 9857f5d

37 files changed

Lines changed: 504 additions & 503 deletions

Zend/zend.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static void print_hash(smart_str *buf, HashTable *ht, int indent, bool is_object
389389
for (i = 0; i < indent; i++) {
390390
smart_str_appendc(buf, ' ');
391391
}
392-
smart_str_appends(buf, "(\n");
392+
smart_str_append_literal(buf, "(\n");
393393
indent += PRINT_ZVAL_INDENT;
394394
ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
395395
for (i = 0; i < indent; i++) {
@@ -405,11 +405,11 @@ static void print_hash(smart_str *buf, HashTable *ht, int indent, bool is_object
405405
smart_str_appendl(buf, prop_name, prop_len);
406406
if (class_name && mangled == SUCCESS) {
407407
if (class_name[0] == '*') {
408-
smart_str_appends(buf, ":protected");
408+
smart_str_append_literal(buf, ":protected");
409409
} else {
410410
smart_str_appendc(buf, ':');
411411
smart_str_appends(buf, class_name);
412-
smart_str_appends(buf, ":private");
412+
smart_str_append_literal(buf, ":private");
413413
}
414414
}
415415
} else {
@@ -418,15 +418,15 @@ static void print_hash(smart_str *buf, HashTable *ht, int indent, bool is_object
418418
} else {
419419
smart_str_append_long(buf, num_key);
420420
}
421-
smart_str_appends(buf, "] => ");
421+
smart_str_append_literal(buf, "] => ");
422422
zend_print_zval_r_to_buf(buf, tmp, indent+PRINT_ZVAL_INDENT);
423-
smart_str_appends(buf, "\n");
423+
smart_str_append_literal(buf, "\n");
424424
} ZEND_HASH_FOREACH_END();
425425
indent -= PRINT_ZVAL_INDENT;
426426
for (i = 0; i < indent; i++) {
427427
smart_str_appendc(buf, ' ');
428428
}
429-
smart_str_appends(buf, ")\n");
429+
smart_str_append_literal(buf, ")\n");
430430
}
431431
/* }}} */
432432

@@ -447,7 +447,7 @@ static void print_flat_hash(smart_str *buf, HashTable *ht) /* {{{ */
447447
} else {
448448
smart_str_append_unsigned(buf, num_key);
449449
}
450-
smart_str_appends(buf, "] => ");
450+
smart_str_append_literal(buf, "] => ");
451451
zend_print_flat_zval_r_to_buf(buf, tmp);
452452
} ZEND_HASH_FOREACH_END();
453453
}
@@ -483,10 +483,10 @@ void zend_print_flat_zval_r_to_buf(smart_str *buf, zval *expr) /* {{{ */
483483
{
484484
switch (Z_TYPE_P(expr)) {
485485
case IS_ARRAY:
486-
smart_str_appends(buf, "Array (");
486+
smart_str_append_literal(buf, "Array (");
487487
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
488488
if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
489-
smart_str_appends(buf, " *RECURSION*");
489+
smart_str_append_literal(buf, " *RECURSION*");
490490
return;
491491
}
492492
GC_PROTECT_RECURSION(Z_ARRVAL_P(expr));
@@ -500,11 +500,11 @@ void zend_print_flat_zval_r_to_buf(smart_str *buf, zval *expr) /* {{{ */
500500
HashTable *properties;
501501
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
502502
smart_str_append(buf, class_name);
503-
smart_str_appends(buf, " Object (");
503+
smart_str_append_literal(buf, " Object (");
504504
zend_string_release_ex(class_name, 0);
505505

506506
if (GC_IS_RECURSIVE(Z_COUNTED_P(expr))) {
507-
smart_str_appends(buf, " *RECURSION*");
507+
smart_str_append_literal(buf, " *RECURSION*");
508508
return;
509509
}
510510

@@ -547,10 +547,10 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
547547
{
548548
switch (Z_TYPE_P(expr)) {
549549
case IS_ARRAY:
550-
smart_str_appends(buf, "Array\n");
550+
smart_str_append_literal(buf, "Array\n");
551551
if (!(GC_FLAGS(Z_ARRVAL_P(expr)) & GC_IMMUTABLE)) {
552552
if (GC_IS_RECURSIVE(Z_ARRVAL_P(expr))) {
553-
smart_str_appends(buf, " *RECURSION*");
553+
smart_str_append_literal(buf, " *RECURSION*");
554554
return;
555555
}
556556
GC_PROTECT_RECURSION(Z_ARRVAL_P(expr));
@@ -569,9 +569,9 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
569569
zend_string_release_ex(class_name, 0);
570570

571571
if (!(zobj->ce->ce_flags & ZEND_ACC_ENUM)) {
572-
smart_str_appends(buf, " Object\n");
572+
smart_str_append_literal(buf, " Object\n");
573573
} else {
574-
smart_str_appends(buf, " Enum");
574+
smart_str_append_literal(buf, " Enum");
575575
if (zobj->ce->enum_backing_type != IS_UNDEF) {
576576
smart_str_appendc(buf, ':');
577577
smart_str_appends(buf, zend_get_type_by_const(zobj->ce->enum_backing_type));
@@ -580,7 +580,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
580580
}
581581

582582
if (ZEND_GUARD_OR_GC_IS_RECURSIVE(guard, DEBUG, zobj)) {
583-
smart_str_appends(buf, " *RECURSION*");
583+
smart_str_append_literal(buf, " *RECURSION*");
584584
return;
585585
}
586586

0 commit comments

Comments
 (0)