ok, %zu is a C99 feature...
This commit is contained in:
parent
2a5d5b6f12
commit
6f4cbf4f12
6
kalloc.c
6
kalloc.c
|
|
@ -46,7 +46,7 @@ static size_t *morecore(kmem_t *km, size_t nu)
|
||||||
up = (size_t*)malloc(rnu * sizeof(size_t));
|
up = (size_t*)malloc(rnu * sizeof(size_t));
|
||||||
if (!up) { /* fail to allocate memory */
|
if (!up) { /* fail to allocate memory */
|
||||||
km_stat(km);
|
km_stat(km);
|
||||||
fprintf(stderr, "[morecore] %zu bytes requested but not available.\n", rnu * sizeof(size_t));
|
fprintf(stderr, "[morecore] %lu bytes requested but not available.\n", (unsigned long)rnu * sizeof(size_t));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
/* put the pointer in km->list_head */
|
/* put the pointer in km->list_head */
|
||||||
|
|
@ -209,6 +209,6 @@ void km_stat(const void *_km)
|
||||||
|
|
||||||
--n_blocks;
|
--n_blocks;
|
||||||
frag = 1.0/1024.0 * n_units * sizeof(size_t) / n_blocks;
|
frag = 1.0/1024.0 * n_units * sizeof(size_t) / n_blocks;
|
||||||
fprintf(stderr, "[kr_stat] tot=%zu, free=%zu, n_block=%u, max_block=%zu, frag_len=%.3fK\n",
|
fprintf(stderr, "[kr_stat] tot=%lu, free=%lu, n_block=%u, max_block=%lu, frag_len=%.3fK\n",
|
||||||
km->total_allocated, n_units * sizeof(size_t), n_blocks, max_block * sizeof(size_t), frag);
|
(unsigned long)km->total_allocated, (unsigned long)n_units * sizeof(size_t), n_blocks, (unsigned long)max_block * sizeof(size_t), frag);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue