summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-10-17 10:51:20 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-10-17 10:51:20 -0700
commit809f992f83d46abbb876ac0bcc82effa210ae508 (patch)
tree2d8e57dc7a3236ee12922062cb5b8636c695e61d /src
parent0e09571f21d41969a26e9ec73ef0da78d9371d38 (diff)
Fix MSVC6 header-only build
name_sentry dtor results in multiple symbol definition errors in MSVC6.
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 9bb054e..9cbce7c 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -4891,6 +4891,22 @@ PUGI__NS_BEGIN
return ferror(file) == 0;
}
+
+ struct name_null_sentry
+ {
+ xml_node_struct* node;
+ char_t* name;
+
+ name_null_sentry(xml_node_struct* node): node(node), name(node->name)
+ {
+ node->name = 0;
+ }
+
+ ~name_null_sentry()
+ {
+ node->name = name;
+ }
+ };
PUGI__NS_END
namespace pugi
@@ -5920,17 +5936,7 @@ namespace pugi
doc->extra_buffers = extra;
// name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
- struct name_sentry
- {
- xml_node_struct* node;
- char_t* name;
-
- ~name_sentry() { node->name = name; }
- };
-
- name_sentry sentry = { _root, _root->name };
-
- sentry.node->name = 0;
+ impl::name_null_sentry sentry(_root);
return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
}