The deps bin output uses a strbuf. A size of 2048 covers all cases
on current Arch Linux (max used size is 1548) and removes heap
allocations.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/296
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
static int output_deps_bin(struct depmod *depmod, FILE *out)
{
+ DECLARE_STRBUF_WITH_STACK(sbuf, 2048);
struct index_node *idx;
size_t i;
struct array array;
- struct strbuf sbuf;
if (out == stdout)
return 0;
return -ENOMEM;
array_init(&array, 64);
- strbuf_init(&sbuf);
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
WRN("duplicate module deps:\n%s\n", line);
}
- strbuf_release(&sbuf);
array_free_array(&array);
index_write(idx, out);
index_destroy(idx);