add function h_stringmap_copy
This commit is contained in:
parent
2b31fb0f33
commit
0970b15034
2 changed files with 8 additions and 0 deletions
|
|
@ -281,6 +281,13 @@ void h_stringmap_update(HStringMap *m, const HStringMap *n)
|
||||||
h_hashtable_merge(combine_stringmap, m->char_branches, n->char_branches);
|
h_hashtable_merge(combine_stringmap, m->char_branches, n->char_branches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HStringMap *h_stringmap_copy(HArena *a, const HStringMap *m)
|
||||||
|
{
|
||||||
|
HStringMap *res = h_stringmap_new(a);
|
||||||
|
h_stringmap_update(res, m);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* Replace all occurances of old in m with new.
|
/* Replace all occurances of old in m with new.
|
||||||
* If old is NULL, replace all values in m with new.
|
* If old is NULL, replace all values in m with new.
|
||||||
* If new is NULL, remove the respective values.
|
* If new is NULL, remove the respective values.
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ typedef struct HStringMap_ {
|
||||||
} HStringMap;
|
} HStringMap;
|
||||||
|
|
||||||
HStringMap *h_stringmap_new(HArena *a);
|
HStringMap *h_stringmap_new(HArena *a);
|
||||||
|
HStringMap *h_stringmap_copy(HArena *a, const HStringMap *m);
|
||||||
void h_stringmap_put_end(HStringMap *m, void *v);
|
void h_stringmap_put_end(HStringMap *m, void *v);
|
||||||
void h_stringmap_put_epsilon(HStringMap *m, void *v);
|
void h_stringmap_put_epsilon(HStringMap *m, void *v);
|
||||||
void h_stringmap_put_after(HStringMap *m, uint8_t c, HStringMap *ends);
|
void h_stringmap_put_after(HStringMap *m, uint8_t c, HStringMap *ends);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue