From 2fcffaeee37416708fab505209a55ddd32846463 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 13 Sep 2013 15:37:25 +0300 Subject: Fix problem when extending NF. See test/nfloop. --- field.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'field.c') diff --git a/field.c b/field.c index 3cd66067..0a7cee8f 100644 --- a/field.c +++ b/field.c @@ -85,13 +85,19 @@ void init_fields() { emalloc(fields_arr, NODE **, sizeof(NODE *), "init_fields"); - fields_arr[0] = dupnode(Nnull_string); + + getnode(fields_arr[0]); + *fields_arr[0] = *Nnull_string; + fields_arr[0]->flags |= NULL_FIELD; + parse_extent = fields_arr[0]->stptr; save_FS = dupnode(FS_node->var_value); + getnode(Null_field); *Null_field = *Nnull_string; Null_field->valref = 1; - Null_field->flags = (FIELD|STRCUR|STRING); + Null_field->flags = (FIELD|STRCUR|STRING|NULL_FIELD); + field0_valid = true; } @@ -348,6 +354,7 @@ set_NF() *n = *Null_field; fields_arr[i] = n; } + parse_high_water = NF; } else if (parse_high_water > 0) { for (i = NF + 1; i >= 0 && i <= parse_high_water; i++) { unref(fields_arr[i]); -- cgit v1.2.3 From c338576a8fefa700cb989319d10d27f6f31e9b00 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jan 2014 22:17:04 +0200 Subject: Bug fix to do_split(). --- field.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'field.c') diff --git a/field.c b/field.c index 0a7cee8f..5a1bf562 100644 --- a/field.c +++ b/field.c @@ -1013,7 +1013,9 @@ do_split(int nargs) return make_number((AWKNUM) 0); } - if ((sep->re_flags & FS_DFLT) != 0 && current_field_sep() != Using_FIELDWIDTHS && ! RS_is_null) { + if ( (sep->re_flags & FS_DFLT) != 0 + && current_field_sep() == Using_FS + && ! RS_is_null) { parseit = parse_field; fs = force_string(FS_node->var_value); rp = FS_regexp; -- cgit v1.2.3 From 305c76c58fa92e4907ff82763362d7c1aa0d15ff Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 24 Jan 2014 10:20:01 +0200 Subject: Update copyright year in configure.ac field.c. --- field.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'field.c') diff --git a/field.c b/field.c index 5a1bf562..64ee1f02 100644 --- a/field.c +++ b/field.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. -- cgit v1.2.3