Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): remove redundant type casts



details:   https://anonhg.NetBSD.org/src/rev/9ae614daaac4
branches:  trunk
changeset: 956116:9ae614daaac4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 22 05:50:02 2020 +0000

description:
make(1): remove redundant type casts

This mainly affects the void pointers in callback functions for lists.
These had been necessary once when the parameter type was still
ClientData instead of void pointer.

diffstat:

 usr.bin/make/arch.c  |   6 +++---
 usr.bin/make/cond.c  |   6 +++---
 usr.bin/make/dir.c   |   9 ++++-----
 usr.bin/make/job.c   |   8 ++++----
 usr.bin/make/main.c  |   6 +++---
 usr.bin/make/make.c  |  10 +++++-----
 usr.bin/make/parse.c |   6 +++---
 usr.bin/make/str.c   |   6 +++---
 usr.bin/make/suff.c  |   6 +++---
 usr.bin/make/targ.c  |   6 +++---
 usr.bin/make/var.c   |   6 +++---
 11 files changed, 37 insertions(+), 38 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/arch.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.137 2020/10/19 21:57:37 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include    "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.137 2020/10/19 21:57:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -165,7 +165,7 @@
 static void
 ArchFree(void *ap)
 {
-    Arch *a = (Arch *)ap;
+    Arch *a = ap;
     HashIter hi;
     HashEntry *he;
 
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/cond.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.165 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.165 2020/10/22 05:50:02 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -355,7 +355,7 @@
 
     errno = 0;
     if (!*str) {
-       *value = (double)0;
+       *value = 0.0;
        return TRUE;
     }
     l_val = strtoul(str, &eptr, str[1] == 'x' ? 16 : 10);
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/dir.c        Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.171 2020/10/19 21:57:37 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.172 2020/10/22 05:50:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -135,7 +135,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.171 2020/10/19 21:57:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.172 2020/10/22 05:50:02 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1570,10 +1570,9 @@
 void *
 Dir_CopyDir(void *p)
 {
-    CachedDir *dir = (CachedDir *)p;
+    CachedDir *dir = p;
     dir->refCount++;
-
-    return p;
+    return dir;
 }
 
 /*-
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/job.c        Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.267 2020/10/19 23:43:55 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.268 2020/10/22 05:50:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.267 2020/10/19 23:43:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.268 2020/10/22 05:50:02 rillig Exp $");
 
 # define STATIC static
 
@@ -651,8 +651,8 @@
                                 * command */
     char *cmdStart;            /* Start of expanded command */
     char *escCmd = NULL;       /* Command with quotes/backticks escaped */
-    char *cmd = (char *)cmdp;
-    Job *job = (Job *)jobp;
+    char *cmd = cmdp;
+    Job *job = jobp;
 
     noSpecials = NoExecute(job->node);
 
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/main.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.379 2020/10/19 21:57:37 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.380 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.379 2020/10/19 21:57:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.380 2020/10/22 05:50:02 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2023,7 +2023,7 @@
        else if (bf >= 0)
            quietly = bf;
        else
-           quietly = (gn) ? ((gn->type  & (OP_MAKE)) != 0) : 0;
+           quietly = gn != NULL ? ((gn->type  & (OP_MAKE)) != 0) : 0;
     }
     return quietly;
 }
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/make.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.166 2020/10/19 23:43:55 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.167 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include    "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.166 2020/10/19 23:43:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.167 2020/10/22 05:50:02 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -363,8 +363,8 @@
 static int
 MakeFindChild(void *gnp, void *pgnp)
 {
-    GNode          *gn = (GNode *)gnp;
-    GNode          *pgn = (GNode *)pgnp;
+    GNode *gn = gnp;
+    GNode *pgn = pgnp;
 
     (void)Dir_MTime(gn, 0);
     Make_TimeStamp(pgn, gn);
@@ -1027,7 +1027,7 @@
 static int
 MakePrintStatus(void *gnp, void *v_errors)
 {
-    GNode *gn = (GNode *)gnp;
+    GNode *gn = gnp;
     int *errors = v_errors;
 
     if (gn->flags & DONECYCLE)
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/parse.c      Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.395 2020/10/20 22:50:55 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.396 2020/10/22 05:50:02 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.395 2020/10/20 22:50:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.396 2020/10/22 05:50:02 rillig Exp $");
 
 /* types and constants */
 
@@ -431,7 +431,7 @@
                return FALSE;
        }
 
-       *ret = (size_t) st.st_size;
+       *ret = (size_t)st.st_size;
        return TRUE;
 }
 
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/str.c
--- a/usr.bin/make/str.c        Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/str.c        Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.68 2020/10/05 19:27:47 rillig Exp $  */
+/*     $NetBSD: str.c,v 1.69 2020/10/22 05:50:02 rillig Exp $  */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*     "@(#)str.c      5.8 (Berkeley) 6/1/90"  */
-MAKE_RCSID("$NetBSD: str.c,v 1.68 2020/10/05 19:27:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.69 2020/10/22 05:50:02 rillig Exp $");
 
 /* Return the concatenation of s1 and s2, freshly allocated. */
 char *
@@ -169,7 +169,7 @@
                                else
                                        break;
                        } else {
-                               inquote = (char)ch;
+                               inquote = ch;
                                /* Don't miss "" or '' */
                                if (word_start == NULL && str_p[1] == inquote) {
                                        if (!expand) {
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/suff.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.212 2020/10/21 08:20:13 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.213 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.212 2020/10/21 08:20:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.213 2020/10/22 05:50:02 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -313,7 +313,7 @@
 static void
 SuffFree(void *sp)
 {
-    Suff *s = (Suff *)sp;
+    Suff *s = sp;
 
     if (s == suffNull)
        suffNull = NULL;
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/targ.c       Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.119 2020/10/19 23:43:55 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.120 2020/10/22 05:50:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.119 2020/10/19 23:43:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.120 2020/10/22 05:50:02 rillig Exp $");
 
 static GNodeList *allTargets;  /* the list of all targets found so far */
 #ifdef CLEANUP
@@ -215,7 +215,7 @@
 static void
 TargFreeGN(void *gnp)
 {
-    GNode *gn = (GNode *)gnp;
+    GNode *gn = gnp;
 
     free(gn->name);
     free(gn->uname);
diff -r e545c7ca8e2a -r 9ae614daaac4 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Thu Oct 22 05:35:21 2020 +0000
+++ b/usr.bin/make/var.c        Thu Oct 22 05:50:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.580 2020/10/22 05:35:21 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.581 2020/10/22 05:50:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */



Home | Main Index | Thread Index | Old Index