James Youngman <[EMAIL PROTECTED]> wrote: > This is a consolidated patch including all the previous changes, > implementing order checking in join by default. "make distcheck" > works (if I move distcheck-hook from Makefile.am to GNUmakefile). > > 2008-02-16 James Youngman <[EMAIL PROTECTED]> > > * src/join.c: Support --check-order and --nocheck-order.
Thanks. For future reference, I've made a few changes so far: The first of which was to get past a "make distcheck" failure: dupline the above functions should have static scope make[1]: *** [sc_tight_scope] Error 1 Then a few spacing/style changes. Also, I'm going to change this newline->fields = xmalloc (sizeof *newline->fields * old->nfields_allocated); to this: newline->fields = xnmalloc (old->nfields_allocated, sizeof *newline->fields); No need to resend. diff --git a/src/join.c b/src/join.c index 832b3bd..627828e 100644 --- a/src/join.c +++ b/src/join.c @@ -260,8 +260,8 @@ xfields (struct line *line) extract_field (line, ptr, lim - ptr); } -struct line* -dupline (const struct line *old) +static struct line* +dup_line (const struct line *old) { struct line *newline = xmalloc (sizeof *newline); size_t i; @@ -278,7 +278,7 @@ dupline (const struct line *old) newline->nfields = old->nfields; newline->nfields_allocated = old->nfields_allocated; - for (i=0; i<old->nfields; i++) + for (i = 0; i < old->nfields; i++) { newline->fields[i].len = old->fields[i].len; newline->fields[i].beg = newline->buf.buffer + (old->fields[i].beg @@ -319,12 +319,12 @@ get_line (FILE *fp, struct line *line, int which) line->fields = NULL; xfields (line); - if (prevline[which-1]) + if (prevline[which - 1]) { - checkorder (prevline[which-1], line, which); - freeline (prevline[which-1]); + checkorder (prevline[which - 1], line, which); + freeline (prevline[which - 1]); } - prevline[which-1] = dupline (line); + prevline[which - 1] = dup_line (line); return true; } _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils