Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make From Max Okumoto:



details:   https://anonhg.NetBSD.org/src/rev/eb37cd99240c
branches:  trunk
changeset: 583482:eb37cd99240c
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Aug 08 16:42:54 2005 +0000

description:
>From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.

diffstat:

 usr.bin/make/arch.c               |   58 +++++++++---------
 usr.bin/make/buf.c                |    8 +-
 usr.bin/make/compat.c             |   16 ++--
 usr.bin/make/cond.c               |   18 +++---
 usr.bin/make/dir.c                |   61 ++++++++++----------
 usr.bin/make/for.c                |   14 ++--
 usr.bin/make/job.c                |   30 +++++-----
 usr.bin/make/lst.lib/lstConcat.c  |    8 +-
 usr.bin/make/lst.lib/lstDestroy.c |   14 ++--
 usr.bin/make/lst.lib/lstRemove.c  |    8 +-
 usr.bin/make/main.c               |   10 +-
 usr.bin/make/make.c               |   28 ++++----
 usr.bin/make/parse.c              |   50 ++++++++--------
 usr.bin/make/str.c                |   16 ++--
 usr.bin/make/suff.c               |   64 ++++++++++----------
 usr.bin/make/targ.c               |   26 ++++----
 usr.bin/make/util.c               |   12 ++--
 usr.bin/make/var.c                |  114 +++++++++++++++++++-------------------
 18 files changed, 277 insertions(+), 278 deletions(-)

diffs (truncated from 2179 to 300 lines):

diff -r 161399d0da49 -r eb37cd99240c usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Mon Aug 08 14:05:37 2005 +0000
+++ b/usr.bin/make/arch.c       Mon Aug 08 16:42:54 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.47 2005/08/05 00:53:18 christos Exp $       */
+/*     $NetBSD: arch.c,v 1.48 2005/08/08 16:42:54 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.47 2005/08/05 00:53:18 christos Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.48 2005/08/08 16:42:54 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.47 2005/08/05 00:53:18 christos Exp $");
+__RCSID("$NetBSD: arch.c,v 1.48 2005/08/08 16:42:54 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -193,13 +193,13 @@
 static void
 ArchFree(ClientData ap)
 {
-    Arch *a = (Arch *) ap;
+    Arch *a = (Arch *)ap;
     Hash_Search          search;
     Hash_Entry   *entry;
 
     /* Free memory from hash entries */
     for (entry = Hash_EnumFirst(&a->members, &search);
-        entry != (Hash_Entry *)NULL;
+        entry != NULL;
         entry = Hash_EnumNext(&search))
        free(Hash_GetValue(entry));
 
@@ -497,7 +497,7 @@
 static int
 ArchFindArchive(ClientData ar, ClientData archName)
 {
-    return (strcmp((char *) archName, ((Arch *) ar)->name));
+    return (strcmp((char *)archName, ((Arch *)ar)->name));
 }
 
 /*-
@@ -545,7 +545,7 @@
      * the comparisons easier...
      */
     cp = strrchr(member, '/');
-    if (cp != (char *) NULL) {
+    if (cp != NULL) {
        member = cp + 1;
     }
 
@@ -555,7 +555,7 @@
 
        he = Hash_FindEntry(&ar->members, member);
 
-       if (he != (Hash_Entry *) NULL) {
+       if (he != NULL) {
            return ((struct ar_hdr *)Hash_GetValue(he));
        } else {
            /* Try truncated name */
@@ -569,7 +569,7 @@
            }
            if ((he = Hash_FindEntry(&ar->members, copy)) != NULL)
                return ((struct ar_hdr *)Hash_GetValue(he));
-           return ((struct ar_hdr *) NULL);
+           return (NULL);
        }
     }
 
@@ -585,8 +585,8 @@
 
         arch = ArchFindMember(archive, member, &sarh, "r");
 
-        if (arch == (FILE *)NULL) {
-           return ((struct ar_hdr *)NULL);
+        if (arch == NULL) {
+           return (NULL);
        } else {
            fclose(arch);
            return (&sarh);
@@ -598,8 +598,8 @@
      * everything that's in it and cache it so we can get at it quickly.
      */
     arch = fopen(archive, "r");
-    if (arch == (FILE *) NULL) {
-       return ((struct ar_hdr *) NULL);
+    if (arch == NULL) {
+       return (NULL);
     }
 
     /*
@@ -609,7 +609,7 @@
     if ((fread(magic, SARMAG, 1, arch) != 1) ||
        (strncmp(magic, ARMAG, SARMAG) != 0)) {
            fclose(arch);
-           return ((struct ar_hdr *) NULL);
+           return (NULL);
     }
 
     ar = emalloc(sizeof(Arch));
@@ -687,7 +687,7 @@
            }
 #endif
 
-           he = Hash_CreateEntry(&ar->members, memName, (Boolean *)NULL);
+           he = Hash_CreateEntry(&ar->members, memName, NULL);
            Hash_SetValue(he, emalloc(sizeof(struct ar_hdr)));
            memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr));
        }
@@ -704,10 +704,10 @@
      */
     he = Hash_FindEntry(&ar->members, member);
 
-    if (he != (Hash_Entry *) NULL) {
+    if (he != NULL) {
        return ((struct ar_hdr *)Hash_GetValue(he));
     } else {
-       return ((struct ar_hdr *) NULL);
+       return (NULL);
     }
 
 badarch:
@@ -716,7 +716,7 @@
     if (ar->fnametab)
        free(ar->fnametab);
     free(ar);
-    return ((struct ar_hdr *) NULL);
+    return (NULL);
 }
 
 #ifdef SVR4ARCHIVES
@@ -856,8 +856,8 @@
     int                  len, tlen;
 
     arch = fopen(archive, mode);
-    if (arch == (FILE *) NULL) {
-       return ((FILE *) NULL);
+    if (arch == NULL) {
+       return (NULL);
     }
 
     /*
@@ -867,7 +867,7 @@
     if ((fread(magic, SARMAG, 1, arch) != 1) ||
        (strncmp(magic, ARMAG, SARMAG) != 0)) {
            fclose(arch);
-           return ((FILE *) NULL);
+           return (NULL);
     }
 
     /*
@@ -877,7 +877,7 @@
      * the comparisons easier...
      */
     cp = strrchr(member, '/');
-    if (cp != (char *) NULL) {
+    if (cp != NULL) {
        member = cp + 1;
     }
     len = tlen = strlen(member);
@@ -892,7 +892,7 @@
              * and there's no way we can recover...
              */
             fclose(arch);
-            return ((FILE *) NULL);
+            return (NULL);
        } else if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
            /*
             * If the member's name doesn't take up the entire 'name' field,
@@ -968,7 +968,7 @@
      * archive and return NULL -- an error.
      */
     fclose(arch);
-    return ((FILE *) NULL);
+    return (NULL);
 }
 
 /*-
@@ -1005,7 +1005,7 @@
        free(p2);
     snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now);
 
-    if (arch != (FILE *) NULL) {
+    if (arch != NULL) {
        (void)fwrite((char *)&arh, sizeof(struct ar_hdr), 1, arch);
        fclose(arch);
     }
@@ -1044,7 +1044,7 @@
     arch = ArchFindMember(gn->path, UNCONST(RANLIBMAG), &arh, "r+");
     snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now);
 
-    if (arch != (FILE *) NULL) {
+    if (arch != NULL) {
        (void)fwrite((char *)&arh, sizeof(struct ar_hdr), 1, arch);
        fclose(arch);
 
@@ -1086,7 +1086,7 @@
     if (p2)
        free(p2);
 
-    if (arhPtr != (struct ar_hdr *) NULL) {
+    if (arhPtr != NULL) {
        modTime = (time_t)strtol(arhPtr->ar_date, NULL, 10);
     } else {
        modTime = 0;
@@ -1195,7 +1195,7 @@
 #ifdef LIBRARIES
     Var_Set(TARGET, gn->name, gn, 0);
 #else
-    Var_Set(TARGET, gn->path == (char *) NULL ? gn->name : gn->path, gn, 0);
+    Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn, 0);
 #endif /* LIBRARIES */
 }
 
@@ -1257,7 +1257,7 @@
 
        arhPtr = ArchStatMember(gn->path, UNCONST(RANLIBMAG), FALSE);
 
-       if (arhPtr != (struct ar_hdr *)NULL) {
+       if (arhPtr != NULL) {
            modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10);
 
            if (DEBUG(ARCH) || DEBUG(MAKE)) {
diff -r 161399d0da49 -r eb37cd99240c usr.bin/make/buf.c
--- a/usr.bin/make/buf.c        Mon Aug 08 14:05:37 2005 +0000
+++ b/usr.bin/make/buf.c        Mon Aug 08 16:42:54 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.c,v 1.18 2005/08/05 00:53:18 christos Exp $        */
+/*     $NetBSD: buf.c,v 1.19 2005/08/08 16:42:54 christos Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.18 2005/08/05 00:53:18 christos Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.19 2005/08/08 16:42:54 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)buf.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: buf.c,v 1.18 2005/08/05 00:53:18 christos Exp $");
+__RCSID("$NetBSD: buf.c,v 1.19 2005/08/08 16:42:54 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -191,7 +191,7 @@
 Buf_GetAll(Buffer bp, int *numBytesPtr)
 {
 
-    if (numBytesPtr != (int *)NULL) {
+    if (numBytesPtr != NULL) {
        *numBytesPtr = bp->inPtr - bp->outPtr;
     }
 
diff -r 161399d0da49 -r eb37cd99240c usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Aug 08 14:05:37 2005 +0000
+++ b/usr.bin/make/compat.c     Mon Aug 08 16:42:54 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 christos Exp $     */
+/*     $NetBSD: compat.c,v 1.60 2005/08/08 16:42:54 christos Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 christos Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.60 2005/08/08 16:42:54 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.59 2005/07/25 22:55:58 christos Exp $");
+__RCSID("$NetBSD: compat.c,v 1.60 2005/08/08 16:42:54 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -219,8 +219,8 @@
                                 * dynamically allocated */
     Boolean      local;        /* TRUE if command should be executed
                                 * locally */
-    char         *cmd = (char *) cmdp;
-    GNode        *gn = (GNode *) gnp;
+    char         *cmd = (char *)cmdp;



Home | Main Index | Thread Index | Old Index