summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-06-21 13:42:05 +0200
committerTyge Løvset <[email protected]>2022-06-21 13:47:45 +0200
commit161622453ad44a29dc52f496c2d721d41255e45f (patch)
tree816bda8a79aae5ee404e76751830fb292eb0328a /include
parentc7e46d06e90483db30bcccce0a0f1d709661c5fc (diff)
downloadSTC-modified-161622453ad44a29dc52f496c2d721d41255e45f.tar.gz
STC-modified-161622453ad44a29dc52f496c2d721d41255e45f.zip
Renamed expand_uninit() functions to insert_uninit() / append_uninit().
Diffstat (limited to 'include')
-rw-r--r--include/stc/alt/cstr.h2
-rw-r--r--include/stc/cdeq.h8
-rw-r--r--include/stc/cstack.h2
-rw-r--r--include/stc/cstr.h11
-rw-r--r--include/stc/cvec.h14
5 files changed, 19 insertions, 18 deletions
diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h
index 8b0362d2..77067740 100644
--- a/include/stc/alt/cstr.h
+++ b/include/stc/alt/cstr.h
@@ -136,7 +136,7 @@ STC_INLINE cstr cstr_with_size(const size_t len, const char fill) {
return s;
}
-STC_INLINE char* cstr_expand_uninit(cstr *self, size_t n) {
+STC_INLINE char* cstr_append_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/cdeq.h b/include/stc/cdeq.h
index afe01165..9c706e52 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -344,7 +344,7 @@ _cx_memb(_expand_left_half_)(_cx_self* self, const size_t idx, const size_t n) {
}
static _cx_value*
-_cx_memb(_expand_uninit_p)(_cx_self* self, const _cx_value* pos, const size_t n) {
+_cx_memb(_insert_uninit_p)(_cx_self* self, const _cx_value* pos, const size_t n) {
const size_t idx = pos - self->data;
if (idx*2 < cdeq_rep_(self)->size)
_cx_memb(_expand_left_half_)(self, idx, n);
@@ -369,7 +369,7 @@ _cx_memb(_push_front)(_cx_self* self, i_key value) {
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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
if (pos)
memcpy(pos, p1, (p2 - p1)*sizeof *p1);
return pos;
@@ -393,7 +393,7 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) {
#if !defined _i_no_emplace
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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
_cx_value* it = pos;
if (pos) for (; p1 != p2; ++p1)
*pos++ = i_keyfrom((*p1));
@@ -404,7 +404,7 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, co
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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
_cx_value* it = pos;
if (pos) for (; p1 != p2; ++p1)
*pos++ = i_keyclone((*p1));
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 52137d33..b9cff196 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_uninit)(_cx_self *self, size_t n) {
+_cx_memb(_append_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 9b872bd0..00912576 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -218,11 +218,12 @@ STC_INLINE void cstr_next(cstr_iter* it) {
STC_INLINE void cstr_clear(cstr* self)
{ _cstr_set_size(self, 0); }
-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);
- return d + len;
+STC_INLINE char* cstr_append_uninit(cstr *self, size_t len) {
+ size_t sz = cstr_size(*self);
+ char* d = cstr_reserve(self, sz + len);
+ if (!d) return NULL;
+ _cstr_set_size(self, sz + len);
+ return d + sz;
}
STC_INLINE int cstr_cmp(const cstr* s1, const cstr* s2)
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index cd9c8f9e..77462a30 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_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n);
+STC_API _cx_value* _cx_memb(_insert_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, _cx_raw raw);
@@ -168,8 +168,8 @@ _cx_memb(_shrink_to_fit)(_cx_self *self) {
}
STC_INLINE _cx_value*
-_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);
+_cx_memb(_append_uninit)(_cx_self *self, const size_t n) {
+ return _cx_memb(_insert_uninit_p)(self, self->data + _cx_memb(_size)(*self), n);
}
STC_INLINE _cx_value*
@@ -325,7 +325,7 @@ _cx_memb(_push)(_cx_self* self, i_key value) {
}
STC_DEF _cx_value*
-_cx_memb(_expand_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
+_cx_memb(_insert_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)
@@ -344,7 +344,7 @@ _cx_memb(_expand_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
if (pos)
memcpy(pos, p1, (p2 - p1)*sizeof *p1);
return pos;
@@ -376,7 +376,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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
_cx_value* it = pos;
if (pos) for (; p1 != p2; ++p1)
*pos++ = i_keyclone((*p1));
@@ -387,7 +387,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_uninit_p)(self, pos, p2 - p1);
+ pos = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
_cx_value* it = pos;
if (pos) for (; p1 != p2; ++p1)
*pos++ = i_keyfrom((*p1));