summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cvec.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-05 14:05:25 +0200
committerTyge Løvset <[email protected]>2022-05-05 14:05:25 +0200
commitdc08853f66e40a9a23c7f6b344d51254e10c628e (patch)
treea2bdbbaba2e2d81c1fd09439bc5c2385d70f50e3 /include/stc/cvec.h
parent70551d3af9e30d75a6a6373787ff1432feebee26 (diff)
downloadSTC-modified-dc08853f66e40a9a23c7f6b344d51254e10c628e.tar.gz
STC-modified-dc08853f66e40a9a23c7f6b344d51254e10c628e.zip
Added type-checked c_container_of() macro using typeof (C23, gcc, clang, tcc). c_unchecked_container_of() must be used by lib.
Diffstat (limited to 'include/stc/cvec.h')
-rw-r--r--include/stc/cvec.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 24cf8249..83c8680d 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -64,8 +64,8 @@ int main() {
#include <stdlib.h>
#include <string.h>
-struct cvec_rep { size_t size, cap; void* data[]; };
-#define cvec_rep_(self) c_container_of((self)->data, struct cvec_rep, data)
+struct cvec_rep { size_t size, cap; unsigned data[1]; };
+#define cvec_rep_(self) c_unchecked_container_of((self)->data, struct cvec_rep, data)
#endif // CVEC_H_INCLUDED
#ifndef _i_prefix