diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2022-10-24 01:50:03 +0200 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2022-10-24 16:00:45 +0200 |
commit | 2b3b95c670a58ce9f79b42772261f10ddb1c5430 (patch) | |
tree | bb36a1015ce32fcc424f359f1429972d103a8510 | |
parent | 023b95dba00117cd1fed2d8a97ce80331376a1f9 (diff) | |
download | libexpat-git-2b3b95c670a58ce9f79b42772261f10ddb1c5430.tar.gz |
examples/outline.c: Be consistent in main loop exit across examples
-rw-r--r-- | expat/examples/outline.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/expat/examples/outline.c b/expat/examples/outline.c index 6d51a35d..d553d234 100644 --- a/expat/examples/outline.c +++ b/expat/examples/outline.c @@ -81,6 +81,7 @@ int main(void) { char buf[BUFSIZ]; XML_Parser parser = XML_ParserCreate(NULL); + int done; int depth = 0; if (! parser) { @@ -90,9 +91,7 @@ main(void) { XML_SetUserData(parser, &depth); XML_SetElementHandler(parser, startElement, endElement); - - for (;;) { - int done; + do { int len; len = (int)fread(buf, 1, BUFSIZ, stdin); @@ -109,10 +108,7 @@ main(void) { XML_ErrorString(XML_GetErrorCode(parser))); exit(-1); } - - if (done) - break; - } + } while (! done); XML_ParserFree(parser); return 0; } |