Module Name: src
Committed By: rillig
Date: Tue Sep 19 17:43:44 UTC 2023
Modified Files:
src/usr.bin/make: main.c
Log Message:
make: clean up code for parsing the '-j' command line option
No binary change.
To generate a diff of this commit:
cvs rdiff -u -r1.599 -r1.600 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.599 src/usr.bin/make/main.c:1.600
--- src/usr.bin/make/main.c:1.599 Sun Sep 10 21:52:36 2023
+++ src/usr.bin/make/main.c Tue Sep 19 17:43:43 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.599 2023/09/10 21:52:36 rillig Exp $ */
+/* $NetBSD: main.c,v 1.600 2023/09/19 17:43:43 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.599 2023/09/10 21:52:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.600 2023/09/19 17:43:43 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -403,7 +403,7 @@ MainParseArgJobs(const char *arg)
forceJobs = true;
opts.maxJobs = (int)strtol(arg, &end, 0);
- p = arg + (end - arg);
+ p = end;
#ifdef _SC_NPROCESSORS_ONLN
if (*p != '\0') {
double d;
@@ -412,10 +412,10 @@ MainParseArgJobs(const char *arg)
d = (opts.maxJobs > 0) ? opts.maxJobs : 1;
} else if (*p == '.') {
d = strtod(arg, &end);
- p = arg + (end - arg);
+ p = end;
} else
- d = 0;
- if (d > 0) {
+ d = 0.0;
+ if (d > 0.0) {
p = "";
opts.maxJobs = (int)sysconf(_SC_NPROCESSORS_ONLN);
opts.maxJobs = (int)(d * (double)opts.maxJobs);