Skip to content

Commit

Permalink
Update print.h
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Apr 5, 2020
1 parent 7f75df4 commit a672b67
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/xml/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ xml_print_ex(FILE * __restrict ostream,
int opt) {
const xml_t *parent;
const xml_attr_t *a;
int pad, i;
int pad, i, snode;

pad = 0;
pad = snode = 0;
parent = NULL;

while (xml) {
if (opt > 0 && xml->type == XML_ELEMENT) {
if (!snode && opt > 0 && xml->type == XML_ELEMENT) {
for (i = 0; i < pad; i++)
fprintf(ostream, "\t");
}

snode = 0;
switch (xml->type) {
case XML_ELEMENT: {
if (!xml->prefix)
Expand Down Expand Up @@ -100,6 +101,7 @@ xml_print_ex(FILE * __restrict ostream,
}
case XML_STRING:
fprintf(ostream, "%.*s", xml->valsize, xml->val);
snode = 1;
break;
default:
break;
Expand All @@ -108,6 +110,7 @@ xml_print_ex(FILE * __restrict ostream,
if (xml->next) {
xml = xml->next;
} else if ((parent = xml->parent)) {
snode = 0;
do {
if (opt > 0 && (!xml || (xml && xml->type == XML_ELEMENT))) {
for (i = 0; i < pad; i++)
Expand Down

0 comments on commit a672b67

Please sign in to comment.