diff options
| author | Tyge Løvset <[email protected]> | 2023-02-07 10:59:32 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-07 11:18:55 +0100 |
| commit | 3cb564e7274b7749531742fa7c50fd928fdbe2d9 (patch) | |
| tree | 926cabc1ecd1f95bbb4e4048dd91d91a19f1cee7 /include | |
| parent | 1c81deecc673a6619ccc25c5c763e979b0a54a1a (diff) | |
| download | STC-modified-3cb564e7274b7749531742fa7c50fd928fdbe2d9.tar.gz STC-modified-3cb564e7274b7749531742fa7c50fd928fdbe2d9.zip | |
removed c_ALLOC_N()
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/ccommon.h | 2 | ||||
| -rw-r--r-- | include/stc/clist.h | 2 | ||||
| -rw-r--r-- | include/stc/cmap.h | 7 | ||||
| -rw-r--r-- | include/stc/priv/altnames.h | 1 |
4 files changed, 5 insertions, 7 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index d5daf252..d04aaacd 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -65,12 +65,10 @@ #ifdef __cplusplus #include <new> #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(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 diff --git a/include/stc/clist.h b/include/stc/clist.h index cd6ec61e..81443b59 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -70,7 +70,7 @@ _c_clist_types(clist_VOID, int); _c_clist_complete_types(clist_VOID, dummy); #define _c_clist_insert_entry_after(ref, val) \ - _cx_node *entry = c_ALLOC(_cx_node); entry->value = val; \ + _cx_node *entry = (_cx_node *)c_malloc(c_sizeof *entry); entry->value = val; \ _c_clist_insert_node_after(ref, entry) #define _c_clist_insert_node_after(ref, entry) \ diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 393df53f..f5547125 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -395,7 +395,8 @@ _cx_memb(_insert_entry_)(_cx_self* self, _cx_rawkey rkey) { 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; + _cx_value *t = (_cx_value *)c_malloc(c_sizeof(_cx_value)*m.bucket_count), + *dst = t, *m_end = m.table + m.bucket_count; uint8_t *h = (uint8_t *)c_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; } @@ -421,8 +422,8 @@ _cx_memb(_reserve)(_cx_self* self, const int64_t newcap) { _nbuckets |= 1; #endif _cx_self m = { - c_ALLOC_N(_cx_value, _nbuckets), - (uint8_t *) c_calloc(_nbuckets + 1, 1), + (_cx_value *)c_malloc(c_sizeof(_cx_value)*_nbuckets), + (uint8_t *)c_calloc(_nbuckets + 1, 1), self->size, _nbuckets, }; bool ok = m.table && m._hashx; diff --git a/include/stc/priv/altnames.h b/include/stc/priv/altnames.h index 0c6db0b2..e3ce03a0 100644 --- a/include/stc/priv/altnames.h +++ b/include/stc/priv/altnames.h @@ -21,7 +21,6 @@ * SOFTWARE. */ #define c_alloc c_ALLOC -#define c_alloc_n c_ALLOC_N #define c_new c_NEW #define c_arraylen c_ARRAYLEN #define c_forlist c_FORLIST |
