From 0c3d711c2541aebe9a44fecb732e096bed14f72c Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 19 Dec 2021 21:39:25 +0100 Subject: Global rename of `_equ\b` => `_eq`. In practice `i_equ` must renamed to `i_eq` in user code if used. --- include/stc/alt/cstr.h | 2 +- include/stc/cbox.h | 2 +- include/stc/ccommon.h | 12 ++++++------ include/stc/cmap.h | 2 +- include/stc/csptr.h | 2 +- include/stc/cstr.h | 6 +++--- include/stc/csview.h | 2 +- include/stc/template.h | 24 ++++++++++++------------ 8 files changed, 26 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h index bd135b7e..1a9280e8 100644 --- a/include/stc/alt/cstr.h +++ b/include/stc/alt/cstr.h @@ -167,7 +167,7 @@ STC_INLINE bool cstr_equals_s(cstr s1, cstr s2) { return strcmp(cstr_str(&s1), cstr_str(&s2)) == 0; } -STC_INLINE bool cstr_equalto(const cstr* s1, const cstr* s2) { +STC_INLINE bool cstr_eq(const cstr* s1, const cstr* s2) { return strcmp(cstr_str(s1), cstr_str(s2)) == 0; } diff --git a/include/stc/cbox.h b/include/stc/cbox.h index 51bc81a4..764761fe 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -171,7 +171,7 @@ _cx_memb(_cmp)(const _cx_self* x, const _cx_self* y) { } STC_INLINE bool -_cx_memb(_equalto)(const _cx_self* x, const _cx_self* y) { +_cx_memb(_eq)(const _cx_self* x, const _cx_self* y) { return !_cx_memb(_cmp)(x, y); } #include "template.h" diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index d3664077..9cbe24a4 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -100,8 +100,8 @@ typedef const char c_strlit[]; #define c_default_less(x, y) (*(x) < *(y)) #define c_default_cmp(x, y) c_less_cmp(c_default_less, x, y) -#define c_default_equalto(x, y) (*(x) == *(y)) -#define c_memcmp_equalto(x, y) (memcmp(x, y, sizeof *(x)) == 0) +#define c_default_eq(x, y) (*(x) == *(y)) +#define c_memcmp_eq(x, y) (memcmp(x, y, sizeof *(x)) == 0) #define c_default_clone(x) (x) #define c_default_fromraw(x) (x) // [deprecated] @@ -118,11 +118,11 @@ typedef const char c_strlit[]; typedef char* c_mutstr; typedef const char* c_rawstr; -#define c_rawstr_cmp(x, y) strcmp(*(x), *(y)) -#define c_rawstr_equalto(x, y) (strcmp(*(x), *(y)) == 0) -#define c_rawstr_hash(x, dummy) c_strhash(*(x)) +#define c_rawstr_cmp(xp, yp) strcmp(*(xp), *(yp)) +#define c_rawstr_eq(xp, yp) (!strcmp(*(xp), *(yp))) +#define c_rawstr_hash(p, dummy) c_strhash(*(p)) #define c_rawstr_clone(s) strcpy((char*)c_malloc(strlen(s) + 1), s) -#define c_rawstr_drop(x) c_free((char *) &**(x)) +#define c_rawstr_drop(p) c_free((char *) &**(p)) #define _c_ROTL(x, k) (x << (k) | x >> (8*sizeof(x) - (k))) diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 10e9c586..c78c2472 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -293,7 +293,7 @@ _cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr) { while ((_hx = _hashx[b.idx])) { if (_hx == b.hx) { _cx_rawkey _raw = i_keyto(_i_keyref(self->table + b.idx)); - if (i_equ(&_raw, rkeyptr)) break; + if (i_eq(&_raw, rkeyptr)) break; } if (++b.idx == _cap) b.idx = 0; } diff --git a/include/stc/csptr.h b/include/stc/csptr.h index b66cd4d7..cf1a5b12 100644 --- a/include/stc/csptr.h +++ b/include/stc/csptr.h @@ -204,7 +204,7 @@ _cx_memb(_cmp)(const _cx_self* x, const _cx_self* y) { } STC_INLINE bool -_cx_memb(_equalto)(const _cx_self* x, const _cx_self* y) { +_cx_memb(_eq)(const _cx_self* x, const _cx_self* y) { return !_cx_memb(_cmp)(x, y); } #undef _i_atomic_inc diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 730f4d16..cfb2dfef 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -167,9 +167,9 @@ cstr_ends_with(cstr s, const char* sub) { } /* container adaptor functions: */ -#define cstr_cmp(xp, yp) strcmp((xp)->str, (yp)->str) -#define cstr_equalto(xp, yp) (strcmp((xp)->str, (yp)->str) == 0) -#define cstr_hash(xp, dummy) c_strhash((xp)->str) +#define cstr_cmp(xp, yp) strcmp((xp)->str, (yp)->str) +#define cstr_eq(xp, yp) (!cstr_cmp(xp, yp)) +#define cstr_hash(xp, dummy) c_strhash((xp)->str) /* -------------------------- IMPLEMENTATION ------------------------- */ diff --git a/include/stc/csview.h b/include/stc/csview.h index ac120e15..d0152c3d 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -120,7 +120,7 @@ STC_INLINE int csview_cmp(const csview* x, const csview* y) { return c ? c : x->size - y->size; } #define csview_hash(xp, dummy) c_strhash((xp)->str) -#define csview_equalto(xp, yp) (csview_cmp(xp, yp) == 0) +#define csview_eq(xp, yp) (!csview_cmp(xp, yp)) /* -------------------------- IMPLEMENTATION ------------------------- */ diff --git a/include/stc/template.h b/include/stc/template.h index 61befb2b..83a362d7 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -48,9 +48,9 @@ #define i_val_bind i_val_csptr #error "i_val_sptr/ref no longer supported: use new name i_val_bind" #endif -#ifdef i_cnt // [deprecated] +#if defined i_cnt || defined i_equ // [deprecated] #define i_type i_cnt - #error "i_cnt no longer supported: use new name i_type" + #error "i_cnt and i_equ no longer supported: use new name i_type / i_eq" #endif #ifdef i_type @@ -88,8 +88,8 @@ #ifndef i_cmp #define i_cmp c_PASTE(i_keyraw, _cmp) #endif - #ifndef i_equ - #define i_equ c_PASTE(i_keyraw, _equalto) + #ifndef i_eq + #define i_eq c_PASTE(i_keyraw, _eq) #endif #ifndef i_hash #define i_hash c_PASTE(i_keyraw, _hash) @@ -170,10 +170,10 @@ #define i_keyraw i_key #define i_keyto c_default_toraw #endif - #if !defined i_equ && defined i_cmp - #define i_equ !i_cmp - #elif !defined i_equ - #define i_equ c_default_equalto + #if !defined i_eq && defined i_cmp + #define i_eq !i_cmp + #elif !defined i_eq + #define i_eq c_default_eq #endif #ifndef i_keydrop #define i_keydrop c_default_drop @@ -212,26 +212,26 @@ #undef i_imp #undef i_opt #undef i_cmp -#undef i_drop -#undef i_equ +#undef i_eq #undef i_hash #undef i_from +#undef i_drop #undef i_val #undef i_val_str #undef i_val_bind -#undef i_valdrop #undef i_valraw #undef i_valfrom #undef i_valto +#undef i_valdrop #undef i_key #undef i_key_str #undef i_key_bind -#undef i_keydrop #undef i_keyraw #undef i_keyfrom #undef i_keyto +#undef i_keydrop #undef _i_prefix #undef _i_has_internal_clone -- cgit v1.2.3