Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst deconst -> __UNCONST, the form...



details:   https://anonhg.NetBSD.org/src/rev/3acf7fbd86da
branches:  trunk
changeset: 319130:3acf7fbd86da
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri May 18 12:23:22 2018 +0000

description:
deconst -> __UNCONST, the former involves UB with NULL arithmetic.

diffstat:

 usr.sbin/sysinst/arch/alpha/md.c   |   4 ++--
 usr.sbin/sysinst/arch/emips/md.c   |   4 ++--
 usr.sbin/sysinst/arch/hp300/md.c   |   4 ++--
 usr.sbin/sysinst/arch/hppa/md.c    |   4 ++--
 usr.sbin/sysinst/arch/i386/md.c    |   6 +++---
 usr.sbin/sysinst/arch/landisk/md.c |   4 ++--
 usr.sbin/sysinst/arch/mipsco/md.c  |   4 ++--
 usr.sbin/sysinst/arch/mvme68k/md.c |   4 ++--
 usr.sbin/sysinst/arch/pmax/md.c    |   4 ++--
 usr.sbin/sysinst/arch/x68k/md.c    |   4 ++--
 usr.sbin/sysinst/bsddisklabel.c    |   6 +++---
 usr.sbin/sysinst/defs.h            |   8 +-------
 usr.sbin/sysinst/menus.mi          |   8 ++++----
 usr.sbin/sysinst/net.c             |   4 ++--
 usr.sbin/sysinst/partman.c         |  10 +++++-----
 usr.sbin/sysinst/util.c            |   6 +++---
 16 files changed, 39 insertions(+), 45 deletions(-)

diffs (truncated from 364 to 300 lines):

diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/alpha/md.c
--- a/usr.sbin/sysinst/arch/alpha/md.c  Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/alpha/md.c  Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
+/*     $NetBSD: md.c,v 1.3 2018/05/18 12:23:22 joerg Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -163,7 +163,7 @@
 
        if (error != 0)
                process_menu(MENU_ok,
-                   deconst("Warning: disk is probably not bootable"));
+                   __UNCONST("Warning: disk is probably not bootable"));
 
        return 0;
 }
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/emips/md.c
--- a/usr.sbin/sysinst/arch/emips/md.c  Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/emips/md.c  Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/05/10 10:14:02 martin Exp $    */
+/*     $NetBSD: md.c,v 1.4 2018/05/18 12:23:22 joerg Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -171,7 +171,7 @@
        if (ask_noyes(NULL)) {
                if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
                    "/bin/dd if=%s of=/dev/reflash0c bs=512", ldr_path))
-                       process_menu(MENU_ok, deconst("Warning: the system "
+                       process_menu(MENU_ok, __UNCONST("Warning: the system "
                            "is probably not bootable"));
        }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/hp300/md.c
--- a/usr.sbin/sysinst/arch/hp300/md.c  Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/hp300/md.c  Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
+/*     $NetBSD: md.c,v 1.5 2018/05/18 12:23:22 joerg Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -193,7 +193,7 @@
        if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
            "/usr/sbin/installboot /dev/r%sc /usr/mdec/uboot.lif", pm->diskdev))
                process_menu(MENU_ok,
-                   deconst("Warning: disk is probably not bootable"));
+                   __UNCONST("Warning: disk is probably not bootable"));
        return 0;
 }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/hppa/md.c
--- a/usr.sbin/sysinst/arch/hppa/md.c   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/hppa/md.c   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $    */
+/*     $NetBSD: md.c,v 1.3 2018/05/18 12:23:22 joerg Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -188,7 +188,7 @@
            "/usr/sbin/installboot -v /dev/r%sc /usr/mdec/xxboot",
            pm->diskdev))
                process_menu(MENU_ok,
-                        deconst("Warning: disk is probably not bootable"));
+                        __UNCONST("Warning: disk is probably not bootable"));
        return 0;
 }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/i386/md.c
--- a/usr.sbin/sysinst/arch/i386/md.c   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/i386/md.c   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.7 2017/09/11 15:24:28 gson Exp $ */
+/*     $NetBSD: md.c,v 1.8 2018/05/18 12:23:22 joerg Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -251,7 +251,7 @@
        free(bootxx);
        if (rval == 0)
                return 1;
-       process_menu(MENU_ok, deconst(MSG_No_Bootcode));
+       process_menu(MENU_ok, __UNCONST(MSG_No_Bootcode));
        return 0;
 }
 
@@ -362,7 +362,7 @@
                                                                                 
         if (ret != 0)                                                         
                 process_menu(MENU_ok,                                           
-                    deconst("Warning: disk is probably not bootable"));         
+                    __UNCONST("Warning: disk is probably not bootable"));         
 
        return ret;
 }
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/landisk/md.c
--- a/usr.sbin/sysinst/arch/landisk/md.c        Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/landisk/md.c        Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2017/07/18 17:15:45 gson Exp $      */
+/*     $NetBSD: md.c,v 1.4 2018/05/18 12:23:22 joerg Exp $     */
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -136,7 +136,7 @@
 
        if (error != 0)
                process_menu(MENU_ok,
-                   deconst("Warning: disk is probably not bootable"));
+                   __UNCONST("Warning: disk is probably not bootable"));
 
        return 0;
 }
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/mipsco/md.c
--- a/usr.sbin/sysinst/arch/mipsco/md.c Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/mipsco/md.c Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $    */
+/*     $NetBSD: md.c,v 1.3 2018/05/18 12:23:22 joerg Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -165,7 +165,7 @@
        if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
            "/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", pm->diskdev))
                process_menu(MENU_ok,
-                       deconst("Warning: disk is probably not bootable"));
+                       __UNCONST("Warning: disk is probably not bootable"));
        return 0;
 }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/mvme68k/md.c
--- a/usr.sbin/sysinst/arch/mvme68k/md.c        Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/mvme68k/md.c        Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:03 martin Exp $    */
+/*     $NetBSD: md.c,v 1.5 2018/05/18 12:23:22 joerg Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -194,7 +194,7 @@
            "/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
            target_expand("/.bootsd"), pm->diskdev))
                process_menu(MENU_ok,
-                       deconst("Warning: disk is probably not bootable"));
+                       __UNCONST("Warning: disk is probably not bootable"));
        return 0;
 }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/pmax/md.c
--- a/usr.sbin/sysinst/arch/pmax/md.c   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/pmax/md.c   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $    */
+/*     $NetBSD: md.c,v 1.3 2018/05/18 12:23:23 joerg Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -173,7 +173,7 @@
 
        if (error != 0)
                process_menu(MENU_ok,
-                   deconst("Warning: disk is probably not bootable"));
+                   __UNCONST("Warning: disk is probably not bootable"));
 
        return 0;
 }
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/arch/x68k/md.c
--- a/usr.sbin/sysinst/arch/x68k/md.c   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/arch/x68k/md.c   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:03 martin Exp $ */
+/*     $NetBSD: md.c,v 1.5 2018/05/18 12:23:23 joerg Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -280,7 +280,7 @@
            "/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
            pm->diskdev))
                process_menu(MENU_ok,
-                       deconst("Warning: disk is probably not bootable"));
+                       __UNCONST("Warning: disk is probably not bootable"));
        return 0;
 }
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $  */
+/*     $NetBSD: bsddisklabel.c,v 1.3 2018/05/18 12:23:22 joerg Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -800,7 +800,7 @@
        } else
                rv = -1;
        if (rv != 0) {
-               process_menu(MENU_ok, deconst(MSG_No_Bootcode));
+               process_menu(MENU_ok, __UNCONST(MSG_No_Bootcode));
                return 0;
        }
 #endif
@@ -808,7 +808,7 @@
        fstype = pm->bsdlabel[pm->rootpart].pi_fstype;
        if (fstype == FS_BSDFFS &&
            (pm->bsdlabel[pm->rootpart].pi_flags & PIF_FFSv2) != 0) {
-               process_menu(MENU_ok, deconst(MSG_cannot_ufs2_root));
+               process_menu(MENU_ok, __UNCONST(MSG_cannot_ufs2_root));
                return 0;
        }
 #endif
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/defs.h   Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.9 2015/05/11 13:07:57 martin Exp $  */
+/*     $NetBSD: defs.h,v 1.10 2018/05/18 12:23:22 joerg Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -45,12 +45,6 @@
 
 const char *getfslabelname(uint8_t);
 
-static inline void *
-deconst(const void *p)
-{
-       return (char *)0 + ((const char *)p - (const char *)0);
-}
-
 #include "msg_defs.h"
 #include "menu_defs.h"
 
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/menus.mi
--- a/usr.sbin/sysinst/menus.mi Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/menus.mi Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.mi,v 1.11 2016/12/11 00:56:34 alnsn Exp $        */
+/*     $NetBSD: menus.mi,v 1.12 2018/05/18 12:23:22 joerg Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -664,7 +664,7 @@
                                                                };
        option MSG_fmtasraid,   exit, action {
                                                                        if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, deconst(MSG_notsupported));
+                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
                                                                                return -1;
                                                                        }
                                                                        pm->unsaved = 1;
@@ -673,7 +673,7 @@
                                                                };
        option MSG_fmtaslvm,    exit, action {
                                                                        if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, deconst(MSG_notsupported));
+                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
                                                                                return -1;
                                                                        }
                                                                        pm->unsaved = 1;
@@ -683,7 +683,7 @@
                                                                };
        option MSG_encrypt,             exit, action {
                                                                        if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, deconst(MSG_notsupported));
+                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
                                                                                return -1;
                                                                        }
                                                                        pm->unsaved = 1;
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/net.c    Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.23 2016/12/13 19:03:49 roy Exp $     */
+/*     $NetBSD: net.c,v 1.24 2018/05/18 12:23:22 joerg Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -964,7 +964,7 @@
        arg_rv arg;
 
        arg.rv = -1;
-       arg.arg = deconst(xfer_type);
+       arg.arg = __UNCONST(xfer_type);
        process_menu(MENU_ftpsource, &arg);
        
        if (arg.rv == SET_RETRY)
diff -r 8aeebf38b492 -r 3acf7fbd86da usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Fri May 18 10:09:02 2018 +0000
+++ b/usr.sbin/sysinst/partman.c        Fri May 18 12:23:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.21 2018/05/01 21:28:39 kre Exp $ */
+/*     $NetBSD: partman.c,v 1.22 2018/05/18 12:23:22 joerg Exp $ */
 
 /*



Home | Main Index | Thread Index | Old Index