diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-12 09:56:19 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-12 09:56:19 +0300 |
commit | 0bc02532d7fa333ac7067c1cb91506ad16485916 (patch) | |
tree | 5797aa4639806e8348b6089d1a9a32bb35d0485d | |
parent | b62e78e6d7e4307678fa172488302375559dcbf2 (diff) | |
download | egawk-0bc02532d7fa333ac7067c1cb91506ad16485916.tar.gz egawk-0bc02532d7fa333ac7067c1cb91506ad16485916.tar.bz2 egawk-0bc02532d7fa333ac7067c1cb91506ad16485916.zip |
Small fix in builtin.c.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | builtin.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -2,6 +2,11 @@ * 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 @@ -4419,9 +4419,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] */ |