From e9d17a045e5123a91a35b43e005d37cb696b6120 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sat, 26 Aug 2023 08:35:40 -0700 Subject: [PATCH] Streamline conditions with else if --- src/pugixml.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 88ce8d4..5c79c71 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3493,20 +3493,17 @@ PUGI_IMPL_NS_BEGIN { cursor->value = parsed_pcdata; // Save the offset. } + else if (PUGI_IMPL_OPTSET(parse_merge_pcdata) && cursor->first_child && PUGI_IMPL_NODETYPE(cursor->first_child->prev_sibling_c) == node_pcdata) + { + strconcat(cursor->first_child->prev_sibling_c->value, parsed_pcdata); // Append PCDATA to the previous one. + } else { - if (PUGI_IMPL_OPTSET(parse_merge_pcdata) && cursor->first_child && PUGI_IMPL_NODETYPE(cursor->first_child->prev_sibling_c) == node_pcdata) - { - strconcat(cursor->first_child->prev_sibling_c->value, parsed_pcdata); // Append PCDATA to the previous one. - } - else - { - PUGI_IMPL_PUSHNODE(node_pcdata); // Append a new node on the tree. - - cursor->value = parsed_pcdata; // Save the offset. + PUGI_IMPL_PUSHNODE(node_pcdata); // Append a new node on the tree. - PUGI_IMPL_POPNODE(); // Pop since this is a standalone. - } + cursor->value = parsed_pcdata; // Save the offset. + + PUGI_IMPL_POPNODE(); // Pop since this is a standalone. } if (!*s) break;