summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-10-20 21:57:14 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-10-20 21:57:14 -0700
commit3af93a39d7dddadc13fba978da113aa847509ee5 (patch)
tree4e7eacd5e4b52e8f9e45c8f3f52fdcdf06785196 /src
parentb0fc587a7fbeb902bb0760dba73ee621105a86bc (diff)
Clarify a note about compact hash behavior during move
After move some nodes in the hash table can have keys that point to other; this makes the table somewhat larger but this does not impact correctness. The reason is that for us to access a key in the hash table, there should be a compact_pointer/string object with the state indicating that it is stored in a hash table, and with the address matching the key. For this to happen, we had to have put this object into this state which would mean that we'd overwrite the hash entry with the new, correct value. When nodes/pages are being removed, we do not clean up keys from the hash table - it's safe for the same reason, and thus move doesn't introduce additional contracts here.
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 2371813..554d8df 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -6963,8 +6963,7 @@ namespace pugi
xml_node_struct* other_first_child = other->first_child;
#ifdef PUGIXML_COMPACT
- // move compact hash
- // TODO: the hash still has pointers to other, do we need to clear them out?
+ // move compact hash; note that the hash table can have pointers to other but they will be "inactive", similarly to nodes removed with remove_child
doc->hash = other->hash;
doc->_hash = &doc->hash;