Better MSVC support

* get rid of alloca()
* no variable-sized arrays
This commit is contained in:
Heng Li
2017-09-03 11:05:55 -04:00
parent 2b8681ead7
commit 6db9b7579c
6 changed files with 22 additions and 20 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ static size_t *morecore(kmem_t *km, size_t nu)
up = (size_t*)malloc(rnu * sizeof(size_t));
if (!up) { /* fail to allocate memory */
km_stat(km);
fprintf(stderr, "[morecore] %lu 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);
}
/* put the pointer in km->list_head */
@@ -210,5 +210,5 @@ void km_stat(const void *_km)
--n_blocks;
frag = 1.0/1024.0 * n_units * sizeof(size_t) / n_blocks;
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);
}