diff options
| author | Tyge Løvset <[email protected]> | 2023-02-07 15:02:39 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-07 15:02:39 +0100 |
| commit | ff52ba11700f446904f7d4c28a367cc692d3481b (patch) | |
| tree | c35b4d756d4335c8804d72ff14269678a05ddff9 /include | |
| parent | ca54204557669fb54f43959594ee92109fcc75b6 (diff) | |
| download | STC-modified-ff52ba11700f446904f7d4c28a367cc692d3481b.tar.gz STC-modified-ff52ba11700f446904f7d4c28a367cc692d3481b.zip | |
crange and docs update.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/algo/crange.h | 4 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/algo/crange.h b/include/stc/algo/crange.h index 39236ae0..3993e615 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_literal(a, b, 8) + c_FORFILTER (i, crange, crange_obj(a, b, 8) , i.index > 10 , c_flt_take(i, 3)) printf(" %lld", *i.ref); @@ -46,7 +46,7 @@ int main() #include <stc/ccommon.h> -#define crange_literal(...) \ +#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 ddfb41b9..d7d2d804 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -78,10 +78,10 @@ #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(b) ((int)(0*sizeof(int[(b) ? 1 : -1]))) #define c_container_of(p, T, m) ((T*)((char*)(p) + 0*sizeof((p) == &((T*)0)->m) - offsetof(T, m))) -#define c_delete(T, ptr) do { T *_tp = ptr; T##_drop(_tp); i_free(_tp); } while (0) #define c_swap(T, xp, yp) do { T *_xp = xp, *_yp = yp, \ _tv = *_xp; *_xp = *_yp; *_yp = _tv; } while (0) #define c_sizeof (intptr_t)sizeof |
