diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2022-09-25 17:17:04 +0200 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2022-10-17 23:11:10 +0200 |
commit | 9d26eda6f85b052cae8706b7b2c398ad85c7a866 (patch) | |
tree | ad4304f25be73efe87b58ffc96200537aa5b5f61 | |
parent | 15026eb853ff945127b077598985365349f63d59 (diff) | |
download | libexpat-git-9d26eda6f85b052cae8706b7b2c398ad85c7a866.tar.gz |
lib: Simplify control flow in internalEntityProcessor
The key is that all branches but the last ended in `return`.
```
BEFORE | AFTER
--------------------+--------------------
if (..a..) { | if (..a..) {
..b..; | ..b..;
return ..c..; | return ..c..;
| }
} else if (..d..) { | if (..d..) {
..e..; | ..e..;
return ..f..; | return ..f..;
} else { | }
..g..; | ..g..;
} |
```
-rw-r--r-- | expat/lib/xmlparse.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index e415068b..61549930 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -5798,20 +5798,20 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end, if (result != XML_ERROR_NONE) return result; - else if (textEnd != next - && parser->m_parsingStatus.parsing == XML_SUSPENDED) { + + if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) { entity->processed = (int)(next - (const char *)entity->textPtr); return result; - } else { + } + #ifdef XML_DTD - entityTrackingOnClose(parser, entity, __LINE__); + entityTrackingOnClose(parser, entity, __LINE__); #endif - entity->open = XML_FALSE; - parser->m_openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = parser->m_freeInternalEntities; - parser->m_freeInternalEntities = openEntity; - } + entity->open = XML_FALSE; + parser->m_openInternalEntities = openEntity->next; + /* put openEntity back in list of free instances */ + openEntity->next = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = openEntity; #ifdef XML_DTD if (entity->is_param) { |