From 5b78847871217562dcddbb0bd34076a892eb49e1 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 6 Sep 2020 23:32:30 +0200 Subject: Renamed push_****(), _insert() to _emplace(). added insert_or_assign(), etc. --- examples/mapmap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/mapmap.c') diff --git a/examples/mapmap.c b/examples/mapmap.c index a0c1b173..6929dc69 100644 --- a/examples/mapmap.c +++ b/examples/mapmap.c @@ -9,14 +9,14 @@ declare_cmap_strkey(cfg, cmap_str, cmap_str_destroy); int main(void) { cmap_cfg config = cmap_ini; cmap_str init = cmap_ini; - cmap_str_put(&cmap_cfg_insert(&config, "user", init)->value, "name", "Joe"); - cmap_str_put(&cmap_cfg_insert(&config, "user", init)->value, "groups", "proj1,proj3"); - cmap_str_put(&cmap_cfg_insert(&config, "group", init)->value, "proj1", "Energy"); - cmap_str_put(&cmap_cfg_insert(&config, "group", init)->value, "proj2", "Windy"); - cmap_str_put(&cmap_cfg_insert(&config, "group", init)->value, "proj3", "Oil"); - cmap_str_put(&cmap_cfg_insert(&config, "admin", init)->value, "employees", "2302"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "user", init).item->value, "name", "Joe"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "user", init).item->value, "groups", "proj1,proj3"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "group", init).item->value, "proj1", "Energy"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "group", init).item->value, "proj2", "Windy"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "group", init).item->value, "proj3", "Oil"); + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "admin", init).item->value, "employees", "2302"); - cmap_str_put(&cmap_cfg_insert(&config, "group", init)->value, "proj2", "Wind"); // Update + cmap_str_insert_or_assign(&cmap_cfg_emplace(&config, "group", init).item->value, "proj2", "Wind"); // Update c_foreach (i, cmap_cfg, config) c_foreach (j, cmap_str, i.item->value) -- cgit v1.2.3