summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-20 00:40:54 +0200
committerTyge Løvset <[email protected]>2023-05-20 00:40:54 +0200
commitbb59d9c87f8d99f50c439351480c0ec8d6eea38e (patch)
treec8e273e7a63332ca37a5a15e9c81e534b8af7e44 /include
parent26513bb1352ab4e4ffe931aabd80868216afc551 (diff)
downloadSTC-modified-bb59d9c87f8d99f50c439351480c0ec8d6eea38e.tar.gz
STC-modified-bb59d9c87f8d99f50c439351480c0ec8d6eea38e.zip
Rename c_make() macro to c_init(). c_make still available, but deprecated.
Diffstat (limited to 'include')
-rw-r--r--include/stc/algo/filter.h2
-rw-r--r--include/stc/ccommon.h5
-rw-r--r--include/stc/cspan.h2
-rw-r--r--include/stc/cstack.h6
4 files changed, 8 insertions, 7 deletions
diff --git a/include/stc/algo/filter.h b/include/stc/algo/filter.h
index fe733c64..8dc1ad74 100644
--- a/include/stc/algo/filter.h
+++ b/include/stc/algo/filter.h
@@ -28,7 +28,7 @@
int main()
{
- cstack_int stk = c_make(cstack_int, {1, 2, 3, 4, 5, 6, 7, 8, 9});
+ cstack_int stk = c_init(cstack_int, {1, 2, 3, 4, 5, 6, 7, 8, 9});
c_foreach (i, cstack_int, stk)
printf(" %d", *i.ref);
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 07c72e2f..e9d97d4b 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -117,8 +117,9 @@
/* Function macros and others */
-#define c_make(C, ...) \
- C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
+#define c_init(C, ...) \
+ C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
+#define c_make(C, ...) c_init(C, __VA_ARGS__) // [deprecated]
#define c_litstrlen(literal) (c_sizeof("" literal) - 1)
#define c_arraylen(a) (intptr_t)(sizeof(a)/sizeof 0[a])
diff --git a/include/stc/cspan.h b/include/stc/cspan.h
index ac3e9206..b07e75a8 100644
--- a/include/stc/cspan.h
+++ b/include/stc/cspan.h
@@ -115,7 +115,7 @@ typedef struct { int32_t d[6]; } cspan_idx6;
#define cspan_md(array, ...) \
{.data=array, .shape={__VA_ARGS__}, .stride={.d={__VA_ARGS__}}}
-/* For static initialization, use cspan_make(). c_make() for non-static only. */
+/* For static initialization, use cspan_make(). c_init() for non-static only. */
#define cspan_make(SpanType, ...) \
{.data=(SpanType##_value[])__VA_ARGS__, .shape={sizeof((SpanType##_value[])__VA_ARGS__)/sizeof(SpanType##_value)}}
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index bee7d17b..eb6ccb58 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -175,12 +175,12 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val)
#endif // !i_no_clone
STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
- return c_LITERAL(_cx_iter){self->_len ? (_cx_value*)self->data : NULL,
- (_cx_value*)self->data + self->_len};
+ return c_LITERAL(_cx_iter){self->_len ? self->data : NULL,
+ self->data + self->_len};
}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
- { return c_LITERAL(_cx_iter){NULL, (_cx_value*)self->data + self->_len}; }
+ { return c_LITERAL(_cx_iter){NULL, self->data + self->_len}; }
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }