diff options
| author | Tyge Løvset <[email protected]> | 2023-05-23 22:44:33 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-05-23 22:44:33 +0200 |
| commit | b1bbd0564a0d8d43172a654b51ff28bb62e0979a (patch) | |
| tree | dc6da16a716f65c4d226b9600fd270f5173d735d /include | |
| parent | f80a78239f545d7d73c8358056dd5d5825ccfe0b (diff) | |
| download | STC-modified-b1bbd0564a0d8d43172a654b51ff28bb62e0979a.tar.gz STC-modified-b1bbd0564a0d8d43172a654b51ff28bb62e0979a.zip | |
Some house holding cleanup.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cbits.h | 4 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 4 | ||||
| -rw-r--r-- | include/stc/cregex.h | 1 | ||||
| -rw-r--r-- | include/stc/cstack.h | 16 |
4 files changed, 9 insertions, 16 deletions
diff --git a/include/stc/cbits.h b/include/stc/cbits.h index cf13790a..fe422202 100644 --- a/include/stc/cbits.h +++ b/include/stc/cbits.h @@ -198,7 +198,7 @@ STC_INLINE cbits cbits_with_pattern(const int64_t size, const uint64_t pattern) typedef struct { uint64_t data64[(i_capacity - 1)/64 + 1]; } i_type; -STC_INLINE i_type _i_memb(_init)(void) { return c_LITERAL(i_type){0}; } +STC_INLINE void _i_memb(_init)(i_type* self) { memset(self->data64, 0, i_capacity*8); } STC_INLINE void _i_memb(_drop)(i_type* self) {} STC_INLINE int64_t _i_memb(_size)(const i_type* self) { return i_capacity; } STC_INLINE i_type _i_memb(_move)(i_type* self) { return *self; } @@ -211,7 +211,7 @@ STC_INLINE i_type _i_memb(_clone)(i_type other) STC_INLINE i_type* _i_memb(_copy)(i_type* self, const i_type* other) { *self = *other; return self; } - + STC_INLINE void _i_memb(_set_all)(i_type *self, const bool value); STC_INLINE void _i_memb(_set_pattern)(i_type *self, const uint64_t pattern); diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index eb3a6601..01ead57a 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -217,8 +217,8 @@ STC_INLINE intptr_t cnextpow2(intptr_t n) { #else #include <initializer_list> #define c_forlist(it, T, ...) \ - for (struct {std::initializer_list<T> _il; std::initializer_list<T>::iterator data, ref; size_t size, index;} \ - it = {._il=__VA_ARGS__, .data=it._il.begin(), .ref=it.data, .size=it._il.size()} \ + for (struct {std::initializer_list<T> _il; std::initializer_list<T>::iterator ref; size_t size, index;} \ + it = {._il=__VA_ARGS__, .ref=it._il.begin(), .size=it._il.size()} \ ; it.index < it.size; ++it.ref, ++it.index) #endif diff --git a/include/stc/cregex.h b/include/stc/cregex.h index bf239ff6..919f5474 100644 --- a/include/stc/cregex.h +++ b/include/stc/cregex.h @@ -53,7 +53,6 @@ enum { typedef enum { CREG_OK = 0, - CREG_SUCCESS = 0, /* [deprecated] */ CREG_NOMATCH = -1, CREG_MATCHERROR = -2, CREG_OUTOFMEMORY = -3, diff --git a/include/stc/cstack.h b/include/stc/cstack.h index ae8b3c40..fa0fab2b 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -41,20 +41,14 @@ #endif typedef i_keyraw _cx_raw; -STC_INLINE _cx_self _cx_memb(_init)(void) { - _cx_self cx; cx._len = 0; -#ifndef i_capacity - cx._cap = 0; cx.data = NULL; -#endif - return cx; -} - #ifdef i_capacity -STC_INLINE void _cx_memb(_create)(_cx_self* self) +STC_INLINE void _cx_memb(_init)(_cx_self* self) { self->_len = 0; } #else -STC_INLINE void _cx_memb(_create)(_cx_self* self) - { self->_len = 0; self->_cap = 0; self->data = NULL; } +STC_INLINE _cx_self _cx_memb(_init)(void) { + _cx_self out = {0}; + return out; +} STC_INLINE _cx_self _cx_memb(_with_capacity)(intptr_t cap) { _cx_self out = {(_cx_value *) i_malloc(cap*c_sizeof(i_key)), 0, cap}; |
