Skip to content

Commit 13fbfcc

Browse files
committed
mem: fix -Werror=format build failure in hg_arena_init()
HG_CELL_HDR is built from ROUNDTO (sizeof-derived), so it has type size_t, not int. Printing it with %d tripped -Wformat and, since the build runs with -Werror, aborted the whole compile at mem/hg_arena.o. Use %zu, matching how f_malloc.c, q_malloc.c and hp_malloc.c already print their sizeof-derived values. %zu is also correct on 32-bit, where ROUNDTO is sizeof(void *).
1 parent ee79e66 commit 13fbfcc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mem/hg_arena.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ int hg_arena_init(struct hg_block *hb, unsigned long hdr_size)
235235
hb->size2class[idx] = (unsigned char)c; /* HG_NCLASSES = oversize */
236236
}
237237

238-
LM_DBG("%s arena ready: %d classes, %u B to %u B cells (header=%d B)\n",
238+
LM_DBG("%s arena ready: %d classes, %u B to %u B cells (header=%zu B)\n",
239239
hb->name, HG_NCLASSES, cell_sizes[0], cell_sizes[HG_NCLASSES-1],
240240
HG_CELL_HDR);
241241
return 0;

0 commit comments

Comments
 (0)