summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cvec.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-12 16:45:30 +0200
committerTyge Løvset <[email protected]>2022-08-12 16:45:30 +0200
commit5f8a7951996728f6e91ef9ae2e904ce51ac0c883 (patch)
tree6dead0993749de94f7848afa927c0ff83c326d80 /include/stc/cvec.h
parenta417e5affc99233abb6dbb685154bfdea1b726e3 (diff)
downloadSTC-modified-5f8a7951996728f6e91ef9ae2e904ce51ac0c883.tar.gz
STC-modified-5f8a7951996728f6e91ef9ae2e904ce51ac0c883.zip
Renamed cdeq/cvec *_range() functions again (revert). Call alloc macros in cregex.
Diffstat (limited to 'include/stc/cvec.h')
-rw-r--r--include/stc/cvec.h56
1 files changed, 29 insertions, 27 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index a7828708..c734abb6 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -84,9 +84,9 @@ STC_API bool _cx_memb(_reserve)(_cx_self* self, size_t cap);
STC_API bool _cx_memb(_resize)(_cx_self* self, size_t size, i_key null);
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_iter _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
-STC_API _cx_iter _cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n);
+STC_API _cx_iter _cx_memb(_insert_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2);
+STC_API _cx_iter _cx_memb(_insert_uninit)(_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);
@@ -94,33 +94,33 @@ STC_API _cx_iter _cx_memb(_binary_search_in)(_cx_iter it1, _cx_iter it2,
#endif
#if !defined _i_no_emplace
-STC_API _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_raw* p1, const _cx_raw* p2);
+STC_API _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos,
+ const _cx_raw* p1, const _cx_raw* p2);
STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_keyfrom(raw)); }
STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_keyfrom(raw)); }
STC_INLINE _cx_iter
_cx_memb(_emplace_n)(_cx_self* self, const size_t idx, const _cx_raw arr[], const size_t n) {
- return _cx_memb(_emplace_range_p)(self, self->data + idx, arr, arr + n);
+ return _cx_memb(_emplace_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) {
- return _cx_memb(_emplace_range_p)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
+ return _cx_memb(_emplace_range)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
}
#endif // !_i_no_emplace
#if !defined _i_no_clone
STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
-STC_API _cx_iter _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
+STC_API _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2);
STC_INLINE i_key _cx_memb(_value_clone)(_cx_value val)
{ return i_keyclone(val); }
STC_INLINE void _cx_memb(_copy)(_cx_self* self, const _cx_self* other) {
if (self->data == other->data) return;
_cx_memb(_clear)(self);
- _cx_memb(_copy_range_p)(self, self->data, other->data,
- other->data + cvec_rep_(other)->size);
+ _cx_memb(_copy_range)(self, self->data, other->data,
+ other->data + cvec_rep_(other)->size);
}
#endif // !_i_no_clone
@@ -160,15 +160,15 @@ _cx_memb(_shrink_to_fit)(_cx_self* self) {
STC_INLINE _cx_iter
_cx_memb(_insert)(_cx_self* self, const size_t idx, i_key value) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, self->data + idx, &value, &value + 1);
}
STC_INLINE _cx_iter
_cx_memb(_insert_n)(_cx_self* self, const size_t idx, const _cx_value arr[], const size_t n) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, arr, arr + n);
+ return _cx_memb(_insert_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_insert_at)(_cx_self* self, _cx_iter it, i_key value) {
- return _cx_memb(_insert_range_p)(self, it.ref, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, it.ref, &value, &value + 1);
}
STC_INLINE _cx_iter
@@ -291,7 +291,8 @@ _cx_memb(_reserve)(_cx_self* self, const size_t cap) {
const size_t len = rep->size;
if (cap > rep->cap || (cap && cap == len)) {
rep = (struct cvec_rep*) c_realloc(rep->cap ? rep : NULL,
- offsetof(struct cvec_rep, data) + cap*sizeof(i_key));
+ offsetof(struct cvec_rep, data)
+ + cap*sizeof(i_key));
if (!rep)
return false;
self->data = (_cx_value*) rep->data;
@@ -328,7 +329,7 @@ _cx_memb(_push)(_cx_self* self, i_key value) {
}
STC_DEF _cx_iter
-_cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
+_cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n) {
struct cvec_rep* r = cvec_rep_(self);
if (n) {
if (!pos) pos = self->data + r->size;
@@ -346,9 +347,9 @@ _cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
}
STC_DEF _cx_iter
-_cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_insert_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
memcpy(it.ref, p1, (p2 - p1)*sizeof *p1);
return it;
@@ -373,14 +374,14 @@ _cx_memb(_clone)(_cx_self cx) {
const size_t len = cvec_rep_(&cx)->size;
_cx_self out = _cx_memb(_with_capacity)(len);
if (cvec_rep_(&out)->cap)
- _cx_memb(_copy_range_p)(&out, out.data, cx.data, cx.data + len);
+ _cx_memb(_copy_range)(&out, out.data, cx.data, cx.data + len);
return out;
}
STC_DEF _cx_iter
-_cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyclone((*p1));
@@ -390,9 +391,9 @@ _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
#if !defined _i_no_emplace
STC_DEF _cx_iter
-_cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_raw* p1, const _cx_raw* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos,
+ const _cx_raw* p1, const _cx_raw* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyfrom((*p1));
@@ -413,7 +414,8 @@ _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, _cx_raw raw) {
}
STC_DEF _cx_iter
-_cx_memb(_binary_search_in)(_cx_iter i1, _cx_iter i2, const _cx_raw raw, _cx_iter* lower_bound) {
+_cx_memb(_binary_search_in)(_cx_iter i1, _cx_iter i2, const _cx_raw raw,
+ _cx_iter* lower_bound) {
const _cx_value* p2 = i2.ref ? i2.ref : i2.end;
_cx_iter mid = i1;
while (i1.ref != p2) {