Module Name:    src
Committed By:   rillig
Date:           Sun Nov 28 22:48:07 UTC 2021

Modified Files:
        src/usr.bin/make: buf.c buf.h make.c suff.c

Log Message:
make: move duplicate function Buf_AddFlag to buf.c

It is used only for debug output, therefore performance doesn't matter.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/buf.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/buf.h
cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/make.c
cvs rdiff -u -r1.354 -r1.355 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/buf.c
diff -u src/usr.bin/make/buf.c:1.52 src/usr.bin/make/buf.c:1.53
--- src/usr.bin/make/buf.c:1.52	Mon Jun 21 19:59:58 2021
+++ src/usr.bin/make/buf.c	Sun Nov 28 22:48:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.52 2021/06/21 19:59:58 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.53 2021/11/28 22:48:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
 #include "make.h"
 
 /*	"@(#)buf.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: buf.c,v 1.52 2021/06/21 19:59:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.53 2021/11/28 22:48:06 rillig Exp $");
 
 /* Make space in the buffer for adding at least 16 more bytes. */
 void
@@ -128,6 +128,16 @@ Buf_AddInt(Buffer *buf, int n)
 	Buf_AddBytes(buf, str, len);
 }
 
+void
+Buf_AddFlag(Buffer *buf, bool flag, const char *name)
+{
+	if (flag) {
+		if (buf->len > 0)
+			Buf_AddByte(buf, '|');
+		Buf_AddBytes(buf, name, strlen(name));
+	}
+}
+
 /* Mark the buffer as empty, so it can be filled with data again. */
 void
 Buf_Empty(Buffer *buf)

Index: src/usr.bin/make/buf.h
diff -u src/usr.bin/make/buf.h:1.43 src/usr.bin/make/buf.h:1.44
--- src/usr.bin/make/buf.h:1.43	Sat Apr  3 11:08:40 2021
+++ src/usr.bin/make/buf.h	Sun Nov 28 22:48:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.43 2021/04/03 11:08:40 rillig Exp $	*/
+/*	$NetBSD: buf.h,v 1.44 2021/11/28 22:48:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -111,6 +111,7 @@ void Buf_AddBytes(Buffer *, const char *
 void Buf_AddBytesBetween(Buffer *, const char *, const char *);
 void Buf_AddStr(Buffer *, const char *);
 void Buf_AddInt(Buffer *, int);
+void Buf_AddFlag(Buffer *, bool, const char *);
 void Buf_Empty(Buffer *);
 void Buf_Init(Buffer *);
 void Buf_InitSize(Buffer *, size_t);

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.246 src/usr.bin/make/make.c:1.247
--- src/usr.bin/make/make.c:1.246	Sun Nov 28 19:51:06 2021
+++ src/usr.bin/make/make.c	Sun Nov 28 22:48:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.246 2021/11/28 19:51:06 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.247 2021/11/28 22:48:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.246 2021/11/28 19:51:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.247 2021/11/28 22:48:06 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -138,16 +138,6 @@ make_abort(GNode *gn, int lineno)
 	abort();
 }
 
-static void
-Buf_AddFlag(Buffer *buf, bool flag, const char *name)
-{
-	if (flag) {
-		if (buf->len > 0)
-			Buf_AddByte(buf, '|');
-		Buf_AddBytes(buf, name, strlen(name));
-	}
-}
-
 static const char *
 GNodeType_ToString(GNodeType type, void **freeIt)
 {

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.354 src/usr.bin/make/suff.c:1.355
--- src/usr.bin/make/suff.c:1.354	Sun Nov 28 22:38:17 2021
+++ src/usr.bin/make/suff.c	Sun Nov 28 22:48:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.354 2021/11/28 22:38:17 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.355 2021/11/28 22:48:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.354 2021/11/28 22:38:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.355 2021/11/28 22:48:06 rillig Exp $");
 
 typedef List SuffixList;
 typedef ListNode SuffixListNode;
@@ -2125,16 +2125,6 @@ PrintSuffNames(const char *prefix, const
 }
 
 static void
-Buf_AddFlag(Buffer *buf, bool flag, const char *name)
-{
-	if (flag) {
-		if (buf->len > 0)
-			Buf_AddByte(buf, '|');
-		Buf_AddBytes(buf, name, strlen(name));
-	}
-}
-
-static void
 Suffix_Print(const Suffix *suff)
 {
 	Buffer buf;

Reply via email to