Skip to content
Snippets Groups Projects
Commit 797bdb72 authored by Sven M. Hallberg's avatar Sven M. Hallberg
Browse files

copy source stringmap as necessary in stringmap_merge

parent 0970b150
No related branches found
No related tags found
No related merge requests found
......@@ -81,11 +81,8 @@ static void *combine_entries(HHashSet *workset, void *dst, const void *src)
// add the mappings of src to dst, marking conflicts and adding the conflicting
// values to workset.
// note: reuses parts of src to build dst!
static void stringmap_merge(HHashSet *workset, HStringMap *dst, HStringMap *src)
{
assert(src->arena == dst->arena);
if(src->epsilon_branch) {
if(dst->epsilon_branch)
dst->epsilon_branch =
......@@ -120,10 +117,13 @@ static void stringmap_merge(HHashSet *workset, HStringMap *dst, HStringMap *src)
if(src_) {
HStringMap *dst_ = h_hashtable_get(dst->char_branches, (void *)c);
if(dst_)
if(dst_) {
stringmap_merge(workset, dst_, src_);
else
} else {
if(src_->arena != dst->arena)
src_ = h_stringmap_copy(dst->arena, src_);
h_hashtable_put(dst->char_branches, (void *)c, src_);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment