[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Implement readlinebuffer_delim, generalizing readlinebuffer
From: |
Jim Meyering |
Subject: |
Re: Implement readlinebuffer_delim, generalizing readlinebuffer |
Date: |
Sat, 12 May 2007 14:44:15 +0200 |
"James Youngman" <address@hidden> wrote:
> I have just implemented "uniq -z" (analogous with sort -z) but needed
> to generalize readlinebuffer() to do so.
>
> 2007-05-12 James Youngman <address@hidden>
>
> * lib/linebuffer.c (readlinebuffer_delim): Like
> readlinebuffer, but use the delimiter the caller
> specifies.
> (readlinebuffer): Just call readlinebuffer_delim with '\n'
> as the delimiter.
> * lib/linebuffer.h (readlinebuffer_delim): Declare it.
Hi James,
Thank you. The idea of this patch is a good one, but the patch has been
mangled somewhere along the way (wrapped lines, removed leading spaces),
so I haven't even tried to apply it and review in place.
Just to be on the safe side, would you please send it again, and make
one tiny change, below:
> Index: lib/linebuffer.c
> ===================================================================
> RCS file: /sources/gnulib/gnulib/lib/linebuffer.c,v
> retrieving revision 1.21
> diff -u -r1.21 linebuffer.c
> --- lib/linebuffer.c 13 Sep 2006 22:38:14 -0000 1.21
> +++ lib/linebuffer.c 12 May 2007 10:35:19 -0000
> @@ -1,7 +1,7 @@
> /* linebuffer.c -- read arbitrarily long lines
>
> - Copyright (C) 1986, 1991, 1998, 1999, 2001, 2003, 2004, 2006 Free
> - Software Foundation, Inc.
> + Copyright (C) 1986, 1991, 1998, 1999, 2001, 2003, 2004, 2006, 2007
> + Free Software Foundation, Inc.
>
> This program is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> @@ -40,17 +40,25 @@
> memset (linebuffer, 0, sizeof *linebuffer);
> }
>
> +struct linebuffer *
> +readlinebuffer (struct linebuffer *linebuffer, FILE *stream)
> +{
> + return readlinebuffer_delim(linebuffer, stream, '\n');
Missing space before opening parenthesis:
return readlinebuffer_delim (linebuffer, stream, '\n');