From 7c028e224978e1d5a4f207cc42b9eb58d81897dd Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 23 Aug 2019 01:33:50 +0200 Subject: 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 --- lib/util/str_table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/util') diff --git a/lib/util/str_table.c b/lib/util/str_table.c index ae3a4f2..ab07738 100644 --- a/lib/util/str_table.c +++ b/lib/util/str_table.c @@ -12,6 +12,7 @@ #include #include "str_table.h" +#include "util.h" /* R5 hash function (borrowed from reiserfs) */ static uint32_t strhash(const char *s) @@ -54,7 +55,7 @@ int str_table_init(str_table_t *table, size_t size) { memset(table, 0, sizeof(*table)); - table->buckets = calloc(size, sizeof(table->buckets[0])); + table->buckets = alloc_array(size, sizeof(table->buckets[0])); table->num_buckets = size; if (table->buckets == NULL) { -- cgit v1.2.3