diff options
author | Jim Meyering <jim@meyering.net> | 1996-10-31 23:55:04 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-10-31 23:55:04 +0000 |
commit | f9cd2cf6e2114db921252b6cb379918c31900847 (patch) | |
tree | 000aec11a89e64e5b7adf97e966198513bb18271 | |
parent | 0a1ac00ad6b0e5b82ea70eca121c92bdc27677fd (diff) | |
download | coreutils-f9cd2cf6e2114db921252b6cb379918c31900847.tar.xz |
(decode_field_spec): Always give FIELD_INDEX a value.
This avoids spurious UMR from purify.
(prjoin): Add an assertion.
(add_field): Update assertion.
-rw-r--r-- | src/join.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 |