From 649060e1275f04985ded4b324ae8e2b004788e78 Mon Sep 17 00:00:00 2001 From: Tyge Lovset Date: Tue, 10 May 2022 08:58:04 +0200 Subject: Renamed (newish) functions expand_uninitialized to expand_uninit. + some minor changes. --- include/stc/alt/csmap.h | 6 ++++-- include/stc/alt/cstr.h | 2 +- include/stc/csmap.h | 6 ++++-- include/stc/cstack.h | 2 +- include/stc/cstr.h | 2 +- include/stc/cvec.h | 14 +++++++------- 6 files changed, 18 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/stc/alt/csmap.h b/include/stc/alt/csmap.h index b7c4fe39..1e6f1836 100644 --- a/include/stc/alt/csmap.h +++ b/include/stc/alt/csmap.h @@ -448,9 +448,11 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2) { for (;;) { if (memcmp(&k1, &k2, sizeof k1) == 0) return it1; - _cx_memb(_next)(&it1); k1 = *_i_keyref(it1.ref); + _cx_memb(_next)(&it1); + k1 = *_i_keyref(it1.ref); _cx_memb(_erase)(self, r1); - _cx_memb(_find_it)(self, (r1 = i_keyto((&k1))), &it1); + r1 = i_keyto((&k1)); + _cx_memb(_find_it)(self, r1, &it1); } } diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h index 98f5c8f5..ef116ade 100644 --- a/include/stc/alt/cstr.h +++ b/include/stc/alt/cstr.h @@ -137,7 +137,7 @@ STC_INLINE cstr cstr_with_size(const size_t len, const char fill) { return s; } -STC_INLINE char* cstr_expand_uninitialized(cstr *self, size_t n) { +STC_INLINE char* cstr_expand_uninit(cstr *self, size_t n) { size_t len = cstr_size(*self); char* d; if (!(d = cstr_reserve(self, len + n))) return NULL; _cstr_p(self)->size += n; diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 405ca5bb..d1db9031 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -522,9 +522,11 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2) { for (;;) { if (memcmp(&k1, &k2, sizeof k1) == 0) return it1; - _cx_memb(_next)(&it1); k1 = *_i_keyref(it1.ref); + _cx_memb(_next)(&it1); + k1 = *_i_keyref(it1.ref); _cx_memb(_erase)(self, r1); - _cx_memb(_find_it)(self, (r1 = i_keyto((&k1))), &it1); + r1 = i_keyto((&k1)); + _cx_memb(_find_it)(self, r1, &it1); } } diff --git a/include/stc/cstack.h b/include/stc/cstack.h index 3705c247..61d69f0c 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -78,7 +78,7 @@ STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { } STC_INLINE _cx_value* -_cx_memb(_expand_uninitialized)(_cx_self *self, size_t n) { +_cx_memb(_expand_uninit)(_cx_self *self, size_t n) { size_t len = self->size; if (!_cx_memb(_reserve)(self, len + n)) return NULL; self->size += n; diff --git a/include/stc/cstr.h b/include/stc/cstr.h index dadb6ee5..959714d1 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -174,7 +174,7 @@ STC_INLINE size_t cstr_length(cstr s) STC_INLINE size_t cstr_capacity(cstr s) { return cstr_is_long(&s) ? cstr_l_cap(&s) : cstr_s_cap; } -STC_INLINE char* cstr_expand_uninitialized(cstr *self, size_t n) { +STC_INLINE char* cstr_expand_uninit(cstr *self, size_t n) { size_t len = cstr_size(*self); char* d; if (!(d = cstr_reserve(self, len + n))) return NULL; _cstr_set_size(self, len + n); diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 83c8680d..488fa9cb 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -86,7 +86,7 @@ STC_API _cx_value* _cx_memb(_push)(_cx_self* self, i_key value); STC_API _cx_iter _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2); STC_API _cx_value* _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2); -STC_API _cx_value* _cx_memb(_expand_uninitialized_at_p)(_cx_self* self, _cx_value* pos, const size_t n); +STC_API _cx_value* _cx_memb(_expand_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n); #if !c_option(c_no_cmp) STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y); STC_API _cx_iter _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, i_keyraw raw); @@ -169,8 +169,8 @@ _cx_memb(_shrink_to_fit)(_cx_self *self) { } STC_INLINE _cx_value* -_cx_memb(_expand_uninitialized)(_cx_self *self, const size_t n) { - return _cx_memb(_expand_uninitialized_at_p)(self, self->data + _cx_memb(_size)(*self), n); +_cx_memb(_expand_uninit)(_cx_self *self, const size_t n) { + return _cx_memb(_expand_uninit_p)(self, self->data + _cx_memb(_size)(*self), n); } STC_INLINE _cx_value* @@ -321,7 +321,7 @@ _cx_memb(_push)(_cx_self* self, i_key value) { } STC_DEF _cx_value* -_cx_memb(_expand_uninitialized_at_p)(_cx_self* self, _cx_value* pos, const size_t n) { +_cx_memb(_expand_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) { const size_t idx = pos - self->data; struct cvec_rep* r = cvec_rep_(self); if (!n) return pos; @@ -339,7 +339,7 @@ _cx_memb(_expand_uninitialized_at_p)(_cx_self* self, _cx_value* pos, const size_ STC_DEF _cx_value* _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2) { - pos = _cx_memb(_expand_uninitialized_at_p)(self, pos, p2 - p1); + pos = _cx_memb(_expand_uninit_p)(self, pos, p2 - p1); if (pos) memcpy(pos, p1, (p2 - p1)*sizeof *p1); return pos; } @@ -369,7 +369,7 @@ _cx_memb(_clone)(_cx_self cx) { STC_DEF _cx_value* _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2) { - pos = _cx_memb(_expand_uninitialized_at_p)(self, pos, p2 - p1); + pos = _cx_memb(_expand_uninit_p)(self, pos, p2 - p1); _cx_value* it = pos; if (pos) for (; p1 != p2; ++p1) *pos++ = i_keyclone((*p1)); @@ -380,7 +380,7 @@ _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos, STC_DEF _cx_value* _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2) { - pos = _cx_memb(_expand_uninitialized_at_p)(self, pos, p2 - p1); + pos = _cx_memb(_expand_uninit_p)(self, pos, p2 - p1); _cx_value* it = pos; if (pos) for (; p1 != p2; ++p1) *pos++ = i_keyfrom((*p1)); -- cgit v1.2.3