diff options
| author | Tyge Løvset <[email protected]> | 2022-12-19 10:13:36 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-19 10:13:36 +0100 |
| commit | 6167fa5e361b2954440594cb693f25f643eb9e0a (patch) | |
| tree | 4e30a01b7274fcc4bedc24d442625d8187130d33 | |
| parent | 1d4ad83d6f3388982cb0aeadbc9815b4776df504 (diff) | |
| download | STC-modified-6167fa5e361b2954440594cb693f25f643eb9e0a.tar.gz STC-modified-6167fa5e361b2954440594cb693f25f643eb9e0a.zip | |
Some "internal" macros in ccommon.h made all caps.
| -rw-r--r-- | docs/cpque_api.md | 2 | ||||
| -rw-r--r-- | examples/priority.c | 2 | ||||
| -rw-r--r-- | examples/rawptr_elements.c | 2 | ||||
| -rw-r--r-- | include/stc/cbits.h | 4 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 20 | ||||
| -rw-r--r-- | include/stc/cmap.h | 4 | ||||
| -rw-r--r-- | include/stc/template.h | 32 |
7 files changed, 33 insertions, 33 deletions
diff --git a/docs/cpque_api.md b/docs/cpque_api.md index 5f234892..a68e3392 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -89,7 +89,7 @@ int main() // Extract and display the fifty smallest. c_forrange (50) { - printf("%" PRIdMAX " ", *cpque_i_top(&heap)); + printf("%" PRId64 " ", *cpque_i_top(&heap)); cpque_i_pop(&heap); } } diff --git a/examples/priority.c b/examples/priority.c index 6af297ac..f6e63205 100644 --- a/examples/priority.c +++ b/examples/priority.c @@ -28,7 +28,7 @@ int main() { puts("Extract the hundred smallest."); c_forrange (100) { - printf("%" PRIdMAX " ", *cpque_i_top(&heap)); + printf("%" PRId64 " ", *cpque_i_top(&heap)); cpque_i_pop(&heap); } } diff --git a/examples/rawptr_elements.c b/examples/rawptr_elements.c index 37f1fe32..4b3d2056 100644 --- a/examples/rawptr_elements.c +++ b/examples/rawptr_elements.c @@ -42,7 +42,7 @@ int main() m1 = SIPtrMap_clone(map); c_forpair (name, number, SIPtrMap, m1) - printf("%s: %" PRIdMAX "\n", cstr_str(_.name), **_.number); + printf("%s: %" PRId64 "\n", cstr_str(_.name), **_.number); puts("\nIBox map:"); diff --git a/include/stc/cbits.h b/include/stc/cbits.h index 8c0db10f..3c187e78 100644 --- a/include/stc/cbits.h +++ b/include/stc/cbits.h @@ -114,7 +114,7 @@ STC_INLINE bool _cbits_disjoint(const uint64_t* set, const uint64_t* other, cons #endif // CBITS_H_INCLUDED -#define _i_memb(name) c_paste(i_type, name) +#define _i_memb(name) c_PASTE(i_type, name) #if !defined i_capacity // DYNAMIC SIZE BITARRAY @@ -190,7 +190,7 @@ STC_INLINE cbits cbits_with_pattern(const size_t size, const uint64_t pattern) { #define _i_assert(x) (void)0 #ifndef i_type -#define i_type c_paste(cbits, i_capacity) +#define i_type c_PASTE(cbits, i_capacity) #endif struct { uint64_t data64[(i_capacity - 1)/64 + 1]; } typedef i_type; diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index c33f5f59..9aa55e00 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -50,19 +50,19 @@ /* Macro overloading feature support based on: https://rextester.com/ONP80107 */ #define c_MACRO_OVERLOAD(name, ...) \ - c_paste(name, c_numargs(__VA_ARGS__))(__VA_ARGS__) -#define c_concat(a, b) a ## b -#define c_paste(a, b) c_concat(a, b) -#define c_expand(...) __VA_ARGS__ -#define c_numargs(...) _c_APPLY_ARG_N((__VA_ARGS__, _c_RSEQ_N)) + c_PASTE(name, c_NUMARGS(__VA_ARGS__))(__VA_ARGS__) +#define c_CONCAT(a, b) a ## b +#define c_PASTE(a, b) c_CONCAT(a, b) +#define c_EXPAND(...) __VA_ARGS__ +#define c_NUMARGS(...) _c_APPLY_ARG_N((__VA_ARGS__, _c_RSEQ_N)) -#define _c_APPLY_ARG_N(args) c_expand(_c_ARG_N args) +#define _c_APPLY_ARG_N(args) c_EXPAND(_c_ARG_N args) #define _c_RSEQ_N 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 #define _c_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, \ _14, _15, _16, N, ...) N #define c_static_assert(cond) \ - typedef char c_paste(_static_assert_line_, __LINE__)[(cond) ? 1 : -1] + typedef char c_PASTE(_static_assert_line_, __LINE__)[(cond) ? 1 : -1] #define c_container_of(p, T, m) \ ((T*)((char*)(p) + 0*sizeof((p) == &((T*)0)->m) - offsetof(T, m))) @@ -209,13 +209,13 @@ STC_INLINE char* cstrnstrn(const char *str, const char *needle, #define c_auto2(C, a) \ c_with2(C a = C##_init(), C##_drop(&a)) #define c_auto3(C, a, b) \ - c_with2(c_expand(C a = C##_init(), b = C##_init()), \ + c_with2(c_EXPAND(C a = C##_init(), b = C##_init()), \ (C##_drop(&b), C##_drop(&a))) #define c_auto4(C, a, b, c) \ - c_with2(c_expand(C a = C##_init(), b = C##_init(), c = C##_init()), \ + c_with2(c_EXPAND(C a = C##_init(), b = C##_init(), c = C##_init()), \ (C##_drop(&c), C##_drop(&b), C##_drop(&a))) #define c_auto5(C, a, b, c, d) \ - c_with2(c_expand(C a = C##_init(), b = C##_init(), c = C##_init(), d = C##_init()), \ + c_with2(c_EXPAND(C a = C##_init(), b = C##_init(), c = C##_init(), d = C##_init()), \ (C##_drop(&d), C##_drop(&c), C##_drop(&b), C##_drop(&a))) #define c_drop(C, ...) do { c_forlist (_i, C*, {__VA_ARGS__}) C##_drop(*_i.ref); } while(0) diff --git a/include/stc/cmap.h b/include/stc/cmap.h index dabb1138..b0793ce5 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -338,7 +338,7 @@ STC_DEF chash_bucket_t _cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr) { const uint64_t _hash = i_hash_functor(self, rkeyptr); i_size _cap = self->bucket_count; - chash_bucket_t b = {c_paste(fastrange_,_i_expandby)(_hash, _cap), (uint8_t)(_hash | 0x80)}; + chash_bucket_t b = {c_PASTE(fastrange_,_i_expandby)(_hash, _cap), (uint8_t)(_hash | 0x80)}; const uint8_t* _hx = self->_hashx; while (_hx[b.idx]) { if (_hx[b.idx] == b.hx) { @@ -431,7 +431,7 @@ _cx_memb(_erase_entry)(_cx_self* self, _cx_value* _val) { if (! _hashx[j]) break; const _cx_rawkey _raw = i_keyto(_i_keyref(_slot + j)); - k = (i_size)c_paste(fastrange_,_i_expandby)(i_hash_functor(self, (&_raw)), _cap); + k = (i_size)c_PASTE(fastrange_,_i_expandby)(i_hash_functor(self, (&_raw)), _cap); if ((j < i) ^ (k <= i) ^ (k > j)) /* is k outside (i, j]? */ _slot[i] = _slot[j], _hashx[i] = _hashx[j], i = j; } diff --git a/include/stc/template.h b/include/stc/template.h index cd47a989..b7583e82 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -25,9 +25,9 @@ #ifndef STC_TEMPLATE_H_INCLUDED #define STC_TEMPLATE_H_INCLUDED - #define _cx_self c_paste(_i_prefix, i_tag) - #define _cx_memb(name) c_paste(_cx_self, name) - #define _cx_deftypes(macro, SELF, ...) c_expand(macro(SELF, __VA_ARGS__)) + #define _cx_self c_PASTE(_i_prefix, i_tag) + #define _cx_memb(name) c_PASTE(_cx_self, name) + #define _cx_deftypes(macro, SELF, ...) c_EXPAND(macro(SELF, __VA_ARGS__)) #define _cx_value _cx_memb(_value) #define _cx_key _cx_memb(_key) #define _cx_mapped _cx_memb(_mapped) @@ -120,10 +120,10 @@ #endif #elif defined i_keyboxed #define i_keyclass i_keyboxed - #define i_rawclass c_paste(i_keyboxed, _raw) - #define i_keyfrom c_paste(i_keyboxed, _from) + #define i_rawclass c_PASTE(i_keyboxed, _raw) + #define i_keyfrom c_PASTE(i_keyboxed, _from) #ifndef i_no_eq - #define i_eq c_paste(i_keyboxed, _raw_eq) + #define i_eq c_PASTE(i_keyboxed, _raw_eq) #endif #endif @@ -136,22 +136,22 @@ #ifdef i_keyclass #define i_key i_keyclass #ifndef i_keyclone - #define i_keyclone c_paste(i_key, _clone) + #define i_keyclone c_PASTE(i_key, _clone) #endif #if !defined i_keyto && defined i_keyraw - #define i_keyto c_paste(i_key, _toraw) + #define i_keyto c_PASTE(i_key, _toraw) #endif #ifndef i_keydrop - #define i_keydrop c_paste(i_key, _drop) + #define i_keydrop c_PASTE(i_key, _drop) #endif #endif #ifdef i_rawclass #if !defined i_cmp && !defined i_no_cmp - #define i_cmp c_paste(i_keyraw, _cmp) + #define i_cmp c_PASTE(i_keyraw, _cmp) #endif #if !defined i_hash && !defined i_no_hash - #define i_hash c_paste(i_keyraw, _hash) + #define i_hash c_PASTE(i_keyraw, _hash) #endif #endif @@ -223,20 +223,20 @@ #define i_valto cstr_sv #elif defined i_valboxed #define i_valclass i_valboxed - #define i_valraw c_paste(i_valboxed, _raw) - #define i_valfrom c_paste(i_valboxed, _from) + #define i_valraw c_PASTE(i_valboxed, _raw) + #define i_valfrom c_PASTE(i_valboxed, _from) #endif #ifdef i_valclass #define i_val i_valclass #ifndef i_valclone - #define i_valclone c_paste(i_val, _clone) + #define i_valclone c_PASTE(i_val, _clone) #endif #if !defined i_valto && defined i_valraw - #define i_valto c_paste(i_val, _toraw) + #define i_valto c_PASTE(i_val, _toraw) #endif #ifndef i_valdrop - #define i_valdrop c_paste(i_val, _drop) + #define i_valdrop c_PASTE(i_val, _drop) #endif #endif |
