diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-08-10 22:11:43 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-08-10 22:11:43 +0300 |
commit | 0d1a4f152fa45eda08b5877e4989c3250beb280e (patch) | |
tree | d253f655ee0791a348296f2886549e75b79a148f /field.c | |
parent | 9ef8db47d6ba6f91a44d5b0b31fad727eeaf122b (diff) | |
download | egawk-0d1a4f152fa45eda08b5877e4989c3250beb280e.tar.gz egawk-0d1a4f152fa45eda08b5877e4989c3250beb280e.tar.bz2 egawk-0d1a4f152fa45eda08b5877e4989c3250beb280e.zip |
Fix problem with FIELDWIDTHS.
Diffstat (limited to 'field.c')
-rw-r--r-- | field.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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"); |