diff options
| author | Tyge Løvset <[email protected]> | 2020-07-22 17:41:00 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-07-22 17:41:00 +0200 |
| commit | 392b2bf5c17f9e54a39a4a98c5a96d20e87c08a2 (patch) | |
| tree | a11607d10b8bae14b25bb1e3f920c3dbeed83994 /examples | |
| parent | 1591c0696586f91b426d023982b5cb1834aff557 (diff) | |
| download | STC-modified-392b2bf5c17f9e54a39a4a98c5a96d20e87c08a2.tar.gz STC-modified-392b2bf5c17f9e54a39a4a98c5a96d20e87c08a2.zip | |
Fixed cmap_xx_clear()
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/benchmark.c | 2 | ||||
| -rw-r--r-- | examples/demos.c | 2 | ||||
| -rw-r--r-- | examples/inits.c | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/examples/benchmark.c b/examples/benchmark.c index 62a6cb52..3bcd3d5c 100644 --- a/examples/benchmark.c +++ b/examples/benchmark.c @@ -38,7 +38,7 @@ sfc64_random_t rng; #define CMAP_FIND(tag, key) (cmap_##tag##_find(map, key) != NULL)
#define CMAP_SIZE(tag) cmap_size(map)
#define CMAP_BUCKETS(tag) cmap_bucketCount(map)
-#define CMAP_CLEAR(tag) cmap_##tag##_destroy(&map)
+#define CMAP_CLEAR(tag) cmap_##tag##_clear(&map)
#define KMAP_SETUP(tag, Key, Value) khash_t(ii)* map = kh_init(ii); khiter_t ki; int ret
#define KMAP_PUT(tag, key, val) (*(ki = kh_put(ii, map, key, &ret), map->vals[ki] = val, &map->vals[ki]))
diff --git a/examples/demos.c b/examples/demos.c index 89918d33..9eec136a 100644 --- a/examples/demos.c +++ b/examples/demos.c @@ -160,6 +160,8 @@ void mapdemo3() cmap_ss_put(&table, "Make", cstr_make("my"));
cmap_ss_put(&table, "Sunny", cstr_make("day"));
CMapEntry_ss *e = cmap_ss_find(&table, "Make");
+ c_foreach (i, cmap_ss, table)
+ printf("entry: %s: %s\n", i.item->key.str, i.item->value.str);
printf("size %zu: remove: Make: %s\n", cmap_size(table), e->value.str);
cmap_ss_erase(&table, "Make");
//cmap_ss_eraseEntry(&table, e);
diff --git a/examples/inits.c b/examples/inits.c index 0848ef80..eb0968b4 100644 --- a/examples/inits.c +++ b/examples/inits.c @@ -9,11 +9,12 @@ declare_CMap_str(si, int); int main(void) {
int year = 2020;
- CMap_ms ms = cmap_ms_from((CMapInput_ms[]) {
+ CMapInput_ms ini[] = {
100, cstr_make("Hello"),
110, cstr_make("World"),
120, cstr_from("Howdy, -%d-", year),
- }, 3);
+ };
+ CMap_ms ms = cmap_ms_from(ini, 3);
c_foreach (i, cmap_ms, ms)
printf("%d: %s\n", i.item->key, i.item->value.str);
|
