Sat Nov 28 16:36:19 2020 UTC ()
make(1): improve type of local variable in Var_Export1


(rillig)
diff -r1.698 -r1.699 src/usr.bin/make/var.c

cvs diff -r1.698 -r1.699 src/usr.bin/make/var.c (expand / switch to unified diff)

--- src/usr.bin/make/var.c 2020/11/28 10:09:28 1.698
+++ src/usr.bin/make/var.c 2020/11/28 16:36:19 1.699
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: var.c,v 1.698 2020/11/28 10:09:28 rillig Exp $ */ 1/* $NetBSD: var.c,v 1.699 2020/11/28 16:36:19 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -120,27 +120,27 @@ @@ -120,27 +120,27 @@
120#include <regex.h> 120#include <regex.h>
121#endif 121#endif
122#include <errno.h> 122#include <errno.h>
123#include <inttypes.h> 123#include <inttypes.h>
124#include <limits.h> 124#include <limits.h>
125#include <time.h> 125#include <time.h>
126 126
127#include "make.h" 127#include "make.h"
128#include "dir.h" 128#include "dir.h"
129#include "job.h" 129#include "job.h"
130#include "metachar.h" 130#include "metachar.h"
131 131
132/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ 132/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
133MAKE_RCSID("$NetBSD: var.c,v 1.698 2020/11/28 10:09:28 rillig Exp $"); 133MAKE_RCSID("$NetBSD: var.c,v 1.699 2020/11/28 16:36:19 rillig Exp $");
134 134
135#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) 135#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
136#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) 136#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
137#define VAR_DEBUG3(fmt, arg1, arg2, arg3) DEBUG3(VAR, fmt, arg1, arg2, arg3) 137#define VAR_DEBUG3(fmt, arg1, arg2, arg3) DEBUG3(VAR, fmt, arg1, arg2, arg3)
138#define VAR_DEBUG4(fmt, arg1, arg2, arg3, arg4) DEBUG4(VAR, fmt, arg1, arg2, arg3, arg4) 138#define VAR_DEBUG4(fmt, arg1, arg2, arg3, arg4) DEBUG4(VAR, fmt, arg1, arg2, arg3, arg4)
139 139
140ENUM_FLAGS_RTTI_3(VarEvalFlags, 140ENUM_FLAGS_RTTI_3(VarEvalFlags,
141 VARE_UNDEFERR, VARE_WANTRES, VARE_KEEP_DOLLAR); 141 VARE_UNDEFERR, VARE_WANTRES, VARE_KEEP_DOLLAR);
142 142
143/* 143/*
144 * This lets us tell if we have replaced the original environ 144 * This lets us tell if we have replaced the original environ
145 * (which we cannot free). 145 * (which we cannot free).
146 */ 146 */
@@ -502,27 +502,27 @@ MayExport(const char *name) @@ -502,27 +502,27 @@ MayExport(const char *name)
502 return TRUE; 502 return TRUE;
503} 503}
504 504
505/* 505/*
506 * Export a single variable. 506 * Export a single variable.
507 * We ignore make internal variables (those which start with '.'). 507 * We ignore make internal variables (those which start with '.').
508 * Also we jump through some hoops to avoid calling setenv 508 * Also we jump through some hoops to avoid calling setenv
509 * more than necessary since it can leak. 509 * more than necessary since it can leak.
510 * We only manipulate flags of vars if 'parent' is set. 510 * We only manipulate flags of vars if 'parent' is set.
511 */ 511 */
512static Boolean 512static Boolean
513Var_Export1(const char *name, VarExportFlags flags) 513Var_Export1(const char *name, VarExportFlags flags)
514{ 514{
515 VarExportFlags parent = flags & VAR_EXPORT_PARENT; 515 Boolean parent = (flags & VAR_EXPORT_PARENT) != 0;
516 Var *v; 516 Var *v;
517 char *val; 517 char *val;
518 518
519 if (!MayExport(name)) 519 if (!MayExport(name))
520 return FALSE; 520 return FALSE;
521 521
522 v = VarFind(name, VAR_GLOBAL, FALSE); 522 v = VarFind(name, VAR_GLOBAL, FALSE);
523 if (v == NULL) 523 if (v == NULL)
524 return FALSE; 524 return FALSE;
525 525
526 if (!parent && (v->flags & VAR_EXPORTED) && !(v->flags & VAR_REEXPORT)) 526 if (!parent && (v->flags & VAR_EXPORTED) && !(v->flags & VAR_REEXPORT))
527 return FALSE; /* nothing to do */ 527 return FALSE; /* nothing to do */
528 528