From f95225f2db5e125bab1dedbb5b2e68d3a687f8f6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 3 Jan 2026 03:52:00 +0100 Subject: Portability-fix: NULL is not necessarily 0, so calloc cannot be used for assigning NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libparser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libparser.c b/libparser.c index 4a42c43..ce26273 100644 --- a/libparser.c +++ b/libparser.c @@ -53,18 +53,19 @@ try_match(const char *rule, const union libparser_sentence *sentence, struct con size_t i; if (!ctx->cache) { - unit = calloc(1, sizeof(*unit)); + unit = malloc(sizeof(*unit)); if (!unit) { ctx->done = 1; ctx->error = 1; return NULL; } + unit->end = 0; } else { unit = ctx->cache; ctx->cache = unit->next; - unit->in = unit->next = NULL; } + unit->in = unit->next = NULL; unit->rule = rule; unit->start = ctx->position; -- cgit v1.2.3-70-g09d2