mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Minor nit; type mismatch in zone_batch_malloc(), OSX

Open bazineta opened this issue 2 months ago • 0 comments

Pedantic compiler warning on an integral type mismatch in zone_batch_malloc() in the OSX primitive:

https://github.com/microsoft/mimalloc/blob/09a27098aa6e9286518bd9c74e6ffa7199c3f04e/src/prim/osx/alloc-override-zone.c#L85

static unsigned zone_batch_malloc(malloc_zone_t* zone, size_t size, void** ps, unsigned count) {
  size_t i;
  for (i = 0; i < count; i++) {
    ps[i] = zone_malloc(zone, size);
    if (ps[i] == NULL) break;
  }
  return i;
}

count is an unsigned, while i is a size_t. Since this is part of Apple's malloc zone hooks, we're stuck with the interface declaration, so making i an unsigned silences the warning.

bazineta avatar Oct 05 '25 18:10 bazineta