Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make: inline SuffixFlags_ToString into Suffix_P...
details: https://anonhg.NetBSD.org/src/rev/95adf0b3c639
branches: trunk
changeset: 1026562:95adf0b3c639
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 28 22:38:17 2021 +0000
description:
make: inline SuffixFlags_ToString into Suffix_Print
This gets rid of the string literal "none" and the complicated memory
handling.
No functional change.
diffstat:
usr.bin/make/suff.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diffs (57 lines):
diff -r 81a15f28ae53 -r 95adf0b3c639 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Sun Nov 28 22:27:35 2021 +0000
+++ b/usr.bin/make/suff.c Sun Nov 28 22:38:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.353 2021/11/28 22:27:35 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.354 2021/11/28 22:38:17 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.353 2021/11/28 22:27:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.354 2021/11/28 22:38:17 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -2134,31 +2134,24 @@
}
}
-static const char *
-SuffixFlags_ToString(const Suffix *suff, void **freeIt)
+static void
+Suffix_Print(const Suffix *suff)
{
Buffer buf;
- Buf_InitSize(&buf, 32);
+ Buf_InitSize(&buf, 16);
Buf_AddFlag(&buf, suff->include, "SUFF_INCLUDE");
Buf_AddFlag(&buf, suff->library, "SUFF_LIBRARY");
Buf_AddFlag(&buf, suff->isNull, "SUFF_NULL");
- return buf.len == 0 ? "none" : (*freeIt = Buf_DoneData(&buf));
-}
-static void
-Suffix_Print(const Suffix *suff)
-{
debug_printf("# \"%s\" (num %d, ref %d)",
suff->name, suff->sNum, suff->refCount);
- if (suff->include || suff->library || suff->isNull) {
- void *flags_freeIt = NULL;
- debug_printf(" (%s)",
- SuffixFlags_ToString(suff, &flags_freeIt));
- free(flags_freeIt);
- }
+ if (buf.len > 0)
+ debug_printf(" (%s)", buf.data);
debug_printf("\n");
+ Buf_Done(&buf);
+
PrintSuffNames("To", &suff->parents);
PrintSuffNames("From", &suff->children);
Home |
Main Index |
Thread Index |
Old Index