summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-31 13:26:04 +0100
committerTyge Løvset <[email protected]>2023-01-31 13:41:33 +0100
commita24ecd6bbfffc2e0b75b8ed48fcb5306d367ad3e (patch)
treea9231182b09e139af14920dc6701dded80761793 /include
parent5bbcae2a3add163ea3b7a91d65fda6836c18f410 (diff)
downloadSTC-modified-a24ecd6bbfffc2e0b75b8ed48fcb5306d367ad3e.tar.gz
STC-modified-a24ecd6bbfffc2e0b75b8ed48fcb5306d367ad3e.zip
Reverted c_MALLOC, c_CALLOC, c_REALLOC and c_FREE to lowercase.
Diffstat (limited to 'include')
-rw-r--r--include/stc/carc.h4
-rw-r--r--include/stc/cbits.h10
-rw-r--r--include/stc/cbox.h2
-rw-r--r--include/stc/ccommon.h55
-rw-r--r--include/stc/cdeq.h6
-rw-r--r--include/stc/clist.h2
-rw-r--r--include/stc/cmap.h14
-rw-r--r--include/stc/cpque.h4
-rw-r--r--include/stc/csmap.h4
-rw-r--r--include/stc/cstack.h10
-rw-r--r--include/stc/cstr.h12
-rw-r--r--include/stc/cvec.h4
-rw-r--r--include/stc/priv/altnames.h4
13 files changed, 60 insertions, 71 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index 4f55aefb..5bf4ebc2 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -127,8 +127,8 @@ STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
if (self->use_count && _i_atomic_dec_and_test(self->use_count)) {
i_keydrop(self->get);
if ((char *)self->get != (char *)self->use_count + offsetof(struct _cx_memb(_rep_), value))
- c_FREE(self->get);
- c_FREE((long*)self->use_count);
+ c_free(self->get);
+ c_free((long*)self->use_count);
}
}
diff --git a/include/stc/cbits.h b/include/stc/cbits.h
index 232be16b..41ee1713 100644
--- a/include/stc/cbits.h
+++ b/include/stc/cbits.h
@@ -125,7 +125,7 @@ struct { uint64_t *data64; size_t _size; } typedef i_type;
STC_INLINE cbits cbits_init(void) { return c_LITERAL(cbits){NULL}; }
STC_INLINE void cbits_create(cbits* self) { self->data64 = NULL; self->_size = 0; }
-STC_INLINE void cbits_drop(cbits* self) { c_FREE(self->data64); }
+STC_INLINE void cbits_drop(cbits* self) { c_free(self->data64); }
STC_INLINE size_t cbits_size(const cbits* self) { return self->_size; }
STC_INLINE cbits* cbits_take(cbits* self, cbits other) {
@@ -138,7 +138,7 @@ STC_INLINE cbits* cbits_take(cbits* self, cbits other) {
STC_INLINE cbits cbits_clone(cbits other) {
const size_t bytes = _cbits_bytes(other._size);
- cbits set = {(uint64_t *)memcpy(c_MALLOC(bytes), other.data64, bytes), other._size};
+ cbits set = {(uint64_t *)memcpy(c_malloc(bytes), other.data64, bytes), other._size};
return set;
}
@@ -153,7 +153,7 @@ STC_INLINE cbits* cbits_copy(cbits* self, const cbits* other) {
STC_INLINE void cbits_resize(cbits* self, const size_t size, const bool value) {
const size_t new_n = _cbits_words(size), osize = self->_size, old_n = _cbits_words(osize);
- self->data64 = (uint64_t *)c_REALLOC(self->data64, new_n*8);
+ self->data64 = (uint64_t *)c_realloc(self->data64, new_n*8);
self->_size = size;
if (new_n >= old_n) {
memset(self->data64 + old_n, -(int)value, (new_n - old_n)*8);
@@ -175,13 +175,13 @@ STC_INLINE cbits cbits_move(cbits* self) {
}
STC_INLINE cbits cbits_with_size(const size_t size, const bool value) {
- cbits set = {(uint64_t *)c_MALLOC(_cbits_bytes(size)), size};
+ cbits set = {(uint64_t *)c_malloc(_cbits_bytes(size)), size};
cbits_set_all(&set, value);
return set;
}
STC_INLINE cbits cbits_with_pattern(const size_t size, const uint64_t pattern) {
- cbits set = {(uint64_t *)c_MALLOC(_cbits_bytes(size)), size};
+ cbits set = {(uint64_t *)c_malloc(_cbits_bytes(size)), size};
cbits_set_pattern(&set, pattern);
return set;
}
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index 0b6c29ec..4f0a2976 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -100,7 +100,7 @@ STC_INLINE _cx_raw _cx_memb(_toraw)(const _cx_self* self)
STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
if (self->get) {
i_keydrop(self->get);
- c_FREE(self->get);
+ c_free(self->get);
}
}
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 7c25d397..39ece500 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -68,51 +68,44 @@
#ifdef __cplusplus
#include <new>
- #define c_ALLOC(T) static_cast<T*>(c_MALLOC(sizeof(T)))
- #define c_ALLOC_N(T, n) static_cast<T*>(c_MALLOC(sizeof(T)*(n)))
+ #define c_ALLOC(T) static_cast<T*>(c_malloc(c_sizeof(T)))
+ #define c_ALLOC_N(T, n) static_cast<T*>(c_malloc(c_sizeof(T)*(n)))
#define c_NEW(T, ...) new (c_ALLOC(T)) T(__VA_ARGS__)
#define c_LITERAL(T) T
#else
- #define c_ALLOC(T) ((T*)c_MALLOC(sizeof(T)))
- #define c_ALLOC_N(T, n) ((T*)c_MALLOC(sizeof(T)*(n)))
+ #define c_ALLOC(T) ((T*)c_malloc(c_sizeof(T)))
+ #define c_ALLOC_N(T, n) ((T*)c_malloc(c_sizeof(T)*(n)))
#define c_NEW(T, ...) ((T*)memcpy(c_ALLOC(T), (T[]){__VA_ARGS__}, sizeof(T)))
#define c_LITERAL(T) (T)
#endif
-#ifndef c_MALLOC
- #define c_MALLOC(sz) malloc(sz)
- #define c_CALLOC(n, sz) calloc(n, sz)
- #define c_REALLOC(p, sz) realloc(p, sz)
- #define c_FREE(p) free(p)
-#endif
#ifndef c_malloc
#define c_malloc(sz) malloc(c_i2u(sz))
#define c_calloc(n, sz) calloc(c_i2u(n), c_i2u(sz))
#define c_realloc(p, sz) realloc(p, c_i2u(sz))
#define c_free(p) free(p)
#endif
-
#define c_static_assert(b) ((int)(0*sizeof(int[(b) ? 1 : -1])))
#define c_container_of(p, T, m) ((T*)((char*)(p) + 0*sizeof((p) == &((T*)0)->m) - offsetof(T, m)))
-#define c_delete(T, ptr) do { T *_tp = ptr; T##_drop(_tp); c_FREE(_tp); } while (0)
+#define c_delete(T, ptr) do { T *_tp = ptr; T##_drop(_tp); c_free(_tp); } while (0)
#define c_swap(T, xp, yp) do { T *_xp = xp, *_yp = yp, \
_tv = *_xp; *_xp = *_yp; *_yp = _tv; } while (0)
-#define c_LTu(a, b) ((size_t)(a) < (size_t)(b))
-#define c_u2i(u) ((intptr_t)((u) + 0*sizeof((u) == 1U)))
-#define c_i2u(i) ((size_t)(i) + 0*sizeof((i) == 1))
-#define c_sizeof(x) (intptr_t)sizeof(x)
+#define c_sizeof (intptr_t)sizeof
+#define c_strlen(str) (intptr_t)strlen(str)
+#define c_strncmp(d, s, ilen) strncmp(d, s, c_i2u(ilen))
#define c_memcpy(d, s, ilen) memcpy(d, s, c_i2u(ilen))
#define c_memmove(d, s, ilen) memmove(d, s, c_i2u(ilen))
#define c_memcmp(d, s, ilen) memcmp(d, s, c_i2u(ilen))
-#define c_strlen(str) (intptr_t)strlen(str)
-#define c_strncmp(d, s, ilen) strncmp(d, s, c_i2u(ilen))
+#define c_u2i(u) ((intptr_t)((u) + 0*sizeof((u) == 1U)))
+#define c_i2u(i) ((size_t)(i) + 0*sizeof((i) == 1))
+#define c_LTu(a, b) ((size_t)(a) < (size_t)(b))
// x and y are i_keyraw* type, defaults to i_key*:
#define c_default_cmp(x, y) (c_default_less(y, x) - c_default_less(x, y))
#define c_default_less(x, y) (*(x) < *(y))
#define c_default_eq(x, y) (*(x) == *(y))
#define c_memcmp_eq(x, y) (memcmp(x, y, sizeof *(x)) == 0)
-#define c_default_hash(x) cfasthash(x, sizeof *(x))
+#define c_default_hash(x) cfasthash(x, c_sizeof(*(x)))
#define c_default_clone(v) (v)
#define c_default_toraw(vp) (*(vp))
@@ -131,12 +124,12 @@
/* Function macros and others */
#define c_make(C, ...) \
- C##_from_n((C##_raw[])__VA_ARGS__, sizeof((C##_raw[])__VA_ARGS__)/sizeof(C##_raw))
+ C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
typedef const char* crawstr;
#define crawstr_cmp(xp, yp) strcmp(*(xp), *(yp))
#define crawstr_hash(p) cstrhash(*(p))
-#define crawstr_len(literal) (sizeof("" literal) - 1U)
+#define crawstr_len(literal) (c_sizeof("" literal) - 1)
#define c_ARRAYLEN(a) (intptr_t)(sizeof(a)/sizeof 0[a])
#define c_SV(...) c_MACRO_OVERLOAD(c_SV, __VA_ARGS__)
@@ -147,9 +140,9 @@ typedef const char* crawstr;
#define _c_ROTL(x, k) (x << (k) | x >> (8*sizeof(x) - (k)))
-STC_INLINE uint64_t cfasthash(const void* key, size_t len) {
+STC_INLINE uint64_t cfasthash(const void* key, intptr_t len) {
const uint8_t *x = (const uint8_t*) key;
- uint64_t u8, h = 1; size_t n = len >> 3;
+ uint64_t u8, h = 1; intptr_t n = len >> 3;
uint32_t u4;
while (n--) {
memcpy(&u8, x, 8), x += 8;
@@ -166,15 +159,15 @@ STC_INLINE uint64_t cfasthash(const void* key, size_t len) {
}
STC_INLINE uint64_t cstrhash(const char *str)
- { return cfasthash(str, strlen(str)); }
+ { return cfasthash(str, c_strlen(str)); }
STC_INLINE char* cstrnstrn(const char *str, const char *needle,
- size_t slen, const size_t nlen) {
+ intptr_t slen, const intptr_t nlen) {
if (!nlen) return (char *)str;
if (nlen > slen) return NULL;
slen -= nlen;
do {
- if (*str == *needle && !memcmp(str, needle, nlen))
+ if (*str == *needle && !c_memcmp(str, needle, nlen))
return (char *)str;
++str;
} while (slen--);
@@ -191,7 +184,7 @@ STC_INLINE char* cstrnstrn(const char *str, const char *needle,
; it.ref != (C##_value*)_endref; C##_next(&it))
#define c_FORWHILE(i, C, start, cond) \
- for (struct {C##_iter it; C##_value *ref; size_t index;} \
+ for (struct {C##_iter it; C##_value *ref; intptr_t index;} \
i = {.it=start, .ref=i.it.ref}; i.it.ref && (cond) \
; C##_next(&i.it), i.ref = i.it.ref, ++i.index)
@@ -211,7 +204,7 @@ STC_INLINE char* cstrnstrn(const char *str, const char *needle,
#ifndef __cplusplus
#define c_FORLIST(it, T, ...) \
for (struct {T* data; T* ref; int size, index;} \
- it = {.data=(T[])__VA_ARGS__, .ref=it.data, .size=sizeof((T[])__VA_ARGS__)/sizeof(T)} \
+ it = {.data=(T[])__VA_ARGS__, .ref=it.data, .size=(int)(sizeof((T[])__VA_ARGS__)/sizeof(T))} \
; it.index < it.size; ++it.ref, ++it.index)
#else
#include <initializer_list>
@@ -244,12 +237,12 @@ STC_INLINE char* cstrnstrn(const char *str, const char *needle,
#define c_drop(C, ...) do { c_FORLIST (_i, C*, {__VA_ARGS__}) C##_drop(*_i.ref); } while(0)
#define c_find_if(...) c_MACRO_OVERLOAD(c_find_if, __VA_ARGS__)
#define c_find_if_4(it, C, cnt, pred) do { \
- size_t index = 0; \
+ intptr_t index = 0; \
for (it = C##_begin(&cnt); it.ref && !(pred); C##_next(&it)) \
++index; \
} while (0)
#define c_find_if_5(it, C, start, end, pred) do { \
- size_t index = 0; \
+ intptr_t index = 0; \
const C##_value* _endref = (end).ref; \
for (it = start; it.ref != _endref && !(pred); C##_next(&it)) \
++index; \
@@ -258,7 +251,7 @@ STC_INLINE char* cstrnstrn(const char *str, const char *needle,
#define c_erase_if(it, C, cnt, pred) do { \
C##_iter it = C##_begin(&cnt); \
- for (size_t index = 0; it.ref; ++index) { \
+ for (intptr_t index = 0; it.ref; ++index) { \
if (pred) it = C##_erase_at(&cnt, it); \
else C##_next(&it); \
} \
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index d17182b1..f648547b 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -229,7 +229,7 @@ STC_DEF void
_cx_memb(_shrink_to_fit)(_cx_self *self) {
if (self->_len != self->_cap) {
memmove(self->_base, self->data, self->_len*sizeof(i_key));
- _cx_value* d = (_cx_value*)c_REALLOC(self->_base, self->_len*sizeof(i_key));
+ _cx_value* d = (_cx_value*)c_realloc(self->_base, self->_len*sizeof(i_key));
if (d) {
self->_base = d;
self->_cap = self->_len;
@@ -242,7 +242,7 @@ STC_DEF void
_cx_memb(_drop)(_cx_self* self) {
if (self->_base) {
_cx_memb(_clear)(self);
- c_FREE(self->_base);
+ c_free(self->_base);
}
}
@@ -250,7 +250,7 @@ static size_t
_cx_memb(_realloc_)(_cx_self* self, const size_t n) {
const size_t cap = (size_t)((float)self->_len*1.7f) + n + 7U;
const size_t nfront = _cdeq_nfront(self);
- _cx_value* d = (_cx_value*)c_REALLOC(self->_base, cap*sizeof(i_key));
+ _cx_value* d = (_cx_value*)c_realloc(self->_base, cap*sizeof(i_key));
if (!d)
return 0;
self->_cap = cap;
diff --git a/include/stc/clist.h b/include/stc/clist.h
index fc4d8540..4eac2954 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -348,7 +348,7 @@ STC_DEF void
_cx_memb(_erase_node_after)(_cx_self* self, _cx_node* ref) {
_cx_node* node = _cx_memb(_unlink_node_after)(self, ref);
i_keydrop((&node->value));
- c_FREE(node);
+ c_free(node);
}
STC_DEF _cx_node*
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index 49d7d159..f9cd6986 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -312,8 +312,8 @@ STC_INLINE void _cx_memb(_wipe_)(_cx_self* self) {
STC_DEF void _cx_memb(_drop)(_cx_self* self) {
_cx_memb(_wipe_)(self);
- c_FREE(self->_hashx);
- c_FREE((void *) self->table);
+ c_free(self->_hashx);
+ c_free((void *) self->table);
}
STC_DEF void _cx_memb(_clear)(_cx_self* self) {
@@ -390,9 +390,9 @@ STC_DEF _cx_self
_cx_memb(_clone)(_cx_self m) {
if (m.table) {
_cx_value *t = c_ALLOC_N(_cx_value, m.bucket_count), *dst = t, *m_end = m.table + m.bucket_count;
- uint8_t *h = (uint8_t *)memcpy(c_MALLOC(m.bucket_count + 1), m._hashx, m.bucket_count + 1);
+ uint8_t *h = (uint8_t *)memcpy(c_malloc(m.bucket_count + 1), m._hashx, m.bucket_count + 1);
if (!(t && h))
- { c_FREE(t), c_FREE(h), t = 0, h = 0, m.bucket_count = 0; }
+ { c_free(t), c_free(h), t = 0, h = 0, m.bucket_count = 0; }
else
for (; m.table != m_end; ++m.table, ++m._hashx, ++dst)
if (*m._hashx)
@@ -416,7 +416,7 @@ _cx_memb(_reserve)(_cx_self* self, const size_t _newcap) {
#endif
_cx_self m = {
c_ALLOC_N(_cx_value, _nbuckets),
- (uint8_t *) c_CALLOC(_nbuckets + 1, 1),
+ (uint8_t *) c_calloc(_nbuckets + 1, 1),
self->size, (i_size)_nbuckets,
};
bool ok = m.table && m._hashx;
@@ -432,8 +432,8 @@ _cx_memb(_reserve)(_cx_self* self, const size_t _newcap) {
}
c_swap(_cx_self, self, &m);
}
- c_FREE(m._hashx);
- c_FREE(m.table);
+ c_free(m._hashx);
+ c_free(m.table);
return ok;
}
diff --git a/include/stc/cpque.h b/include/stc/cpque.h
index 8bb70216..59419f16 100644
--- a/include/stc/cpque.h
+++ b/include/stc/cpque.h
@@ -55,7 +55,7 @@ STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, size_t n)
STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, const size_t cap) {
if (cap != self->_len && cap <= self->_cap) return true;
- _cx_value *d = (_cx_value *)c_REALLOC(self->data, cap*sizeof *d);
+ _cx_value *d = (_cx_value *)c_realloc(self->data, cap*sizeof *d);
return d ? (self->data = d, self->_cap = cap, true) : false;
}
@@ -79,7 +79,7 @@ STC_INLINE void _cx_memb(_clear)(_cx_self* self) {
}
STC_INLINE void _cx_memb(_drop)(_cx_self* self)
- { _cx_memb(_clear)(self); c_FREE(self->data); }
+ { _cx_memb(_clear)(self); c_free(self->data); }
STC_INLINE size_t _cx_memb(_size)(const _cx_self* q)
{ return q->_len; }
diff --git a/include/stc/csmap.h b/include/stc/csmap.h
index fba08eba..b92d25d8 100644
--- a/include/stc/csmap.h
+++ b/include/stc/csmap.h
@@ -228,7 +228,7 @@ STC_DEF bool
_cx_memb(_reserve)(_cx_self* self, const size_t cap) {
if (cap <= self->cap)
return false;
- _cx_node* nodes = (_cx_node*)c_REALLOC(self->nodes, (cap + 1)*sizeof(_cx_node));
+ _cx_node* nodes = (_cx_node*)c_realloc(self->nodes, (cap + 1)*sizeof(_cx_node));
if (!nodes)
return false;
nodes[0] = c_LITERAL(_cx_node){{0, 0}, 0};
@@ -578,7 +578,7 @@ STC_DEF void
_cx_memb(_drop)(_cx_self* self) {
if (self->cap) {
_cx_memb(_drop_r_)(self->nodes, self->root);
- c_FREE(self->nodes);
+ c_free(self->nodes);
}
}
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 2a4d620d..69ea6f0c 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -59,12 +59,12 @@ STC_INLINE void _cx_memb(_create)(_cx_self* self)
{ self->_len = 0; self->_cap = 0; self->data = NULL; }
STC_INLINE _cx_self _cx_memb(_with_capacity)(size_t cap) {
- _cx_self out = {(_cx_value *) c_MALLOC(cap*sizeof(i_key)), 0, cap};
+ _cx_self out = {(_cx_value *) c_malloc(cap*sizeof(i_key)), 0, cap};
return out;
}
STC_INLINE _cx_self _cx_memb(_with_size)(size_t size, i_key null) {
- _cx_self out = {(_cx_value *) c_MALLOC(size*sizeof null), size, size};
+ _cx_self out = {(_cx_value *) c_malloc(size*sizeof null), size, size};
while (size) out.data[--size] = null;
return out;
}
@@ -79,7 +79,7 @@ STC_INLINE void _cx_memb(_clear)(_cx_self* self) {
STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
_cx_memb(_clear)(self);
#ifndef i_capacity
- c_FREE(self->data);
+ c_free(self->data);
#endif
}
@@ -100,7 +100,7 @@ STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* self) {
STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) {
if (n < self->_len) return true;
#ifndef i_capacity
- _cx_value *t = (_cx_value *)c_REALLOC(self->data, n*sizeof *t);
+ _cx_value *t = (_cx_value *)c_realloc(self->data, n*sizeof *t);
if (t) { self->_cap = n, self->data = t; return true; }
#endif
return false;
@@ -154,7 +154,7 @@ STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
#if !defined i_no_clone
STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) {
- _cx_self out = {(_cx_value *)c_MALLOC(v._len*sizeof(_cx_value)), v._len, v._len};
+ _cx_self out = {(_cx_value *)c_malloc(v._len*sizeof(_cx_value)), v._len, v._len};
if (!out.data) out._cap = 0;
else for (size_t i = 0; i < v._len; ++v.data)
out.data[i++] = i_keyclone((*v.data));
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 071e40e8..9f6415ac 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -62,7 +62,7 @@ enum { cstr_s_cap = sizeof(cstr_buf) - 2 };
#define cstr_l_size(s) ((s)->lon.size)
#define cstr_l_set_size(s, len) ((s)->lon.data[(s)->lon.size = (len)] = 0)
#define cstr_l_data(s) (s)->lon.data
-#define cstr_l_drop(s) c_FREE((s)->lon.data)
+#define cstr_l_drop(s) c_free((s)->lon.data)
#define cstr_is_long(s) ((s)->sml.size > 127)
STC_API char* _cstr_init(cstr* self, size_t len, size_t cap);
@@ -471,7 +471,7 @@ STC_DEF char* _cstr_internal_move(cstr* self, const size_t pos1, const size_t po
STC_DEF char* _cstr_init(cstr* self, const size_t len, const size_t cap) {
if (cap > cstr_s_cap) {
- self->lon.data = (char *)c_MALLOC(cap + 1);
+ self->lon.data = (char *)c_malloc(cap + 1);
cstr_l_set_size(self, len);
cstr_l_set_cap(self, cap);
return self->lon.data;
@@ -485,26 +485,26 @@ STC_DEF void cstr_shrink_to_fit(cstr* self) {
if (r.size == r.cap)
return;
if (r.size > cstr_s_cap) {
- self->lon.data = (char *)c_REALLOC(self->lon.data, r.size + 1);
+ self->lon.data = (char *)c_realloc(self->lon.data, r.size + 1);
cstr_l_set_cap(self, r.size);
} else if (r.cap > cstr_s_cap) {
memcpy(self->sml.data, r.data, r.size + 1);
cstr_s_set_size(self, r.size);
- c_FREE(r.data);
+ c_free(r.data);
}
}
STC_DEF char* cstr_reserve(cstr* self, const size_t cap) {
if (cstr_is_long(self)) {
if (cap > cstr_l_cap(self)) {
- self->lon.data = (char *)c_REALLOC(self->lon.data, cap + 1);
+ self->lon.data = (char *)c_realloc(self->lon.data, cap + 1);
cstr_l_set_cap(self, cap);
}
return self->lon.data;
}
/* from short to long: */
if (cap > cstr_s_cap) {
- char* data = (char *)c_MALLOC(cap + 1);
+ char* data = (char *)c_malloc(cap + 1);
const size_t len = cstr_s_size(self);
memcpy(data, self->sml.data, cstr_s_cap + 1);
self->lon.data = data;
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 2ff2c58a..83d94652 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -277,13 +277,13 @@ _cx_memb(_drop)(_cx_self* self) {
if (self->_cap == 0)
return;
_cx_memb(_clear)(self);
- c_FREE(self->data);
+ c_free(self->data);
}
STC_DEF bool
_cx_memb(_reserve)(_cx_self* self, const size_t cap) {
if (cap > self->_cap || (cap && cap == self->_len)) {
- _cx_value* d = (_cx_value*)c_REALLOC(self->data, cap*sizeof(i_key));
+ _cx_value* d = (_cx_value*)c_realloc(self->data, cap*sizeof(i_key));
if (!d)
return false;
self->data = d;
diff --git a/include/stc/priv/altnames.h b/include/stc/priv/altnames.h
index 695d3ebc..024868c2 100644
--- a/include/stc/priv/altnames.h
+++ b/include/stc/priv/altnames.h
@@ -23,10 +23,6 @@
#define c_alloc c_ALLOC
#define c_alloc_n c_ALLOC_N
#define c_new c_NEW
-#define c_malloc c_MALLOC
-#define c_calloc c_CALLOC
-#define c_realloc c_REALLOC
-#define c_free c_FREE
#define c_arraylen c_ARRAYLEN
#define c_forlist c_FORLIST
#define c_forrange c_FORRANGE