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(1): rename type Suff to Suffix
details: https://anonhg.NetBSD.org/src/rev/60c39e44ca32
branches: trunk
changeset: 946237:60c39e44ca32
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 21 19:15:06 2020 +0000
description:
make(1): rename type Suff to Suffix
This avoids confusion with the module suff.c of the same name.
The existing naming convention is that the module's public functions are
named Suff_Func and its private functions are named SuffFunc. This
collides with the naming convention that a the functions of the type Suff
are called Suff_Func as well.
To resolve this collision, rename Suff to Suffix. The related types like
SuffList and the affected functions like SuffRef will be renamed in a
follow-up commit.
diffstat:
usr.bin/make/make.h | 4 +-
usr.bin/make/suff.c | 120 ++++++++++++++++++++++++++--------------------------
2 files changed, 62 insertions(+), 62 deletions(-)
diffs (truncated from 493 to 300 lines):
diff -r fce5810169b6 -r 60c39e44ca32 usr.bin/make/make.h
--- a/usr.bin/make/make.h Sat Nov 21 19:02:58 2020 +0000
+++ b/usr.bin/make/make.h Sat Nov 21 19:15:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.211 2020/11/21 18:41:57 rillig Exp $ */
+/* $NetBSD: make.h,v 1.212 2020/11/21 19:15:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -378,7 +378,7 @@
/* Suffix for the node (determined by Suff_FindDeps and opaque to everyone
* but the Suff module) */
- struct Suff *suffix;
+ struct Suffix *suffix;
/* Filename where the GNode got defined */
/* XXX: What is the lifetime of this string? */
diff -r fce5810169b6 -r 60c39e44ca32 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Sat Nov 21 19:02:58 2020 +0000
+++ b/usr.bin/make/suff.c Sat Nov 21 19:15:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -152,7 +152,7 @@
typedef List SuffListList;
-typedef struct Suff {
+typedef struct Suffix {
/* The suffix itself, such as ".c" */
char *name;
/* Length of the name, to avoid strlen calls */
@@ -175,7 +175,7 @@
* apparent reason. They do have the side effect of increasing refCount
* though. */
SuffListList *ref;
-} Suff;
+} Suffix;
/*
* Structure used in the search for implied sources.
@@ -183,7 +183,7 @@
typedef struct Src {
char *file; /* The file to look for */
char *pref; /* Prefix from which file was formed */
- Suff *suff; /* The suffix on the file */
+ Suffix *suff; /* The suffix on the file */
struct Src *parent; /* The Src for which this is a source */
GNode *node; /* The node describing the file */
int numChildren; /* Count of existing children (so we don't free
@@ -195,24 +195,24 @@
/* TODO: Document the difference between nullSuff and emptySuff. */
/* The NULL suffix for this run */
-static Suff *nullSuff;
+static Suffix *nullSuff;
/* The empty suffix required for POSIX single-suffix transformation rules */
-static Suff *emptySuff;
+static Suffix *emptySuff;
static void SuffFindDeps(GNode *, SrcList *);
static void SuffExpandWildcards(GNodeListNode *, GNode *);
-static Suff *
-SuffRef(Suff *suff)
+static Suffix *
+SuffRef(Suffix *suff)
{
suff->refCount++;
return suff;
}
-/* Change the value of a Suff variable, adjusting the reference counts. */
+/* Change the value of a Suffix variable, adjusting the reference counts. */
static void
-SuffReassign(Suff **var, Suff *suff)
+SuffReassign(Suffix **var, Suffix *suff)
{
if (*var != NULL)
(*var)->refCount--;
@@ -220,9 +220,9 @@
suff->refCount++;
}
-/* Set a Suff variable to NULL, adjusting the reference count. */
+/* Set a Suffix variable to NULL, adjusting the reference count. */
static void
-SuffUnassign(Suff **var)
+SuffUnassign(Suffix **var)
{
if (*var != NULL)
(*var)->refCount--;
@@ -249,7 +249,7 @@
* Return NULL if it ain't, pointer to the start of suffix in name if it is.
*/
static const char *
-SuffSuffGetSuffix(const Suff *suff, size_t nameLen, const char *nameEnd)
+SuffSuffGetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
{
const char *p1; /* Pointer into suffix name */
const char *p2; /* Pointer into string being examined */
@@ -270,25 +270,25 @@
}
static Boolean
-SuffSuffIsSuffix(const Suff *suff, size_t nameLen, const char *nameEnd)
+SuffSuffIsSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
{
return SuffSuffGetSuffix(suff, nameLen, nameEnd) != NULL;
}
-static Suff *
+static Suffix *
FindSuffByNameLen(const char *name, size_t nameLen)
{
SuffListNode *ln;
for (ln = sufflist->first; ln != NULL; ln = ln->next) {
- Suff *suff = ln->datum;
+ Suffix *suff = ln->datum;
if (suff->nameLen == nameLen && memcmp(suff->name, name, nameLen) == 0)
return suff;
}
return NULL;
}
-static Suff *
+static Suffix *
FindSuffByName(const char *name)
{
return FindSuffByNameLen(name, strlen(name));
@@ -307,7 +307,7 @@
}
static void
-SuffList_Unref(SuffList *list, Suff *suff)
+SuffList_Unref(SuffList *list, Suffix *suff)
{
SuffListNode *ln = Lst_FindDatum(list, suff);
if (ln != NULL) {
@@ -320,7 +320,7 @@
static void
SuffFree(void *sp)
{
- Suff *suff = sp;
+ Suffix *suff = sp;
if (suff == nullSuff)
nullSuff = NULL;
@@ -346,7 +346,7 @@
/* Remove the suffix from the list, and free if it is otherwise unused. */
static void
-SuffList_Remove(SuffList *list, Suff *suff)
+SuffList_Remove(SuffList *list, Suffix *suff)
{
SuffList_Unref(list, suff);
if (suff->refCount == 0) {
@@ -360,10 +360,10 @@
/* Insert the suffix into the list, keeping the list ordered by suffix
* number. */
static void
-SuffList_Insert(SuffList *list, Suff *suff)
+SuffList_Insert(SuffList *list, Suffix *suff)
{
SuffListNode *ln;
- Suff *listSuff = NULL;
+ Suffix *listSuff = NULL;
for (ln = list->first; ln != NULL; ln = ln->next) {
listSuff = ln->datum;
@@ -387,16 +387,16 @@
}
static void
-SuffRelate(Suff *srcSuff, Suff *targSuff)
+SuffRelate(Suffix *srcSuff, Suffix *targSuff)
{
SuffList_Insert(targSuff->children, srcSuff);
SuffList_Insert(srcSuff->parents, targSuff);
}
-static Suff *
+static Suffix *
SuffNew(const char *name)
{
- Suff *suff = bmake_malloc(sizeof *suff);
+ Suffix *suff = bmake_malloc(sizeof *suff);
suff->name = bmake_strdup(name);
suff->nameLen = strlen(suff->name);
@@ -442,10 +442,10 @@
* Return TRUE if the string is a valid transformation.
*/
static Boolean
-SuffParseTransform(const char *str, Suff **out_src, Suff **out_targ)
+SuffParseTransform(const char *str, Suffix **out_src, Suffix **out_targ)
{
SuffListNode *ln;
- Suff *singleSrc = NULL;
+ Suffix *singleSrc = NULL;
/*
* Loop looking first for a suffix that matches the start of the
@@ -454,7 +454,7 @@
* parsed the string.
*/
for (ln = sufflist->first; ln != NULL; ln = ln->next) {
- Suff *src = ln->datum;
+ Suffix *src = ln->datum;
if (SuffStrIsPrefix(src->name, str) == NULL)
continue;
@@ -462,7 +462,7 @@
if (str[src->nameLen] == '\0') {
singleSrc = src;
} else {
- Suff *targ = FindSuffByName(str + src->nameLen);
+ Suffix *targ = FindSuffByName(str + src->nameLen);
if (targ != NULL) {
*out_src = src;
*out_targ = targ;
@@ -494,7 +494,7 @@
Boolean
Suff_IsTransform(const char *str)
{
- Suff *src, *targ;
+ Suffix *src, *targ;
return SuffParseTransform(str, &src, &targ);
}
@@ -513,8 +513,8 @@
GNode *
Suff_AddTransform(const char *name)
{
- Suff *srcSuff;
- Suff *targSuff;
+ Suffix *srcSuff;
+ Suffix *targSuff;
GNode *gn = FindTransformByName(name);
if (gn == NULL) {
@@ -567,7 +567,7 @@
void
Suff_EndTransform(GNode *gn)
{
- Suff *srcSuff, *targSuff;
+ Suffix *srcSuff, *targSuff;
SuffList *srcSuffParents;
if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
@@ -611,7 +611,7 @@
* suff Suffix to rebuild
*/
static void
-SuffRebuildGraph(GNode *transform, Suff *suff)
+SuffRebuildGraph(GNode *transform, Suffix *suff)
{
const char *name = transform->name;
size_t nameLen = strlen(name);
@@ -622,7 +622,7 @@
*/
toName = SuffStrIsPrefix(suff->name, name);
if (toName != NULL) {
- Suff *to = FindSuffByName(toName);
+ Suffix *to = FindSuffByName(toName);
if (to != NULL) {
/* Link in and return, since it can't be anything else. */
SuffRelate(suff, to);
@@ -635,7 +635,7 @@
*/
toName = SuffSuffGetSuffix(suff, nameLen, name + nameLen);
if (toName != NULL) {
- Suff *from = FindSuffByNameLen(name, (size_t)(toName - name));
+ Suffix *from = FindSuffByNameLen(name, (size_t)(toName - name));
if (from != NULL)
SuffRelate(from, suff);
}
@@ -652,10 +652,10 @@
* TRUE iff a new main target has been selected.
*/
static Boolean
-SuffUpdateTarget(GNode *target, GNode **inout_main, Suff *suff,
+SuffUpdateTarget(GNode *target, GNode **inout_main, Suffix *suff,
Boolean *inout_removedMain)
{
Home |
Main Index |
Thread Index |
Old Index