From 7946dd8753118dee6e8f4a4eba61bb6c0e47d22e Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 7 Nov 2020 12:58:55 +0000 Subject: [PATCH] make(1): rename parameter of ArchSVR4Entry It cannot be made a const string, so rather document it clearly that the string is modified. --- usr.bin/make/arch.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 9a9d117d6229..29ec125c2cca 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.160 2020/11/07 12:54:44 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.161 2020/11/07 12:58:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -125,7 +125,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.160 2020/11/07 12:54:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.161 2020/11/07 12:58:55 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -607,15 +607,15 @@ badarch: *----------------------------------------------------------------------- */ static int -ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE *arch) +ArchSVR4Entry(Arch *ar, char *inout_name, size_t size, FILE *arch) { #define ARLONGNAMES1 "//" #define ARLONGNAMES2 "/ARFILENAMES" size_t entry; char *ptr, *eptr; - if (strncmp(name, ARLONGNAMES1, sizeof ARLONGNAMES1 - 1) == 0 || - strncmp(name, ARLONGNAMES2, sizeof ARLONGNAMES2 - 1) == 0) { + if (strncmp(inout_name, ARLONGNAMES1, sizeof ARLONGNAMES1 - 1) == 0 || + strncmp(inout_name, ARLONGNAMES2, sizeof ARLONGNAMES2 - 1) == 0) { if (ar->fnametab != NULL) { DEBUG0(ARCH, "Attempted to redefine an SVR4 name table\n"); @@ -644,23 +644,23 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE *arch) return 0; } - if (name[1] == ' ' || name[1] == '\0') + if (inout_name[1] == ' ' || inout_name[1] == '\0') return 2; - entry = (size_t)strtol(&name[1], &eptr, 0); - if ((*eptr != ' ' && *eptr != '\0') || eptr == &name[1]) { - DEBUG1(ARCH, "Could not parse SVR4 name %s\n", name); + entry = (size_t)strtol(&inout_name[1], &eptr, 0); + if ((*eptr != ' ' && *eptr != '\0') || eptr == &inout_name[1]) { + DEBUG1(ARCH, "Could not parse SVR4 name %s\n", inout_name); return 2; } if (entry >= ar->fnamesize) { DEBUG2(ARCH, "SVR4 entry offset %s is greater than %lu\n", - name, (unsigned long)ar->fnamesize); + inout_name, (unsigned long)ar->fnamesize); return 2; } - DEBUG2(ARCH, "Replaced %s with %s\n", name, &ar->fnametab[entry]); + DEBUG2(ARCH, "Replaced %s with %s\n", inout_name, &ar->fnametab[entry]); - snprintf(name, MAXPATHLEN + 1, "%s", &ar->fnametab[entry]); + snprintf(inout_name, MAXPATHLEN + 1, "%s", &ar->fnametab[entry]); return 1; } #endif