gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. 0d1a4f152fa45e


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. 0d1a4f152fa45eda08b5877e4989c3250beb280e
Date: Wed, 10 Aug 2011 19:12:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.0-stable has been updated
       via  0d1a4f152fa45eda08b5877e4989c3250beb280e (commit)
      from  9ef8db47d6ba6f91a44d5b0b31fad727eeaf122b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0d1a4f152fa45eda08b5877e4989c3250beb280e

commit 0d1a4f152fa45eda08b5877e4989c3250beb280e
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Aug 10 22:11:43 2011 +0300

    Fix problem with FIELDWIDTHS.

diff --git a/ChangeLog b/ChangeLog
index 62fcfa3..684bb9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-10         Arnold D. Robbins     <address@hidden>
+
+       Fix (apparently long-standing) problem with FIELDWIDTHS.
+       Thanks to Johannes Meixner <address@hidden>.
+
+       * field.c (set_FIELDWIDTHS): Adjust calculations.
+
 2011-08-09         Arnold D. Robbins     <address@hidden>
 
        Fix pty issue reported by "T. X. G." <address@hidden>
diff --git a/field.c b/field.c
index 0b9c100..148f8f0 100644
--- a/field.c
+++ b/field.c
@@ -1126,10 +1126,12 @@ set_FIELDWIDTHS()
        FIELDWIDTHS[0] = 0;
        for (i = 1; ; i++) {
                unsigned long int tmp;
-               if (i + 1 >= fw_alloc) {
+               if (i + 2 >= fw_alloc) {
                        fw_alloc *= 2;
                        erealloc(FIELDWIDTHS, int *, fw_alloc * sizeof(int), 
"set_FIELDWIDTHS");
                }
+               /* Initialize value to be end of list */
+               FIELDWIDTHS[i] = -1;
                /* Ensure that there is no leading `-' sign.  Otherwise,
                   strtoul would accept it and return a bogus result.  */
                while (is_blank(*scan)) {
@@ -1163,8 +1165,6 @@ set_FIELDWIDTHS()
                if (*scan == '\0')
                        break;
        }
-       if (i == 1)     /* empty string! */
-               i--;
        FIELDWIDTHS[i+1] = -1;
 
        update_PROCINFO_str("FS", "FIELDWIDTHS");
diff --git a/test/ChangeLog b/test/ChangeLog
index 8db0443..87b9cf1 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-10         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (fwtest3): New test.
+       * fwtest3.awk, fwtest3.in, fwtest3.ok: New files.
+
 2011-08-09         Arnold D. Robbins     <address@hidden>
 
        * pty1.awk, pty1.ok: New files.
diff --git a/test/Makefile.am b/test/Makefile.am
index 2d1b422..43b2659 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -271,6 +271,9 @@ EXTRA_DIST = \
        fwtest2.awk \
        fwtest2.in \
        fwtest2.ok \
+       fwtest3.awk \
+       fwtest3.in \
+       fwtest3.ok \
        gensub.awk \
        gensub.in \
        gensub.ok \
@@ -805,7 +808,7 @@ GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 binmode1 clos1way delsub devfd devfd1 \
        devfd2 dumpvars exit fieldwdth fpat1 fpat2 fpatnull fsfwfs funlen \
-       fwtest fwtest2 gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
+       fwtest fwtest2 fwtest3 gensub gensub2 getlndir gnuops2 gnuops3 gnureops 
\
        icasefs icasers igncdym igncfs ignrcas2 ignrcase indirectcall lint \
        lintold lintwarn manyfiles match1 match2 match3 mbstr1 nastyparm \
        next nondec nondec2 patsplit posix printfbad1 printfbad2 procinfs \
diff --git a/test/fwtest3.awk b/test/fwtest3.awk
new file mode 100644
index 0000000..d1384ea
--- /dev/null
+++ b/test/fwtest3.awk
@@ -0,0 +1 @@
+BEGIN { FIELDWIDTHS="5" } { print $1 }
diff --git a/test/fwtest3.in b/test/fwtest3.in
new file mode 100644
index 0000000..a32a434
--- /dev/null
+++ b/test/fwtest3.in
@@ -0,0 +1 @@
+1234567890
diff --git a/test/fwtest3.ok b/test/fwtest3.ok
new file mode 100644
index 0000000..e56e15b
--- /dev/null
+++ b/test/fwtest3.ok
@@ -0,0 +1 @@
+12345

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    7 +++++++
 field.c          |    6 +++---
 test/ChangeLog   |    5 +++++
 test/Makefile.am |    5 ++++-
 test/fwtest3.awk |    1 +
 test/fwtest3.in  |    1 +
 test/fwtest3.ok  |    1 +
 7 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 test/fwtest3.awk
 create mode 100644 test/fwtest3.in
 create mode 100644 test/fwtest3.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]