Module Name:    src
Committed By:   rillig
Date:           Sat Dec 12 19:13:48 UTC 2020

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

Log Message:
make(1): remove redundant call to strlen in Str_Words


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/str.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/str.c
diff -u src/usr.bin/make/str.c:1.74 src/usr.bin/make/str.c:1.75
--- src/usr.bin/make/str.c:1.74	Mon Nov 16 18:28:27 2020
+++ src/usr.bin/make/str.c	Sat Dec 12 19:13:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.74 2020/11/16 18:28:27 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.75 2020/12/12 19:13:47 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.74 2020/11/16 18:28:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.75 2020/12/12 19:13:47 rillig Exp $");
 
 /* Return the concatenation of s1 and s2, freshly allocated. */
 char *
@@ -142,7 +142,7 @@ Str_Words(const char *str, Boolean expan
 
 	/* words_buf holds the words, separated by '\0'. */
 	str_len = strlen(str);
-	words_buf = bmake_malloc(strlen(str) + 1);
+	words_buf = bmake_malloc(str_len + 1);
 
 	words_cap = str_len / 5 > 50 ? str_len / 5 : 50;
 	words = bmake_malloc((words_cap + 1) * sizeof(char *));

Reply via email to