Yzena
/
Yc
2
1
Fork 0
Browse Source

Fix compile errors

Signed-off-by: Gavin Howard <gavin@yzena.com>
afl_persistent_mode
Gavin Howard 2 months ago
parent
commit
41bfe5449e
Signed by: gavin
GPG Key ID: C08038BDF280D33E
  1. 25
      src/pool/stackpool.c
  2. 2
      src/pool/stackpool.h

25
src/pool/stackpool.c

@ -161,7 +161,7 @@ y_stackpage_hasOneItem(y_StackPage p)
static y_inline void*
y_stackpage_last(y_StackPage p)
{
y_assert(n <= p->used - sizeof(y_stackpage),
y_assert(p->used - sizeof(y_stackpage) >= p->esize,
"Wrong size for the last item");
return ((unsigned char*) p) + (p->used - p->esize);
@ -298,7 +298,7 @@ y_stackpool_scope_destroy(void* ptr)
{
if (p[i] != y_STACKMMAP_SCOPE)
{
panic("Invalid scope");
y_panica("Invalid scope");
}
}
#endif // YC_DEBUG
@ -316,7 +316,7 @@ y_stackpool_jmp_destroy(void* ptr)
{
if (p[i] != y_STACKMMAP_JMP)
{
panic("Invalid jmp");
y_panica("Invalid jmp");
}
}
#endif // YC_DEBUG
@ -439,7 +439,7 @@ y_stackpool_exitScope(y_StackPool p)
{
yc_assert(p != NULL, YC_ASSERT_NULL);
y_assert(p->nscopes > 0, "No scopes exist in the pool");
y_assert(y_svec_len(&p->allocs), "No items to free");
y_assert(p->nallocs > 0, "No items to free");
y_stackalloc* alloc;
@ -455,8 +455,8 @@ y_stackpool_exitScope(y_StackPool p)
}
y_assert(alloc->size == sizeof(max_align_t), "Invalid scope marker");
y_assert(alloc->dtor == y_stack_jmp_destroy ||
alloc->dtor == y_stack_jmp2_destroy,
y_assert(alloc->dtor == y_stackpool_jmp_destroy ||
alloc->dtor == y_stackpool_jmp2_destroy,
"Found jmp marker instead of scope marker");
y_stackpool_free(p);
@ -511,7 +511,7 @@ y_stackpool_jmp(y_StackPool p, bool jmp)
{
yc_assert(p != NULL, YC_ASSERT_NULL);
y_assert(p->njmps > 0, "No jmp markers");
y_assert(y_svec_len(&p->allocs), "No items to free");
y_assert(p->nallocs > 0, "No items to free");
y_stackalloc* alloc;
@ -529,12 +529,13 @@ y_stackpool_jmp(y_StackPool p, bool jmp)
y_stackpool_free(p);
}
y_assert(y_svec_len(&p->allocs), "No items to free");
y_assert(p->nallocs > 0, "No items to free");
alloc = y_stackpage_last(p->cur_alloc_page);
}
y_assert(alloc->dtor == y_STACKMMAP_JMP || alloc->dtor == y_STACKMMAP_JMP2,
y_assert(alloc->dtor == y_stackpool_jmp_destroy ||
alloc->dtor == y_stackpool_jmp2_destroy,
"Did not find jmp marker");
#if YC_ENABLE_ALLOC_ACCOUNTING
@ -560,7 +561,7 @@ void
y_stackpool_clear(y_stackpool* p, bool jmp)
{
yc_assert(p != NULL, YC_ASSERT_NULL);
y_assert(y_svec_len(&p->allocs), "No items to free");
y_assert(p->nallocs > 0, "No items to free");
while (y_stackpage_hasItem(p->cur_alloc_page))
{
@ -754,13 +755,13 @@ static void
y_stackpool_freeHelper(y_stackpool* p, bool destruct)
{
yc_assert(p != NULL, YC_ASSERT_NULL);
yc_assertv(p->allocs.len, YC_ASSERT_INDEX_RANGE, 0, p->allocs.len);
yc_assertv(p->nallocs > 0, YC_ASSERT_INDEX_RANGE, 0, p->nallocs);
void* ptr;
y_stackalloc* alloc = y_stackpage_last(p->cur_alloc_page);
y_assert(alloc->dtor != y_STACKMMAP_SCOPE,
y_assert(alloc->dtor != y_stackpool_scope_destroy,
"Cannot free a scope marker; use y_stackpool_exitScope()");
// If this is true, we have a normal allocation.

2
src/pool/stackpool.h

@ -118,7 +118,7 @@ extern "C" {
* @def y_STACKMMAP_JMP
* A marker for where a longjmp() will come back to. Used for the dtor field.
*/
#define y_STACKMMAP_JMP ((1UL << 16) - 2)
#define y_STACKMMAP_JMP ((1UL << 8) - 2)
/**
* @def y_STACKPOOL_ROUND_UP

Loading…
Cancel
Save