diff options
| author | Tyge Løvset <[email protected]> | 2020-09-06 23:32:30 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-06 23:32:30 +0200 |
| commit | 5b78847871217562dcddbb0bd34076a892eb49e1 (patch) | |
| tree | 66204cf3a2c0a8d847f8e423856249d11fa8946d /examples/mapmap.c | |
| parent | c42c18bb94606b45454da937690f872b5ebd59d1 (diff) | |
| download | STC-modified-5b78847871217562dcddbb0bd34076a892eb49e1.tar.gz STC-modified-5b78847871217562dcddbb0bd34076a892eb49e1.zip | |
Renamed push_****(), _insert() to _emplace(). added insert_or_assign(), etc.
Diffstat (limited to 'examples/mapmap.c')
| -rw-r--r-- | examples/mapmap.c | 14 |
1 files changed, 7 insertions, 7 deletions
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)
|
