aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-26 20:52:14 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-26 20:52:14 -0400
commit2b0495afae3d744127f3b6c18e98819feafbface (patch)
tree085602dd387a8f686d7c1b1ef631a62d62c416ea
parent41785b1a222d34f4e0e0a3ab4fd15f94f988ca39 (diff)
downloadegawk-2b0495afae3d744127f3b6c18e98819feafbface.tar.gz
egawk-2b0495afae3d744127f3b6c18e98819feafbface.tar.bz2
egawk-2b0495afae3d744127f3b6c18e98819feafbface.zip
Simplify do_print logic to eliminate an unnecessary test for the value's type.
-rw-r--r--ChangeLog6
-rw-r--r--builtin.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 82a688f1..0aa78129 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com>
+ * builtin.c (do_print): There's actually no reason to test whether a
+ value is a number, since the STRCUR flag and stfmt value contain all
+ the necessary info, as in awk.h:force_string.
+
+2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
* builtin.c (do_print): Do not use OFMT to print strnum values. We
accomplish this by calling format_val for a NUMBER only
if there is no string currently available, or if stfmt equals
diff --git a/builtin.c b/builtin.c
index a0b6e79f..24f585e0 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2203,8 +2203,7 @@ do_print(int nargs, int redirtype)
if (tmp->type == Node_typedregex)
args_array[i] = force_string(tmp);
- else if ((fixtype(tmp)->flags & (NUMBER|STRING)) == NUMBER &&
- !((tmp->flags & STRCUR) != 0
+ else if (!((tmp->flags & STRCUR) != 0
&& (tmp->stfmt == -1 || tmp->stfmt == OFMTidx)))
args_array[i] = format_val(OFMT, OFMTidx, tmp);
}