summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2021-09-12 09:57:03 +0300
committerArnold D. Robbins <arnold@skeeve.com>2021-09-12 09:57:03 +0300
commit6d200ac046e3869af946e2e8c4f58948888c3f8e (patch)
tree4f3b9ca8ab26b82f37bc416c8ee86c26468c3ad7
parentb1ce5f1df79cea7e3d46183bffcac81c7ce287dd (diff)
parent0bc02532d7fa333ac7067c1cb91506ad16485916 (diff)
downloadgawk-6d200ac046e3869af946e2e8c4f58948888c3f8e.tar.gz
Merge branch 'gawk-5.1-stable'
-rw-r--r--ChangeLog9
-rw-r--r--builtin.c5
-rw-r--r--interpret.h5
3 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c6decf1..4c0435b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-09-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h: Remove subscript_in_array variable.
+
+ Unrelated:
+
+ * builtin.c (add_thousands): Fix insertion of thousands_sep
+ string. Do it in reverse order.
+
2021-09-10 Arnold D. Robbins <arnold@skeeve.com>
* interpret.h: For Op_subscript, don't allow references into
diff --git a/builtin.c b/builtin.c
index e1e80152..56334417 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4437,9 +4437,10 @@ add_thousands(const char *original, struct lconv *loc)
if (loc->grouping[ii] && ++jj == loc->grouping[ii]) {
if (src >= original) { /* only add if more digits coming */
const char *ts = loc->thousands_sep;
+ int k;
- while (*ts != '\0')
- *dest++ = *ts++;
+ for (k = strlen(ts) - 1; k >= 0; k--)
+ *dest++ = ts[k];
}
if (loc->grouping[ii+1] == 0)
jj = 0; /* keep using current val in loc.grouping[ii] */
diff --git a/interpret.h b/interpret.h
index ec769cca..df70bd09 100644
--- a/interpret.h
+++ b/interpret.h
@@ -67,7 +67,6 @@ r_interpret(INSTRUCTION *code)
Regexp *rp;
NODE *set_array = NULL; /* array with a post-assignment routine */
NODE *set_idx = NULL; /* the index of the array element */
- bool subscript_in_array;
/* array subscript */
@@ -266,9 +265,7 @@ uninitialized_scalar:
t2 = mk_sub(pc->sub_count);
t1 = POP_ARRAY(false);
- subscript_in_array = (in_array(t1, t2) != NULL);
-
- if (! subscript_in_array) {
+ if (in_array(t1, t2) == NULL) {
t2 = force_string(t2);
if (t1 == func_table) {