Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst no need to initialize fields that are alrea...



details:   https://anonhg.NetBSD.org/src/rev/e0c7a6fd0233
branches:  trunk
changeset: 457398:e0c7a6fd0233
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 22 20:46:07 2019 +0000

description:
no need to initialize fields that are already 0.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |  11 +----------
 usr.sbin/sysinst/configmenu.c   |   7 ++-----
 usr.sbin/sysinst/disks.c        |   4 +---
 usr.sbin/sysinst/label.c        |  39 +++++++++++++--------------------------
 usr.sbin/sysinst/main.c         |   4 +---
 usr.sbin/sysinst/net.c          |   4 +---
 usr.sbin/sysinst/part_edit.c    |  40 +++++++++-------------------------------
 usr.sbin/sysinst/partman.c      |  18 ++++++------------
 usr.sbin/sysinst/run.c          |   6 +++---
 usr.sbin/sysinst/util.c         |  26 ++++++--------------------
 usr.sbin/sysinst/wskbd.c        |   5 ++---
 11 files changed, 45 insertions(+), 119 deletions(-)

diffs (truncated from 671 to 300 lines):

diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.15 2019/06/20 19:26:41 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.16 2019/06/22 20:46:07 christos Exp $       */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -414,17 +414,14 @@
        memset(pset->menu_opts, 0, (pset->num+3)*sizeof(*pset->menu_opts));
        for (m = pset->menu_opts, p = pset->infos, i = 0; i < pset->num;
            m++, p++, i++) {
-               m->opt_menu = OPT_NOMENU;
                m->opt_action = set_ptn_size;
        }
 
        m->opt_name = size_separator;
-       m->opt_menu = OPT_NOMENU;
        m->opt_flags = OPT_IGNORE|OPT_NOSHORT;
        m++;
 
        m->opt_name = MSG_add_another_ptn;
-       m->opt_menu = OPT_NOMENU;
        m->opt_action = add_other_ptn_size;
        m++;
 
@@ -874,24 +871,18 @@
 
        if (have_existing) {
                opt->opt_name = MSG_Keep_existing_partitions;
-               opt->opt_exp_name = NULL;
-               opt->opt_menu = OPT_NOMENU;
                opt->opt_flags = OPT_EXIT;
                opt->opt_action = set_keep_existing;
                opt++;
                num_opts++;
        }
        opt->opt_name = MSG_Set_Sizes;
-       opt->opt_exp_name = NULL;
-       opt->opt_menu = OPT_NOMENU;
        opt->opt_flags = OPT_EXIT;
        opt->opt_action = set_edit_part_sizes;
        opt++;
        num_opts++;
 
        opt->opt_name = MSG_Use_Default_Parts;
-       opt->opt_exp_name = NULL;
-       opt->opt_menu = OPT_NOMENU;
        opt->opt_flags = OPT_EXIT;
        opt->opt_action = set_use_default_sizes;
        opt++;
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/configmenu.c
--- a/usr.sbin/sysinst/configmenu.c     Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/configmenu.c     Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.8 2019/06/20 15:58:59 christos Exp $ */
+/* $NetBSD: configmenu.c,v 1.9 2019/06/22 20:46:07 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -181,10 +181,7 @@
                if (opt == CONFIGOPT_LAST)
                        break;
                *ce = conf;
-               me->opt_menu = OPT_NOMENU;
-               me->opt_flags = 0;
-               me->opt_name = NULL;  /* NULL so set_config will draw */
-               me->opt_exp_name = NULL;
+               memset(me, 0, sizeof(*me));
                me->opt_action = conf->action;
                configopts++;
                ce++;
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/disks.c  Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.35 2019/06/21 21:54:39 christos Exp $ */
+/*     $NetBSD: disks.c,v 1.36 2019/06/22 20:46:07 christos Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -800,13 +800,11 @@
                        for (i = 0; i < numdisks; i++) {
                                dsk_menu[i].opt_name =
                                    disks[i].dd_descr;
-                               dsk_menu[i].opt_menu = OPT_NOMENU;
                                dsk_menu[i].opt_flags = OPT_EXIT;
                                dsk_menu[i].opt_action = set_menu_select;
                        }
                        if (partman_go < 0) {
                                dsk_menu[i].opt_name = MSG_partman;
-                               dsk_menu[i].opt_menu = OPT_NOMENU;
                                dsk_menu[i].opt_flags = OPT_EXIT;
                                dsk_menu[i].opt_action = set_menu_select;
                        }
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/label.c  Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.7 2019/06/12 06:20:17 martin Exp $ */
+/*     $NetBSD: label.c,v 1.8 2019/06/22 20:46:07 christos Exp $       */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.7 2019/06/12 06:20:17 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.8 2019/06/22 20:46:07 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -541,11 +541,9 @@
 
        ndx = 0;
        opts[ndx].opt_name = msg_string(MSG_fs_type_ffsv2);
-       opts[ndx].opt_menu = OPT_NOMENU;
        opts[ndx].opt_action = set_fstype_ext;
        ndx++;
        opts[ndx].opt_name = msg_string(MSG_fs_type_ffs);
-       opts[ndx].opt_menu = OPT_NOMENU;
        opts[ndx].opt_action = set_fstype_ext;
        ndx++;
        for (i = 0; i < FSMAXTYPES && ndx < cnt; i++) {
@@ -556,7 +554,6 @@
                if (fstypenames[i] == NULL)
                        continue;
                opts[ndx].opt_name = fstypenames[i];
-               opts[ndx].opt_menu = OPT_NOMENU;
                opts[ndx].opt_action = set_fstype_ext;
                ndx++;
        }
@@ -666,7 +663,6 @@
        /* special case entry 0: two FFS entries */
        for (i = 0; i < __arraycount(edit_fs_common_types); i++) {
                opts[i+1].opt_name = getfslabelname(edit_fs_common_types[i], 0);
-               opts[i+1].opt_menu = OPT_NOMENU;
                opts[i+1].opt_action = set_fstype;
        }
        /* duplicate FFS (at offset 1) into first entry */
@@ -676,7 +672,6 @@
        /* add secondary sub-menu */
        assert(i+1 < (size_t)cnt);
        opts[i+1].opt_name = msg_string(MSG_other_fs_type);
-       opts[i+1].opt_menu = OPT_NOMENU;
        opts[i+1].opt_action = edit_fs_type_ext;
 
        m = new_menu(MSG_Select_the_type, opts, cnt,
@@ -708,30 +703,30 @@
        bool is_new_part, with_inst_opt = pset->parts->parent == NULL;
 
        static const menu_ent edit_ptn_fields_head[] = {
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_type },
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_start },
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_size },
-               { .opt_menu=OPT_NOMENU, .opt_flags=OPT_IGNORE },
+               { .opt_action=edit_fs_type },
+               { .opt_action=edit_fs_start },
+               { .opt_action=edit_fs_size },
+               { .opt_flags=OPT_IGNORE },
        };
 
        static const menu_ent edit_ptn_fields_head_add[] = {
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_install },
+               { .opt_action=edit_install },
        };
 
        static const menu_ent edit_ptn_fields_head2[] = {
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_preserve },
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mount },
+               { .opt_action=edit_fs_preserve },
+               { .opt_action=edit_fs_mount },
                { .opt_menu=MENU_mountoptions, .opt_flags=OPT_SUB },
-               { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mountpt },
+               { .opt_action=edit_fs_mountpt },
        };
        static const menu_ent edit_ptn_fields_tail[] = {
                { .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
                  .opt_flags=OPT_SUB },
-               { .opt_name=MSG_restore, .opt_menu=OPT_NOMENU,
+               { .opt_name=MSG_restore,
                  .opt_action=edit_restore},
-               { .opt_name=MSG_Delete_partition, .opt_menu=OPT_NOMENU,
+               { .opt_name=MSG_Delete_partition,
                  .opt_action=edit_delete_ptn},
-               { .opt_name=MSG_cancel, .opt_menu=OPT_NOMENU,
+               { .opt_name=MSG_cancel,
                  .opt_action=edit_cancel},
        };
 
@@ -773,7 +768,6 @@
                for (size_t i = 0;
                    i < pset->parts->pscheme->custom_attribute_count;
                    i++, popt++) {
-                       popt->opt_menu = OPT_NOMENU;
                        popt->opt_action = edit_ptn_custom_type;
                }
        }
@@ -1291,7 +1285,6 @@
        memmove(nmenopts+off+1, nmenopts+off,
            (m->numopts-off)*sizeof(*nmenopts));
        memset(&nmenopts[off], 0, sizeof(nmenopts[off]));
-       nmenopts[off].opt_menu = OPT_NOMENU;
        nmenopts[off].opt_action = edit_ptn;
        pset->menu_opts = m->opts = nmenopts;
        m->numopts++;
@@ -1331,7 +1324,6 @@
        memset(&nmenopts[off], 0, sizeof(nmenopts[off]));
 
        nmenopts[off].opt_name = MSG_addpart;
-       nmenopts[off].opt_menu = OPT_NOMENU;
        nmenopts[off].opt_flags = OPT_SUB;
        nmenopts[off].opt_action = edit_fspart_add;
 
@@ -1410,20 +1402,17 @@
 
        op = pset->menu_opts;
        for (i = 0; i < pset->parts->num_part; i++) {
-               op->opt_menu = OPT_NOMENU;
                op->opt_action = edit_ptn;
                op++;
        }
        /* separator line between partitions and actions */
        op->opt_name = fspart_separator;
-       op->opt_menu = OPT_NOMENU;
        op->opt_flags = OPT_IGNORE|OPT_NOSHORT;
        op++;
 
        /* followed by new partition adder */
        if (may_add) {
                op->opt_name = MSG_addpart;
-               op->opt_menu = OPT_NOMENU;
                op->opt_flags = OPT_SUB;
                op->opt_action = edit_fspart_add;
                op++;
@@ -1438,7 +1427,6 @@
 
        if (may_edit_pack) {
                op->opt_name = MSG_editpack;
-               op->opt_menu = OPT_NOMENU;
                op->opt_flags = OPT_SUB;
                op->opt_action = edit_fspart_pack;
                op++;
@@ -1446,7 +1434,6 @@
                
        /* and abort option */
        op->opt_name = MSG_cancel;
-       op->opt_menu = OPT_NOMENU;
        op->opt_flags = OPT_EXIT;
        op->opt_action = edit_fspart_abort;
        op++;
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/main.c   Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.16 2019/06/12 06:20:17 martin Exp $ */
+/*     $NetBSD: main.c,v 1.17 2019/06/22 20:46:07 christos Exp $       */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -368,8 +368,6 @@
 
        for (lang = 0; lang < num_lang; lang++) {
                opt[lang].opt_name = lang_msg[lang];
-               opt[lang].opt_exp_name = NULL;
-               opt[lang].opt_menu = OPT_NOMENU;
                opt[lang].opt_action = set_language;
        }
 
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/net.c    Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.29 2019/06/20 00:43:55 christos Exp $        */
+/*     $NetBSD: net.c,v 1.30 2019/06/22 20:46:07 christos Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -510,8 +510,6 @@
 
        for (i = 0; i < num_devs; i++) {
                net_menu[i].opt_name = net_devs[i].if_dev;
-               net_menu[i].opt_exp_name = NULL;
-               net_menu[i].opt_menu = OPT_NOMENU;
                net_menu[i].opt_flags = OPT_EXIT;
                net_menu[i].opt_action = set_menu_select;
        }
diff -r 587f7c3539e0 -r e0c7a6fd0233 usr.sbin/sysinst/part_edit.c
--- a/usr.sbin/sysinst/part_edit.c      Sat Jun 22 20:44:54 2019 +0000
+++ b/usr.sbin/sysinst/part_edit.c      Sat Jun 22 20:46:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: part_edit.c,v 1.4 2019/06/20 00:43:55 christos Exp $ */
+/*     $NetBSD: part_edit.c,v 1.5 2019/06/22 20:46:07 christos Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -173,7 +173,6 @@
        popt_cnt =  info->parts->pscheme->get_part_types_count() + 2;



Home | Main Index | Thread Index | Old Index