On Sun Jun 18 00:44:41 2023 +0000, Erich Hoover wrote:
It doesn't matter what you allocate here, the pointer will be replaced when `item_realloc()` gets called. This line was originally an allocation of size 0 that got changed in commit 9dba420d0a78:
- item = heap_alloc_zero(sizeof(IndexItem)); + item = calloc(1, sizeof(IndexItem)); item->nItems = 0; - item->items = heap_alloc_zero(0); + item->items = calloc(2, sizeof(void *)); item->itemFlags = 0x11;
So, I would suggest making this a `malloc(0)` instead so that it's clear that we just want the pointer for later use in `realloc`.
I remember being confused as to the intention here when I converted this library to use CRT allocation functions. If the initial value is only used as a parameter to realloc, let's just initialize it to NULL.