diff options
| author | nia <nia@NetBSD.org> | 2021-10-29 10:54:56 +0000 |
|---|---|---|
| committer | nia <nia@NetBSD.org> | 2021-10-29 10:54:56 +0000 |
| commit | e1c754160aa790f741823a201b0bb9c19cb55eb8 (patch) | |
| tree | a96c21a4be66e15b94127bb8826410b824b7a962 /lib/libc | |
| parent | 3266170418e9231b54fc4f95379eeb50eb727210 (diff) | |
citrus: Use calloc instead of malloc'ing and clearing the array manually
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/citrus/citrus_db_factory.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/citrus/citrus_db_factory.c b/lib/libc/citrus/citrus_db_factory.c index a17e5b7f3ca..c7f8c087138 100644 --- a/lib/libc/citrus/citrus_db_factory.c +++ b/lib/libc/citrus/citrus_db_factory.c @@ -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 _citrus_db_factory *df, const char *magic, 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) { |
