Commit bd4eb7a2e8a582ae999972acf53ee7a05d1d0857

Thomas de Grivel 2024-07-27T15:58:31

wip struct access

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libkc3/struct.c b/libkc3/struct.c
index cf6aa0e..75969b3 100644
--- a/libkc3/struct.c
+++ b/libkc3/struct.c
@@ -41,7 +41,8 @@ s_tag * struct_access (const s_struct *s, const s_sym *key, s_tag *dest)
     return NULL;
   if (st) {
     tmp.data.struct_.type = st;
-    if (! struct_allocate(&tmp.data.struct_))
+    if (! tmp.data.struct_.data &&
+        ! struct_allocate(&tmp.data.struct_))
       return NULL;
   }
   if (! tag_to_pointer(&tmp, type, &tmp_data))