summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-04-08 11:02:39 +0200
committerTyge Lovset <[email protected]>2023-04-08 11:40:12 +0200
commitd92ffe3da29b3352c90b2d356e395914ba5b3f52 (patch)
tree7482f08aeb1a236eb50d5e4a796dbb180b8c0534 /include/stc
parent701b7af4aaf9fe3965c656c500d9200dd7c4831d (diff)
downloadSTC-modified-d92ffe3da29b3352c90b2d356e395914ba5b3f52.tar.gz
STC-modified-d92ffe3da29b3352c90b2d356e395914ba5b3f52.zip
More docs updates, and a change in stc/extend.h.
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/algo/crange.h4
-rw-r--r--include/stc/ccommon.h3
-rw-r--r--include/stc/extend.h4
3 files changed, 6 insertions, 5 deletions
diff --git a/include/stc/algo/crange.h b/include/stc/algo/crange.h
index 91ffdd56..ca06c258 100644
--- a/include/stc/algo/crange.h
+++ b/include/stc/algo/crange.h
@@ -34,7 +34,7 @@ int main()
// use a temporary crange object.
int a = 100, b = INT32_MAX;
- c_forfilter (i, crange, crange_object(a, b, 8),
+ c_forfilter (i, crange, crange_obj(a, b, 8),
c_flt_skip(i, 10) &&
c_flt_take(i, 3))
printf(" %lld", *i.ref);
@@ -46,7 +46,7 @@ int main()
#include <stc/ccommon.h>
-#define crange_object(...) \
+#define crange_obj(...) \
(*(crange[]){crange_make(__VA_ARGS__)})
typedef long long crange_value;
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 24ad59f9..1a2b3c3f 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -122,8 +122,9 @@
#define c_make(C, ...) \
C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
-#define c_arraylen(a) (intptr_t)(sizeof(a)/sizeof 0[a])
#define c_litstrlen(literal) (c_sizeof("" literal) - 1)
+#define c_arraylen(a) (c_ARRAYLEN(a) + c_static_assert(sizeof(a) != sizeof(uintptr_t)))
+#define c_ARRAYLEN(a) (intptr_t)(sizeof(a)/sizeof 0[a])
// Non-owning c-string
typedef const char* crawstr;
diff --git a/include/stc/extend.h b/include/stc/extend.h
index cbfc4a12..66b3ebd1 100644
--- a/include/stc/extend.h
+++ b/include/stc/extend.h
@@ -52,9 +52,9 @@
typedef struct {
i_extend
i_type get;
-} c_PASTE(i_type, Ext);
+} c_PASTE(i_type, _ext);
-#define c_getcon(cptr) c_container_of(cptr, _cx_memb(Ext), get)
+#define c_getcon(cptr) c_container_of(cptr, _cx_memb(_ext), get)
#define i_is_forward
#define _i_inc <stc/i_con.h>