Skip to content

Commit

Permalink
improve parser if readonly is not desired
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Apr 5, 2020
1 parent 1fe3bd2 commit 7f75df4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions include/xml/impl/impl_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ xml_parse(const char * __restrict contents, xml_options_t options) {
case '\n':
case '\t':
break;
case '<': {
case '<': { /* TODO: what if we get << or <<!-- ->TAG>... here? */
if (pos == begintag)
goto err;

pos = begintag;

if (!readonly) {
*p = '\0';
if ((c = *++p) != '\0')
goto again;;
}
break;
}
case '?':
Expand Down Expand Up @@ -135,8 +141,11 @@ xml_parse(const char * __restrict contents, xml_options_t options) {
pos = beginel;
}

if (!readonly)
*p++ = '\0';
if (!readonly) {
*p = '\0';
if ((c = *++p) != '\0')
goto again;;
}
break;
default: {
switch (pos) {
Expand Down

0 comments on commit 7f75df4

Please sign in to comment.