Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make meta.c: use macro to access job->bm
details: https://anonhg.NetBSD.org/src/rev/749f5c2286bf
branches: trunk
changeset: 373755:749f5c2286bf
user: sjg <sjg%NetBSD.org@localhost>
date: Sat Feb 25 22:52:21 2023 +0000
description:
meta.c: use macro to access job->bm
and if job is NULL use Mybm.
No functional change.
diffstat:
usr.bin/make/meta.c | 54 +++++++++++-----------------------------------------
1 files changed, 12 insertions(+), 42 deletions(-)
diffs (125 lines):
diff -r 2b3a00b68b43 -r 749f5c2286bf usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Sat Feb 25 19:37:33 2023 +0000
+++ b/usr.bin/make/meta.c Sat Feb 25 22:52:21 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.202 2023/02/14 21:38:31 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.203 2023/02/25 22:52:21 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -99,6 +99,8 @@
# define strsep(s, d) stresep((s), (d), '\0')
#endif
+#define BM(job) (job != NULL) ? &job->bm : &Mybm
+
/*
* Filemon is a kernel module which snoops certain syscalls.
*
@@ -642,11 +644,7 @@
{
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
pbm->mfp = meta_create(pbm, gn);
#ifdef USE_FILEMON_ONCE
/* compat mode we open the filemon dev once per command */
@@ -673,11 +671,7 @@
#ifdef USE_FILEMON
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (pbm->mfp != NULL) {
close(fileno(pbm->mfp));
if (useFilemon && pbm->filemon != NULL) {
@@ -698,11 +692,7 @@
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (useFilemon && pbm->filemon != NULL) {
filemon_setpid_parent(pbm->filemon, pid);
}
@@ -715,11 +705,7 @@
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (useFilemon && pbm->filemon != NULL) {
return filemon_readfd(pbm->filemon);
}
@@ -733,11 +719,7 @@
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (useFilemon && pbm->filemon != NULL) {
return filemon_process(pbm->filemon);
}
@@ -751,13 +733,9 @@
char cwd[MAXPATHLEN];
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- if (gn == NULL)
+ pbm = BM(job);
+ if (job != NULL && gn == NULL)
gn = job->node;
- } else {
- pbm = &Mybm;
- }
if (pbm->mfp != NULL) {
fprintf(pbm->mfp, "\n*** Error code %d%s\n",
status, ignerr ? "(ignored)" : "");
@@ -779,11 +757,7 @@
{
BuildMon *pbm;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (pbm->mfp != NULL) {
if (metaVerbose) {
static char *meta_prefix = NULL;
@@ -851,11 +825,7 @@
int error = 0;
int x;
- if (job != NULL) {
- pbm = &job->bm;
- } else {
- pbm = &Mybm;
- }
+ pbm = BM(job);
if (pbm->mfp != NULL) {
error = meta_cmd_finish(pbm);
x = fclose(pbm->mfp);
Home |
Main Index |
Thread Index |
Old Index