From b76773eef93b487cf6c6d2784207e3cf2fe6fcd8 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 27 Apr 2022 15:11:30 +0200 Subject: Bugfix: cbox didn't use i_keyclone, and therefore did not deep clone properly. --- examples/city.c | 10 ++++++---- examples/make.sh | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/city.c b/examples/city.c index d1bee4b7..ec3338a7 100644 --- a/examples/city.c +++ b/examples/city.c @@ -17,6 +17,7 @@ static inline uint64_t City_hash(const City* a) { } static inline City City_clone(City c) { + printf("clone %s\n", cstr_str(&c.name)); c.name = cstr_clone(c.name); c.country = cstr_clone(c.country); return c; @@ -27,13 +28,14 @@ static inline void City_drop(City* c) { c_drop(cstr, &c->name, &c->country); } + #define i_type CityArc -#define i_val_bind City -//#include -#include +#define i_key_bind City +#include +//#include // try instead of cbox.h #define i_type Cities -#define i_val_arcbox CityArc +#define i_key_arcbox CityArc #include #define i_type CityMap diff --git a/examples/make.sh b/examples/make.sh index 4687ed97..af7eace9 100644 --- a/examples/make.sh +++ b/examples/make.sh @@ -1,6 +1,8 @@ #!/bin/bash -cc='gcc -s -O2 -Wall -std=c99 -pedantic' +cc='clang -s -O2 -Wall -std=c99 -pedantic' +#cc='gcc -s -O2 -Wall -std=c99 -pedantic' #cc='gcc -x c++ -s -O2 -Wall -std=c++20' +#cc='g++ -x c++ -s -O2 -Wall' #cc='clang -s -O2 -Wall -std=c99 -pedantic -DSTC_OLD_CSTR' #cc='clang' #cc='clang -c -DSTC_HEADER' -- cgit v1.2.3