From 36c3ddf82fa47f2718b9782e1a7586f477c1a0db Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Thu, 13 Jan 2022 15:45:28 +0100 Subject: Fix a potential compilation bug in cbox/carc. --- examples/list_erase.c | 6 ++++-- include/stc/carc.h | 8 ++++---- include/stc/cbox.h | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/list_erase.c b/examples/list_erase.c index b20f3fb1..1e5d2e9b 100644 --- a/examples/list_erase.c +++ b/examples/list_erase.c @@ -9,7 +9,8 @@ int main () c_auto (clist_int, L) { c_apply(i, clist_int_push_back(&L, i), int, {10, 20, 30, 40, 50}); - c_foreach (x, clist_int, L) printf("%d ", *x.ref); + c_foreach (x, clist_int, L) + printf("%d ", *x.ref); puts(""); // 10 20 30 40 50 clist_int_iter it = clist_int_begin(&L); // ^ @@ -21,7 +22,8 @@ int main () it = clist_int_erase_range(&L, it, end); // 10 30 // ^ printf("list contains:"); - c_foreach (x, clist_int, L) printf(" %d", *x.ref); + c_foreach (x, clist_int, L) + printf(" %d", *x.ref); puts(""); } } diff --git a/include/stc/carc.h b/include/stc/carc.h index ccb23a73..9c7d52c1 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -145,7 +145,7 @@ _cx_memb(_reset_from)(_cx_self* self, i_val val) { } #if !c_option(c_no_clone) && !defined _i_no_raw - STC_INLINE _cx_self _cx_memb(_new)(i_valraw raw) { + STC_INLINE _cx_self _cx_memb(_new)(_cx_raw raw) { return _cx_memb(_from)(i_valfrom(raw)); } #endif @@ -177,7 +177,7 @@ _cx_memb(_value_hash)(const _cx_value* x, size_t n) { #elif c_option(c_no_cmp) return c_hash32(&x, 4); #else - i_valraw rx = i_valto(x); + _cx_raw rx = i_valto(x); return i_hash(&rx, sizeof rx); #endif } @@ -187,7 +187,7 @@ _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #if c_option(c_no_cmp) return c_default_cmp(&x, &y); #else - i_valraw rx = i_valto(x), ry = i_valto(x); + _cx_raw rx = i_valto(x), ry = i_valto(x); return i_cmp(&rx, &ry); #endif } @@ -197,7 +197,7 @@ _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) { #if c_option(c_no_cmp) return x == y; #else - i_valraw rx = i_valto(x), ry = i_valto(x); + _cx_raw rx = i_valto(x), ry = i_valto(x); return i_eq(&rx, &ry); #endif } diff --git a/include/stc/cbox.h b/include/stc/cbox.h index 5eb1f1e3..41d8f654 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -121,7 +121,7 @@ _cx_memb(_reset_from)(_cx_self* self, i_val val) { #if !c_option(c_no_clone) #if !defined _i_no_raw STC_INLINE _cx_self - _cx_memb(_new)(i_valraw raw) { + _cx_memb(_new)(_cx_raw raw) { return c_make(_cx_self){c_new(i_val, i_valfrom(raw))}; } #endif @@ -153,7 +153,7 @@ _cx_memb(_value_hash)(const _cx_value* x, size_t n) { #elif c_option(c_no_cmp) return c_hash32(&x, 4); #else - i_valraw rx = i_valto(x); + _cx_raw rx = i_valto(x); return i_hash(&rx, sizeof rx); #endif } @@ -163,7 +163,7 @@ _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #if c_option(c_no_cmp) return c_default_cmp(&x, &y); #else - i_valraw rx = i_valto(x), ry = i_valto(x); + _cx_raw rx = i_valto(x), ry = i_valto(x); return i_cmp(&rx, &ry); #endif } @@ -173,7 +173,7 @@ _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) { #if c_option(c_no_cmp) return x == y; #else - i_valraw rx = i_valto(x), ry = i_valto(x); + _cx_raw rx = i_valto(x), ry = i_valto(x); return i_eq(&rx, &ry); #endif } -- cgit v1.2.3