[core] remove excess counts from print config
remove excess counts from print config simplify double-quoted string printingpersonal/stbuehler/tests-path
parent
0329e765a3
commit
942c2f6722
|
@ -625,11 +625,6 @@ int array_print(const array * const a, int depth) {
|
|||
array_print_indent(depth + 1);
|
||||
if (!buffer_is_empty(&du->key)) {
|
||||
int j;
|
||||
|
||||
if (i && (i % 5) == 0) {
|
||||
fprintf(stdout, "# %u\n", i);
|
||||
array_print_indent(depth + 1);
|
||||
}
|
||||
fprintf(stdout, "\"%s\"", du->key.ptr);
|
||||
for (j = maxlen - buffer_string_length(&du->key); j > 0; j--) {
|
||||
fprintf(stdout, " ");
|
||||
|
@ -639,10 +634,6 @@ int array_print(const array * const a, int depth) {
|
|||
du->fn->print(du, depth + 1);
|
||||
fprintf(stdout, ",\n");
|
||||
}
|
||||
if (!(i && (i - 1 % 5) == 0)) {
|
||||
array_print_indent(depth + 1);
|
||||
fprintf(stdout, "# %u\n", i);
|
||||
}
|
||||
array_print_indent(depth);
|
||||
fprintf(stdout, ")");
|
||||
|
||||
|
|
|
@ -44,24 +44,16 @@ static int data_string_insert_dup(data_unset *dst, data_unset *src) {
|
|||
__attribute_cold__
|
||||
static void data_string_print(const data_unset *d, int depth) {
|
||||
data_string *ds = (data_string *)d;
|
||||
size_t i, len;
|
||||
UNUSED(depth);
|
||||
|
||||
/* empty and uninitialized strings */
|
||||
if (buffer_string_is_empty(&ds->value)) {
|
||||
fputs("\"\"", stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
/* print out the string as is, except prepend " with backslash */
|
||||
putc('"', stdout);
|
||||
len = buffer_string_length(&ds->value);
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned char c = ds->value.ptr[i];
|
||||
if (c == '"') {
|
||||
fputs("\\\"", stdout);
|
||||
} else {
|
||||
putc(c, stdout);
|
||||
const char *p = ds->value.ptr;
|
||||
if (p) {
|
||||
for (; *p; ++p) {
|
||||
if (*p == '"')
|
||||
putc('\\', stdout);
|
||||
putc(*p, stdout);
|
||||
}
|
||||
}
|
||||
putc('"', stdout);
|
||||
|
|
Loading…
Reference in New Issue