Module Name: src
Committed By: rillig
Date: Mon Sep 28 23:13:57 UTC 2020
Modified Files:
src/usr.bin/make: compat.c cond.c dir.c job.c make.c parse.c suff.c
Log Message:
make(1): replace += 1 with ++ and -= 1 with --
Just for visual consistency. The generated code stays exactly the same.
To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/compat.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/make/cond.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/make/dir.c
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/make/job.c
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/make/make.c
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/parse.c
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/suff.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/compat.c
diff -u src/usr.bin/make/compat.c:1.158 src/usr.bin/make/compat.c:1.159
--- src/usr.bin/make/compat.c:1.158 Mon Sep 28 22:23:35 2020
+++ src/usr.bin/make/compat.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.158 2020/09/28 22:23:35 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.159 2020/09/28 23:13:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.158 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.159 2020/09/28 23:13:57 rillig Exp $");
static GNode *curTarg = NULL;
static void CompatInterrupt(int);
@@ -721,7 +721,7 @@ Compat_Run(GNodeList *targs)
printf("`%s' is up to date.\n", gn->name);
} else if (gn->made == ABORTED) {
printf("`%s' not remade because of errors.\n", gn->name);
- errors += 1;
+ errors++;
}
}
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.154 src/usr.bin/make/cond.c:1.155
--- src/usr.bin/make/cond.c:1.154 Mon Sep 28 20:46:11 2020
+++ src/usr.bin/make/cond.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.154 2020/09/28 20:46:11 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.155 2020/09/28 23:13:57 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.154 2020/09/28 20:46:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.155 2020/09/28 23:13:57 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -642,7 +642,7 @@ CondParser_Comparison(CondParser *par, B
if (par->p[1] == '=') {
par->p += 2;
} else {
- par->p += 1;
+ par->p++;
}
break;
default:
Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.152 src/usr.bin/make/dir.c:1.153
--- src/usr.bin/make/dir.c:1.152 Mon Sep 28 22:23:35 2020
+++ src/usr.bin/make/dir.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.152 2020/09/28 22:23:35 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.153 2020/09/28 23:13:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: dir.c,v 1.152 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.153 2020/09/28 23:13:57 rillig Exp $");
#define DIR_DEBUG0(text) DEBUG0(DIR, text)
#define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -375,12 +375,12 @@ Dir_InitCur(const char *cdname)
* Keep this one around too.
*/
if ((dir = Dir_AddDir(NULL, cdname))) {
- dir->refCount += 1;
+ dir->refCount++;
if (cur && cur != dir) {
/*
* We've been here before, cleanup.
*/
- cur->refCount -= 1;
+ cur->refCount--;
Dir_Destroy(cur);
}
cur = dir;
@@ -412,7 +412,7 @@ Dir_InitDot(void)
* We always need to have dot around, so we increment its reference count
* to make sure it's not destroyed.
*/
- dot->refCount += 1;
+ dot->refCount++;
Dir_SetPATH(); /* initialize */
}
@@ -422,11 +422,11 @@ Dir_End(void)
{
#ifdef CLEANUP
if (cur) {
- cur->refCount -= 1;
+ cur->refCount--;
Dir_Destroy(cur);
}
- dot->refCount -= 1;
- dotLast->refCount -= 1;
+ dot->refCount--;
+ dotLast->refCount--;
Dir_Destroy(dotLast);
Dir_Destroy(dot);
Dir_ClearPath(dirSearchPath);
@@ -900,8 +900,8 @@ DirLookup(CachedDir *dir, const char *na
file = str_concat3(dir->name, "/", cp);
DIR_DEBUG1(" returning %s\n", file);
- dir->hits += 1;
- hits += 1;
+ dir->hits++;
+ hits++;
return file;
}
@@ -938,7 +938,7 @@ DirLookupSubdir(CachedDir *dir, const ch
DIR_DEBUG1("checking %s ...\n", file);
if (cached_stat(file, &mst) == 0) {
- nearmisses += 1;
+ nearmisses++;
return file;
}
free(file);
@@ -987,8 +987,8 @@ DirLookupAbs(CachedDir *dir, const char
return bmake_strdup("");
}
- dir->hits += 1;
- hits += 1;
+ dir->hits++;
+ hits++;
DIR_DEBUG1(" returning %s\n", name);
return bmake_strdup(name);
}
@@ -1012,14 +1012,14 @@ DirFindDot(Boolean hasSlash MAKE_ATTR_UN
if (Hash_FindEntry(&dot->files, cp) != NULL) {
DIR_DEBUG0(" in '.'\n");
- hits += 1;
- dot->hits += 1;
+ hits++;
+ dot->hits++;
return bmake_strdup(name);
}
if (cur && Hash_FindEntry(&cur->files, cp) != NULL) {
DIR_DEBUG1(" in ${.CURDIR} = %s\n", cur->name);
- hits += 1;
- cur->hits += 1;
+ hits++;
+ cur->hits++;
return str_concat3(cur->name, "/", cp);
}
@@ -1067,7 +1067,7 @@ Dir_FindFile(const char *name, SearchPat
base = strrchr(name, '/');
if (base) {
hasSlash = TRUE;
- base += 1;
+ base++;
} else {
hasSlash = FALSE;
base = name;
@@ -1077,7 +1077,7 @@ Dir_FindFile(const char *name, SearchPat
if (path == NULL) {
DIR_DEBUG0("couldn't open path, file not found\n");
- misses += 1;
+ misses++;
return NULL;
}
@@ -1149,7 +1149,7 @@ Dir_FindFile(const char *name, SearchPat
*/
if (!hasSlash) {
DIR_DEBUG0(" failed.\n");
- misses += 1;
+ misses++;
return NULL;
}
@@ -1277,13 +1277,13 @@ Dir_FindFile(const char *name, SearchPat
#ifdef notdef
if (base == trailing_dot) {
base = strrchr(name, '/');
- base += 1;
+ base++;
}
base[-1] = '\0';
(void)Dir_AddDir(path, name);
base[-1] = '/';
- bigmisses += 1;
+ bigmisses++;
ln = Lst_Last(path);
if (ln == NULL) {
return NULL;
@@ -1299,7 +1299,7 @@ Dir_FindFile(const char *name, SearchPat
#else /* !notdef */
DIR_DEBUG1(" Looking for \"%s\" ...\n", name);
- bigmisses += 1;
+ bigmisses++;
if (cached_stat(name, &mst) == 0) {
return bmake_strdup(name);
}
@@ -1508,7 +1508,7 @@ Dir_AddDir(SearchPath *path, const char
if (ln != NULL) {
dir = LstNode_Datum(ln);
if (Lst_FindDatum(path, dir) == NULL) {
- dir->refCount += 1;
+ dir->refCount++;
Lst_Append(path, dir);
}
return dir;
@@ -1559,7 +1559,7 @@ void *
Dir_CopyDir(void *p)
{
CachedDir *dir = (CachedDir *)p;
- dir->refCount += 1;
+ dir->refCount++;
return p;
}
@@ -1627,7 +1627,7 @@ void
Dir_Destroy(void *dirp)
{
CachedDir *dir = dirp;
- dir->refCount -= 1;
+ dir->refCount--;
if (dir->refCount == 0) {
CachedDirListNode *node;
@@ -1695,7 +1695,7 @@ Dir_Concat(SearchPath *path1, SearchPath
for (ln = path2->first; ln != NULL; ln = ln->next) {
CachedDir *dir = ln->datum;
if (Lst_FindDatum(path1, dir) == NULL) {
- dir->refCount += 1;
+ dir->refCount++;
Lst_Append(path1, dir);
}
}
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.251 src/usr.bin/make/job.c:1.252
--- src/usr.bin/make/job.c:1.251 Mon Sep 28 22:23:35 2020
+++ src/usr.bin/make/job.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.251 2020/09/28 22:23:35 rillig Exp $ */
+/* $NetBSD: job.c,v 1.252 2020/09/28 23:13:57 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.251 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.252 2020/09/28 23:13:57 rillig Exp $");
# define STATIC static
@@ -634,7 +634,7 @@ JobPrintCommand(void *cmdp, void *jobp)
(void)fprintf(job->cmdFILE, fmt, arg); \
(void)fflush(job->cmdFILE);
- numCommands += 1;
+ numCommands++;
Var_Subst(cmd, job->node, VARE_WANTRES, &cmd);
/* TODO: handle errors */
@@ -997,7 +997,7 @@ JobFinish(Job *job, int status)
Make_Update(job->node);
job->job_state = JOB_ST_FREE;
} else if (status != 0) {
- errors += 1;
+ errors++;
job->job_state = JOB_ST_FREE;
}
@@ -2327,7 +2327,7 @@ Job_ParseShell(char *line)
if (path == NULL) {
path = UNCONST(shellPath);
} else {
- path += 1;
+ path++;
}
if (newShell.name != NULL) {
shellName = newShell.name;
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.155 src/usr.bin/make/make.c:1.156
--- src/usr.bin/make/make.c:1.155 Mon Sep 28 23:02:02 2020
+++ src/usr.bin/make/make.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.155 2020/09/28 23:02:02 rillig Exp $ */
+/* $NetBSD: make.c,v 1.156 2020/09/28 23:13:57 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.155 2020/09/28 23:02:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.156 2020/09/28 23:13:57 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked = 1;
@@ -436,7 +436,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
Lst_Append(pgn->children, gn);
Lst_Append(gn->parents, pgn);
- pgn->unmade += 1;
+ pgn->unmade++;
}
Lst_Close(cgn->children);
@@ -617,7 +617,7 @@ Make_Update(GNode *cgn)
if ((centurion = cgn->centurion) != NULL) {
if (!Lst_IsEmpty(cgn->parents))
Punt("%s%s: cohort has parents", cgn->name, cgn->cohort_num);
- centurion->unmade_cohorts -= 1;
+ centurion->unmade_cohorts--;
if (centurion->unmade_cohorts < 0)
Error("Graph cycles through centurion %s", centurion->name);
} else {
@@ -676,7 +676,7 @@ Make_Update(GNode *cgn)
}
/* One more child of this parent is now made */
- pgn->unmade -= 1;
+ pgn->unmade--;
if (pgn->unmade < 0) {
if (DEBUG(MAKE)) {
debug_printf("Graph cycles through %s%s\n",
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.342 src/usr.bin/make/parse.c:1.343
--- src/usr.bin/make/parse.c:1.342 Mon Sep 28 22:23:35 2020
+++ src/usr.bin/make/parse.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.342 2020/09/28 22:23:35 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.343 2020/09/28 23:13:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.342 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.343 2020/09/28 23:13:57 rillig Exp $");
/* types and constants */
@@ -808,7 +808,7 @@ ParseLinkSrc(void *pgnp, void *data)
pgn = LstNode_Datum(Lst_Last(pgn->cohorts));
Lst_Append(pgn->children, cgn);
- pgn->unmade += 1;
+ pgn->unmade++;
if (args->specType == Not)
Lst_Append(cgn->parents, pgn);
@@ -866,7 +866,7 @@ TryApplyDependencyOperator(GNode *gn, GN
cohort->type = op | OP_INVISIBLE;
Lst_Append(gn->cohorts, cohort);
cohort->centurion = gn;
- gn->unmade_cohorts += 1;
+ gn->unmade_cohorts++;
snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
gn->unmade_cohorts);
} else {
@@ -1654,7 +1654,7 @@ ParseDoDependency(char *line)
} else {
if (*cp) {
*cp = '\0';
- cp += 1;
+ cp++;
}
ParseDoSrc(tOp, line, specType);
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.172 src/usr.bin/make/suff.c:1.173
--- src/usr.bin/make/suff.c:1.172 Mon Sep 28 22:23:35 2020
+++ src/usr.bin/make/suff.c Mon Sep 28 23:13:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.172 2020/09/28 22:23:35 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.173 2020/09/28 23:13:57 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.172 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.173 2020/09/28 23:13:57 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -931,7 +931,7 @@ SuffAddSrc(void *sp, void *lsp)
s2->suff = s;
s->refCount++;
s2->children = 0;
- targ->children += 1;
+ targ->children++;
Lst_Append(ls->l, s2);
#ifdef DEBUG_SRC
s2->cp = Lst_Init();
@@ -949,7 +949,7 @@ SuffAddSrc(void *sp, void *lsp)
s2->suff = s;
s->refCount++;
s2->children = 0;
- targ->children += 1;
+ targ->children++;
Lst_Append(ls->l, s2);
#ifdef DEBUG_SRC
s2->cp = Lst_Init();
@@ -1172,7 +1172,7 @@ SuffFindCmds(Src *targ, SrcList *slst)
ret->parent = targ;
ret->node = s;
ret->children = 0;
- targ->children += 1;
+ targ->children++;
#ifdef DEBUG_SRC
ret->cp = Lst_Init();
debug_printf("3 add %p %p\n", targ, ret);
@@ -1462,7 +1462,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
*/
Lst_Append(tGn->children, sGn);
Lst_Append(sGn->parents, tGn);
- tGn->unmade += 1;
+ tGn->unmade++;
/*
* Locate the transformation rule itself
@@ -1564,7 +1564,7 @@ SuffFindArchiveDeps(GNode *gn, SrcList *
*/
Lst_Append(gn->children, mem);
Lst_Append(mem->parents, gn);
- gn->unmade += 1;
+ gn->unmade++;
/*
* Copy in the variables from the member node to this one.