diff options
| author | Tyge Løvset <[email protected]> | 2020-09-11 23:18:57 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-11 23:18:57 +0200 |
| commit | 10c2736823c2bbfd613846a5cc88a66bd7971f1b (patch) | |
| tree | c3f57d82c6293793484346357019965c007f9328 /examples | |
| parent | 4267d2f46f1a06b0f531b43e91931a9c1de72a6f (diff) | |
| download | STC-modified-10c2736823c2bbfd613846a5cc88a66bd7971f1b.tar.gz STC-modified-10c2736823c2bbfd613846a5cc88a66bd7971f1b.zip | |
Added at() to cmap. Added c_assert(), c_static_assert() in cdefs.h
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/demos.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/demos.c b/examples/demos.c index 8ff72840..0fa6f5e2 100644 --- a/examples/demos.c +++ b/examples/demos.c @@ -123,8 +123,7 @@ void mapdemo1() cmap_ii nums = cmap_ini;
cmap_ii_put(&nums, 8, 64);
cmap_ii_put(&nums, 11, 121);
-
- printf("get 8: %d\n", cmap_ii_find(&nums, 8)->value);
+ printf("get 8: %d\n", *cmap_ii_at(&nums, 8));
cmap_ii_destroy(&nums);
}
@@ -140,7 +139,7 @@ void mapdemo2() cmap_si_put(&nums, "Groovy", 200); // overwrite previous
// iterate the map:
- for (cmap_si_iter_t i = cmap_si_begin(&nums), ie = cmap_si_end(&nums); i.item != ie.item; cmap_si_next(&i))
+ for (cmap_si_iter_t i = cmap_si_begin(&nums); i.item != cmap_si_end(&nums).item; cmap_si_next(&i))
printf("long: %s: %d\n", i.item->key.str, i.item->value);
// or rather use the short form:
|
