aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-12-20 22:50:13 +0200
committerArnold D. Robbins <arnold@skeeve.com>2015-12-20 22:50:13 +0200
commit1460f14c0fdd6e1485ba3a0bde14fe2e11fc1690 (patch)
tree93b5812c5d597e2e3b2315d7515de356dcd322a9
parentadf9d52a79a705dab0c5fe5f178770bb806a68cc (diff)
downloadegawk-1460f14c0fdd6e1485ba3a0bde14fe2e11fc1690.tar.gz
egawk-1460f14c0fdd6e1485ba3a0bde14fe2e11fc1690.tar.bz2
egawk-1460f14c0fdd6e1485ba3a0bde14fe2e11fc1690.zip
Minor code improvement for PROCINFO["NONFATAL"].
-rw-r--r--ChangeLog5
-rw-r--r--io.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index cc86c1c4..6853d257 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (nonfatal): New static constant string.
+ * is_non_fatal, is_non_fatal_redirect: Use it.
+
2015-12-16 Arnold D. Robbins <arnold@skeeve.com>
* io.c (two_way_open): Remove unneeded close of slave in the
diff --git a/io.c b/io.c
index 9385a1e6..0d521ed0 100644
--- a/io.c
+++ b/io.c
@@ -323,6 +323,8 @@ static Regexp *RS_re_yes_case; /* regexp for RS when ignoring case */
static Regexp *RS_re_no_case; /* regexp for RS when not ignoring case */
static Regexp *RS_regexp;
+static const char nonfatal[] = "NONFATAL";
+
bool RS_is_null;
extern NODE *ARGC_node;
@@ -1100,8 +1102,6 @@ getredirect(const char *str, int len)
bool
is_non_fatal_std(FILE *fp)
{
- static const char nonfatal[] = "NONFATAL";
-
if (in_PROCINFO(nonfatal, NULL, NULL))
return true;
@@ -1121,8 +1121,8 @@ is_non_fatal_std(FILE *fp)
bool
is_non_fatal_redirect(const char *str)
{
- return in_PROCINFO("NONFATAL", NULL, NULL) != NULL
- || in_PROCINFO(str, "NONFATAL", NULL) != NULL;
+ return in_PROCINFO(nonfatal, NULL, NULL) != NULL
+ || in_PROCINFO(str, nonfatal, NULL) != NULL;
}
/* close_one --- temporarily close an open file to re-use the fd */