Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/citrus citrus: Use calloc instead of malloc'ing and...



details:   https://anonhg.NetBSD.org/src/rev/4478766bd8e0
branches:  trunk
changeset: 1024579:4478766bd8e0
user:      nia <nia%NetBSD.org@localhost>
date:      Fri Oct 29 10:54:56 2021 +0000

description:
citrus: Use calloc instead of malloc'ing and clearing the array manually

diffstat:

 lib/libc/citrus/citrus_db_factory.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r a245402f8109 -r 4478766bd8e0 lib/libc/citrus/citrus_db_factory.c
--- a/lib/libc/citrus/citrus_db_factory.c       Fri Oct 29 10:40:00 2021 +0000
+++ b/lib/libc/citrus/citrus_db_factory.c       Fri Oct 29 10:54:56 2021 +0000
@@ -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 @@
                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) {



Home | Main Index | Thread Index | Old Index