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): remove word "Ptr" from variable names
details: https://anonhg.NetBSD.org/src/rev/c43b53b9b5a0
branches: trunk
changeset: 945630:c43b53b9b5a0
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Nov 02 19:07:09 2020 +0000
description:
make(1): remove word "Ptr" from variable names
Whether or not a variable is a pointer is obvious from the context.
Since the introduction of function prototypes in C90, this information
is checked by the compiler and no longer needs to be encoded in the
variable names.
diffstat:
usr.bin/make/arch.c | 63 +++++++++++++++++----------------
usr.bin/make/cond.c | 16 ++++----
usr.bin/make/unit-tests/include-sub.mk | 4 +-
usr.bin/make/var.c | 8 ++--
4 files changed, 46 insertions(+), 45 deletions(-)
diffs (287 lines):
diff -r 07b39dc26c0d -r c43b53b9b5a0 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c Mon Nov 02 18:58:06 2020 +0000
+++ b/usr.bin/make/arch.c Mon Nov 02 19:07:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.153 2020/11/02 19:07:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.153 2020/11/02 19:07:09 rillig Exp $");
#ifdef TARGET_MACHINE
#undef MAKE_MACHINE
@@ -189,18 +189,18 @@
* on the given list.
*
* Input:
- * linePtr Pointer to start of specification
+ * pp Pointer to start of specification, updated
* nodeLst Lst on which to place the nodes
* ctxt Context in which to expand variables
*
* Results:
- * TRUE if it was a valid specification. The linePtr is updated
+ * TRUE if it was a valid specification. The pp is updated
* to point to the first non-space after the archive spec. The
* nodes for the members are placed on the given list.
*-----------------------------------------------------------------------
*/
Boolean
-Arch_ParseArchive(char **linePtr, GNodeList *nodeLst, GNode *ctxt)
+Arch_ParseArchive(char **pp, GNodeList *nodeLst, GNode *ctxt)
{
char *cp; /* Pointer into line */
GNode *gn; /* New node */
@@ -211,7 +211,7 @@
Boolean subLibName; /* TRUE if libName should have/had
* variable substitution performed on it */
- libName = *linePtr;
+ libName = *pp;
subLibName = FALSE;
@@ -394,9 +394,9 @@
free(libName_freeIt);
cp++; /* skip the ')' */
- /* We promised that linePtr would be set up at the next non-space. */
+ /* We promised that pp would be set up at the next non-space. */
pp_skip_whitespace(&cp);
- *linePtr = cp;
+ *pp = cp;
return TRUE;
}
@@ -433,8 +433,8 @@
member = lastSlash + 1;
for (ln = archives->first; ln != NULL; ln = ln->next) {
- const Arch *archPtr = ln->datum;
- if (strcmp(archPtr->name, archive) == 0)
+ const Arch *a = ln->datum;
+ if (strcmp(a->name, archive) == 0)
break;
}
@@ -694,7 +694,7 @@
* archive Path to the archive
* member Name of member. If it is a path, only the last
* component is used.
- * arhPtr Pointer to header structure to be filled in
+ * out_arh Archive header to be filled in
* mode The mode for opening the stream
*
* Results:
@@ -704,7 +704,7 @@
*-----------------------------------------------------------------------
*/
static FILE *
-ArchFindMember(const char *archive, const char *member, struct ar_hdr *arhPtr,
+ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
const char *mode)
{
FILE *arch; /* Stream to archive */
@@ -736,13 +736,13 @@
member = lastSlash + 1;
len = tlen = strlen(member);
- if (len > sizeof(arhPtr->ar_name)) {
- tlen = sizeof(arhPtr->ar_name);
+ if (len > sizeof(out_arh->ar_name)) {
+ tlen = sizeof(out_arh->ar_name);
}
- while (fread((char *)arhPtr, sizeof(struct ar_hdr), 1, arch) == 1) {
+ while (fread((char *)out_arh, sizeof(struct ar_hdr), 1, arch) == 1) {
- if (strncmp(arhPtr->ar_fmag, ARFMAG, sizeof(arhPtr->ar_fmag)) != 0) {
+ if (strncmp(out_arh->ar_fmag, ARFMAG, sizeof(out_arh->ar_fmag)) != 0) {
/*
* The header is bogus, so the archive is bad
* and there's no way we can recover...
@@ -751,7 +751,7 @@
return NULL;
}
- if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
+ if (strncmp(member, out_arh->ar_name, tlen) == 0) {
/*
* If the member's name doesn't take up the entire 'name' field,
* we have to be careful of matching prefixes. Names are space-
@@ -759,7 +759,8 @@
* of the matched string is anything but a space, this isn't the
* member we sought.
*/
- if (tlen != sizeof arhPtr->ar_name && arhPtr->ar_name[tlen] != ' ')
+ if (tlen != sizeof out_arh->ar_name &&
+ out_arh->ar_name[tlen] != ' ')
goto skip;
/*
@@ -781,10 +782,10 @@
* BSD 4.4 extended AR format: #1/<namelen>, with name as the
* first <namelen> bytes of the file
*/
- if (strncmp(arhPtr->ar_name, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 &&
- ch_isdigit(arhPtr->ar_name[sizeof(AR_EFMT1) - 1]))
+ if (strncmp(out_arh->ar_name, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 &&
+ ch_isdigit(out_arh->ar_name[sizeof(AR_EFMT1) - 1]))
{
- int elen = atoi(&arhPtr->ar_name[sizeof(AR_EFMT1) - 1]);
+ int elen = atoi(&out_arh->ar_name[sizeof(AR_EFMT1) - 1]);
char ename[MAXPATHLEN + 1];
if ((unsigned int)elen > MAXPATHLEN) {
@@ -823,8 +824,8 @@
* extract the size of the file from the 'size' field of the
* header and round it up during the seek.
*/
- arhPtr->ar_size[sizeof(arhPtr->ar_size) - 1] = '\0';
- size = (int)strtol(arhPtr->ar_size, NULL, 10);
+ out_arh->ar_size[sizeof(out_arh->ar_size) - 1] = '\0';
+ size = (int)strtol(out_arh->ar_size, NULL, 10);
if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) {
fclose(arch);
return NULL;
@@ -912,12 +913,12 @@
time_t
Arch_MTime(GNode *gn)
{
- struct ar_hdr *arhPtr; /* Header of desired member */
+ struct ar_hdr *arh; /* Header of desired member */
time_t modTime; /* Modification time as an integer */
- arhPtr = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), TRUE);
- if (arhPtr != NULL) {
- modTime = (time_t)strtol(arhPtr->ar_date, NULL, 10);
+ arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), TRUE);
+ if (arh != NULL) {
+ modTime = (time_t)strtol(arh->ar_date, NULL, 10);
} else {
modTime = 0;
}
@@ -1042,13 +1043,13 @@
oodate = TRUE;
} else {
#ifdef RANLIBMAG
- struct ar_hdr *arhPtr; /* Header for __.SYMDEF */
+ struct ar_hdr *arh; /* Header for __.SYMDEF */
int modTimeTOC; /* The table-of-contents's mod time */
- arhPtr = ArchStatMember(gn->path, RANLIBMAG, FALSE);
+ arh = ArchStatMember(gn->path, RANLIBMAG, FALSE);
- if (arhPtr != NULL) {
- modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10);
+ if (arh != NULL) {
+ modTimeTOC = (int)strtol(arh->ar_date, NULL, 10);
if (DEBUG(ARCH) || DEBUG(MAKE)) {
debug_printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC));
diff -r 07b39dc26c0d -r c43b53b9b5a0 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Mon Nov 02 18:58:06 2020 +0000
+++ b/usr.bin/make/cond.c Mon Nov 02 19:07:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.173 2020/10/30 20:30:44 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.174 2020/11/02 19:07:09 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.173 2020/10/30 20:30:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.174 2020/11/02 19:07:09 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -674,21 +674,21 @@
}
static size_t
-ParseEmptyArg(const char **linePtr, Boolean doEval,
- const char *func MAKE_ATTR_UNUSED, char **argPtr)
+ParseEmptyArg(const char **pp, Boolean doEval,
+ const char *func MAKE_ATTR_UNUSED, char **out_arg)
{
void *val_freeIt;
const char *val;
size_t magic_res;
/* We do all the work here and return the result as the length */
- *argPtr = NULL;
+ *out_arg = NULL;
- (*linePtr)--; /* Make (*linePtr)[1] point to the '('. */
- (void)Var_Parse(linePtr, VAR_CMDLINE, doEval ? VARE_WANTRES : 0,
+ (*pp)--; /* Make (*pp)[1] point to the '('. */
+ (void)Var_Parse(pp, VAR_CMDLINE, doEval ? VARE_WANTRES : 0,
&val, &val_freeIt);
/* TODO: handle errors */
- /* If successful, *linePtr points beyond the closing ')' now. */
+ /* If successful, *pp points beyond the closing ')' now. */
if (val == var_Error) {
free(val_freeIt);
diff -r 07b39dc26c0d -r c43b53b9b5a0 usr.bin/make/unit-tests/include-sub.mk
--- a/usr.bin/make/unit-tests/include-sub.mk Mon Nov 02 18:58:06 2020 +0000
+++ b/usr.bin/make/unit-tests/include-sub.mk Mon Nov 02 19:07:09 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: include-sub.mk,v 1.6 2020/10/25 12:08:53 rillig Exp $
+# $NetBSD: include-sub.mk,v 1.7 2020/11/02 19:07:09 rillig Exp $
.if ${.INCLUDEDFROMFILE} == "include-main.mk"
. info sub-before-ok
@@ -20,7 +20,7 @@
# To see the variable 'includes' in action:
#
# Breakpoints:
-# Parse_File at "PtrVector_Push(&includes, curFile)"
+# Parse_File at "Vector_Push(&includes)"
# ParseMessage at entry
# Watches:
# ((const IFile *[10])(*includes.items))
diff -r 07b39dc26c0d -r c43b53b9b5a0 usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Nov 02 18:58:06 2020 +0000
+++ b/usr.bin/make/var.c Mon Nov 02 19:07:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.647 2020/11/02 18:15:12 rillig Exp $ */
+/* $NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.647 2020/11/02 18:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $");
#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3623,7 +3623,7 @@
VarParseResult *out_FALSE_res,
const char **out_FALSE_val,
- void **out_FALSE_freePtr,
+ void **out_FALSE_freeIt,
char *out_TRUE_endc,
const char **out_TRUE_p,
@@ -3699,7 +3699,7 @@
char *pstr = bmake_strsedup(start, p);
free(varname);
*out_FALSE_res = VPR_OK;
- *out_FALSE_freePtr = pstr;
+ *out_FALSE_freeIt = pstr;
*out_FALSE_val = pstr;
return FALSE;
}
Home |
Main Index |
Thread Index |
Old Index