From f9cd2cf6e2114db921252b6cb379918c31900847 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 31 Oct 1996 23:55:04 +0000 Subject: (decode_field_spec): Always give FIELD_INDEX a value. This avoids spurious UMR from purify. (prjoin): Add an assertion. (add_field): Update assertion. --- src/join.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/join.c b/src/join.c index 666cd73e1..1c3494d8c 100644 --- a/src/join.c +++ b/src/join.c @@ -460,6 +460,7 @@ prjoin (struct line *line1, struct line *line2) else { line = (o->file == 1 ? line1 : line2); + assert (o->field >= 0); field = o->field; } prfield (field, line); @@ -630,7 +631,7 @@ add_field (int file, int field) struct outlist *o; assert (file == 0 || file == 1 || file == 2); - assert (field >= 0); + assert (file == 0 ? field < 0 : field >= 0); o = (struct outlist *) xmalloc (sizeof (struct outlist)); o->file = file; @@ -659,7 +660,8 @@ decode_field_spec (const char *s, int *file_index, int *field_index) if (s[1] == '\0') { *file_index = 0; - /* Leave *field_index undefined. */ + /* Give *field_index an invalid value. */ + *field_index = -1; invalid = 0; } else -- cgit v1.2.3-70-g09d2