Port to new memory model
This commit is contained in:
1 parent
5b4c9cd618
commit
1f2584ccea
16 files changed
+95
-86
No files matched your search
+4
-4
@@ -78,7 +78,7 @@ M_INLINE void
|
||||
m_bstring_clear(m_bstring_t s)
|
||||
{
|
||||
M_BSTRING_CONTRACT(s);
|
||||
M_MEMORY_FREE(s->ptr);
|
||||
M_MEMORY_FREE(uint8_t, s->ptr, s->alloc);
|
||||
s->offset = (size_t) -1;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ m_bstr1ng_fit2size (m_bstring_t v, size_t size_alloc, bool exact_alloc)
|
||||
if (M_UNLIKELY_NOMEM (alloc < size_alloc)) {
|
||||
goto allocation_error;
|
||||
}
|
||||
uint8_t *ptr = M_MEMORY_REALLOC (uint8_t, v->ptr, alloc);
|
||||
uint8_t *ptr = M_MEMORY_REALLOC (uint8_t, v->ptr, v->alloc, alloc);
|
||||
if (M_UNLIKELY_NOMEM (ptr == NULL)) {
|
||||
goto allocation_error;
|
||||
}
|
||||
@@ -401,13 +401,13 @@ m_bstring_reserve (m_bstring_t v, size_t n)
|
||||
n = v->offset + size;
|
||||
}
|
||||
if (n == 0) {
|
||||
M_MEMORY_FREE(v->ptr);
|
||||
M_MEMORY_FREE(uint8_t, v->ptr, v->alloc);
|
||||
v->offset = 0;
|
||||
v->size = 0;
|
||||
v->alloc = 0;
|
||||
v->ptr = NULL;
|
||||
} else {
|
||||
uint8_t *ptr = M_MEMORY_REALLOC (uint8_t, v->ptr, n);
|
||||
uint8_t *ptr = M_MEMORY_REALLOC (uint8_t, v->ptr, v->alloc, n);
|
||||
if (M_UNLIKELY_NOMEM (ptr == NULL)) {
|
||||
M_MEMORY_FULL(n);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user