diff options
| author | Tyge Lovset <[email protected]> | 2023-08-30 08:24:54 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-08-30 08:24:54 +0200 |
| commit | 263dbab626e6a99f7959a4c1716f0496906ee638 (patch) | |
| tree | 3c2541b9a0f530fc98ddd00dfb6c306757e89c75 /include/stc/ccommon.h | |
| parent | 31cdd30a4ed87087bf19f14f4a643e39735a1420 (diff) | |
| download | STC-modified-263dbab626e6a99f7959a4c1716f0496906ee638.tar.gz STC-modified-263dbab626e6a99f7959a4c1716f0496906ee638.zip | |
Some simplifications. Added i_ndebug macro flag to disable assertions in cspan.
Diffstat (limited to 'include/stc/ccommon.h')
| -rw-r--r-- | include/stc/ccommon.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 6e90f75a..ad92212a 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -69,16 +69,14 @@ typedef long long _llong; #define c_new(T, ...) ((T*)memcpy(malloc(sizeof(T)), ((T[]){__VA_ARGS__}), sizeof(T))) #define c_LITERAL(T) (T) #endif -#define c_new_n(T, n) ((T*)malloc(sizeof(T)*(size_t)(n))) +#define c_new_n(T, n) ((T*)malloc(sizeof(T)*c_i2u(n))) #define c_malloc(sz) malloc(c_i2u(sz)) #define c_calloc(n, sz) calloc(c_i2u(n), c_i2u(sz)) #define c_realloc(p, sz) realloc(p, c_i2u(sz)) #define c_free(p) free(p) #define c_delete(T, ptr) do { T *_tp = ptr; T##_drop(_tp); free(_tp); } while (0) -#define c_static_assert(...) c_MACRO_OVERLOAD(c_static_assert, __VA_ARGS__) -#define c_static_assert_1(b) ((int)(0*sizeof(int[(b) ? 1 : -1]))) -#define c_static_assert_2(b, m) c_static_assert_1(b) +#define c_static_assert(expr) (1 ? 0 : (int)sizeof(int[(expr) ? 1 : -1])) #if defined STC_NDEBUG || defined NDEBUG #define c_assert(expr) ((void)0) #else |
