From: Jim Meyering Date: Thu, 31 Oct 1996 23:55:04 +0000 (+0000) Subject: (decode_field_spec): Always give FIELD_INDEX a value. X-Git-Tag: TEXTUTILS-1_19q~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9cd2cf6e2114db921252b6cb379918c31900847;p=thirdparty%2Fcoreutils.git (decode_field_spec): Always give FIELD_INDEX a value. This avoids spurious UMR from purify. (prjoin): Add an assertion. (add_field): Update assertion. --- diff --git a/src/join.c b/src/join.c index 666cd73e10..1c3494d8cb 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