From 86414873cf576dabdca487aad61713a7cda865f5 Mon Sep 17 00:00:00 2001 From: Nicolas Cannasse Date: Sat, 19 Aug 2023 10:00:20 +0200 Subject: [PATCH] minor --- src/allocator.c | 2 +- src/allocator.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/allocator.c b/src/allocator.c index c3d1f6d13..bacbafc34 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -157,7 +157,7 @@ static gc_pheader *gc_allocator_new_page( int pid, int block, int size, int kind if( p->max_blocks > GC_PAGE_SIZE ) hl_fatal("Too many blocks for this page"); if( varsize ) { - if( p->max_blocks <= 8 ) + if( p->max_blocks <= SIZES_PADDING ) p->sizes = (unsigned char*)&p->sizes_ref; else { p->sizes = ph->base + start_pos; diff --git a/src/allocator.h b/src/allocator.h index 134016490..650f7b102 100644 --- a/src/allocator.h +++ b/src/allocator.h @@ -13,6 +13,8 @@ typedef struct _gc_freelist { gc_fl *data; } gc_freelist; +#define SIZES_PADDING 8 + typedef struct { int block_size; unsigned char size_bits; @@ -22,7 +24,6 @@ typedef struct { // mutable gc_freelist free; unsigned char *sizes; - int sizes_ref; - int sizes_ref2; + char sizes_ref[SIZES_PADDING]; } gc_allocator_page_data;