Module Name: src
Committed By: christos
Date: Sun Jun 23 22:47:22 UTC 2019
Modified Files:
src/usr.bin/menuc: menu_sys.def
Log Message:
use calloc properly.
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/menuc/menu_sys.def
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/menuc/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.71 src/usr.bin/menuc/menu_sys.def:1.72
--- src/usr.bin/menuc/menu_sys.def:1.71 Sun Jun 23 07:22:48 2019
+++ src/usr.bin/menuc/menu_sys.def Sun Jun 23 18:47:22 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: menu_sys.def,v 1.71 2019/06/23 11:22:48 martin Exp $ */
+/* $NetBSD: menu_sys.def,v 1.72 2019/06/23 22:47:22 christos Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -674,10 +674,9 @@ menu_init(void)
num_menus = DYN_INIT_NUM;
while (num_menus < DYN_MENU_START)
num_menus *= 2;
- menu_list = malloc(sizeof *menu_list * num_menus);
+ menu_list = calloc(num_menus, sizeof *menu_list);
if (menu_list == NULL)
return 2;
- (void)memset(menu_list, 0, sizeof *menu_list * num_menus);
for (i = 0; i < DYN_MENU_START; i++)
menu_list[i] = &menu_def[i];
#endif
@@ -862,7 +861,7 @@ new_menu(const char *title, menu_ent *op
return OPT_NOMENU;
m = menu_list[ix];
if (m == NULL) {
- m = calloc(sizeof *m, 1);
+ m = calloc(1, sizeof *m);
if (m == NULL)
return OPT_NOMENU;
menu_list[ix] = m;