diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-23 01:33:50 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-23 02:09:51 +0200 |
commit | 7c028e224978e1d5a4f207cc42b9eb58d81897dd (patch) | |
tree | d7165e3b9d1a7041cd79712526ad472c21135bdc /lib/comp/block_processor_parallel.c | |
parent | 0a5383ccdf8e87d2259d02a9ff44420b3bc3f58d (diff) |
Some simple search/replace cases for allocation
This commit exchanges some malloc(x + y * z) patterns that can be found
with a simple git grep and are obvious for the new wrappers.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/comp/block_processor_parallel.c')
-rw-r--r-- | lib/comp/block_processor_parallel.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/comp/block_processor_parallel.c b/lib/comp/block_processor_parallel.c index 985c900..b58ad5c 100644 --- a/lib/comp/block_processor_parallel.c +++ b/lib/comp/block_processor_parallel.c @@ -119,15 +119,13 @@ block_processor_t *block_processor_create(size_t max_block_size, { block_processor_t *proc; unsigned int i; - size_t size; int ret; if (num_workers < 1) num_workers = 1; - size = sizeof(proc->workers[0]) * num_workers; - - proc = calloc(1, sizeof(*proc) + size); + proc = alloc_flex(sizeof(*proc), + sizeof(proc->workers[0]), num_workers); if (proc == NULL) { perror("Creating block processor"); return NULL; @@ -153,10 +151,9 @@ block_processor_t *block_processor_create(size_t max_block_size, goto fail_cond; } - size = sizeof(compress_worker_t) + max_block_size; - for (i = 0; i < num_workers; ++i) { - proc->workers[i] = calloc(1, size); + proc->workers[i] = alloc_flex(sizeof(compress_worker_t), + 1, max_block_size); if (proc->workers[i] == NULL) { perror("Creating block worker data"); |