Module Name:    src
Committed By:   joerg
Date:           Wed May 23 21:20:20 UTC 2018

Modified Files:
        src/usr.bin/mkdep: mkdep.c

Log Message:
deconst -> __UNCONST to avoid null pointer arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/mkdep/mkdep.c

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/mkdep/mkdep.c
diff -u src/usr.bin/mkdep/mkdep.c:1.44 src/usr.bin/mkdep/mkdep.c:1.45
--- src/usr.bin/mkdep/mkdep.c:1.44	Tue Jun 16 22:54:10 2015
+++ src/usr.bin/mkdep/mkdep.c	Wed May 23 21:20:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdep.c,v 1.44 2015/06/16 22:54:10 christos Exp $ */
+/* $NetBSD: mkdep.c,v 1.45 2018/05/23 21:20:20 joerg Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.");
-__RCSID("$NetBSD: mkdep.c,v 1.44 2015/06/16 22:54:10 christos Exp $");
+__RCSID("$NetBSD: mkdep.c,v 1.45 2018/05/23 21:20:20 joerg Exp $");
 #endif /* not lint */
 
 #include <sys/mman.h>
@@ -82,12 +82,6 @@ static int verbose;
 static void save_for_optional(const char *, const char *);
 static size_t write_optional(int, opt_t *, size_t);
 
-static inline void *
-deconst(const void *p)
-{
-	return (const char *)p - (const char *)0 + (char *)0;
-}
-
 __dead static void
 usage(void)
 {
@@ -119,8 +113,8 @@ run_cc(int argc, char **argv, const char
 	if ((args = malloc((argc + 3) * sizeof(char *))) == NULL)
 		err(EXIT_FAILURE, "malloc");
 
-	args[0] = deconst(CC);
-	args[1] = deconst("-M");
+	args[0] = __UNCONST(CC);
+	args[1] = __UNCONST("-M");
 	(void)memcpy(&args[2], argv, (argc + 1) * sizeof(char *));
 
 	if ((tmpdir = getenv("TMPDIR")) == NULL)

Reply via email to