Module Name: src Committed By: nia Date: Fri Oct 29 10:54:56 UTC 2021
Modified Files: src/lib/libc/citrus: citrus_db_factory.c Log Message: citrus: Use calloc instead of malloc'ing and clearing the array manually To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/citrus/citrus_db_factory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/citrus/citrus_db_factory.c diff -u src/lib/libc/citrus/citrus_db_factory.c:1.10 src/lib/libc/citrus/citrus_db_factory.c:1.11 --- src/lib/libc/citrus/citrus_db_factory.c:1.10 Sat Sep 14 13:05:51 2013 +++ src/lib/libc/citrus/citrus_db_factory.c Fri Oct 29 10:54:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $ */ +/* $NetBSD: citrus_db_factory.c,v 1.11 2021/10/29 10:54:56 nia Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -32,7 +32,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $"); +__RCSID("$NetBSD: citrus_db_factory.c,v 1.11 2021/10/29 10:54:56 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #include <assert.h> @@ -274,11 +274,9 @@ _citrus_db_factory_serialize(struct _cit return 0; } /* allocate hash table */ - depp = malloc(sizeof(*depp) * df->df_num_entries); + depp = calloc(df->df_num_entries, sizeof(*depp)); if (depp == NULL) return -1; - for (i = 0; i < df->df_num_entries; i++) - depp[i] = NULL; /* step1: store the entries which are not conflicting */ SIMPLEQ_FOREACH(de, &df->df_entries, de_entry) {