Module Name:    src
Committed By:   rillig
Date:           Sun Aug 23 18:53:13 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c

Log Message:
make(1): make Arch_MemMTime ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/make/arch.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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.93 src/usr.bin/make/arch.c:1.94
--- src/usr.bin/make/arch.c:1.93	Sun Aug 23 17:49:37 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 18:53:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig 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.93 2020/08/23 17:49:37 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1126,8 +1126,6 @@ Arch_MemMTime(GNode *gn)
 {
     LstNode 	  ln;
     GNode   	  *pgn;
-    char    	  *nameStart,
-		  *nameEnd;
 
     Lst_OpenS(gn->parents);
     while ((ln = Lst_NextS(gn->parents)) != NULL) {
@@ -1141,12 +1139,13 @@ Arch_MemMTime(GNode *gn)
 	     * child. We keep searching its parents in case some other
 	     * parent requires this child to exist...
 	     */
-	    nameStart = strchr(pgn->name, '(') + 1;
-	    nameEnd = strchr(nameStart, ')');
+	    const char *nameStart = strchr(pgn->name, '(') + 1;
+	    const char *nameEnd = strchr(nameStart, ')');
+	    size_t nameLen = (size_t)(nameEnd - nameStart);
 
 	    if ((pgn->flags & REMAKE) &&
-		strncmp(nameStart, gn->name, nameEnd - nameStart) == 0) {
-				     gn->mtime = Arch_MTime(pgn);
+		strncmp(nameStart, gn->name, nameLen) == 0) {
+		gn->mtime = Arch_MTime(pgn);
 	    }
 	} else if (pgn->flags & REMAKE) {
 	    /*

Reply via email to