summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/rawptr_elements.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-03-26 00:27:45 +0100
committerTyge Løvset <[email protected]>2023-03-26 00:27:45 +0100
commiteb85069b669e754836b9d4587ba03d3af1a5e975 (patch)
tree45c9a0d3fe40c59a8b33ae8ecd2e7aa78bef6240 /misc/examples/rawptr_elements.c
parente8be14dfc894eeac859f0287d4d5b4f4745c0585 (diff)
downloadSTC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.tar.gz
STC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.zip
development branch for 4.2
Removed uses of c_auto and c_with in documentation examples and code examples. Still using c_defer a few places. Renamed c11/fmt.h to c11/print.h. Some additions in ccommon.h, e.g. c_const_cast(T, x). Improved docs.
Diffstat (limited to 'misc/examples/rawptr_elements.c')
-rw-r--r--misc/examples/rawptr_elements.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/misc/examples/rawptr_elements.c b/misc/examples/rawptr_elements.c
index 4b3d2056..f46a7f5e 100644
--- a/misc/examples/rawptr_elements.c
+++ b/misc/examples/rawptr_elements.c
@@ -28,9 +28,13 @@ typedef int64_t inttype;
int main()
{
- c_auto (SIPtrMap, map, m1)
- c_auto (SIBoxMap, m2)
- {
+ SIPtrMap map = {0}, m1;
+ SIBoxMap m2 = {0};
+ c_defer(
+ SIPtrMap_drop(&map),
+ SIPtrMap_drop(&m1),
+ SIBoxMap_drop(&m2)
+ ){
printf("\nMap with pointer elements:\n");
SIPtrMap_insert(&map, cstr_from("testing"), c_new(inttype, 1));
SIPtrMap_insert(&map, cstr_from("done"), c_new(inttype, 2));