On Thu, Jan 14, 2016 at 6:58 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Now there is no direct caller to strbuf_getline(), we can demote it > to file-scope static private to strbuf.c implementation and rename > it to strbuf_getdelim(). Rename strbuf_getline_crlf(), which is > designed to be the most "text friendly" variant, and allow it to > take over this simplest name, strbuf_getline(), so we can add more > uses of it without having to type _crlf over and over again in the > coming steps. > > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> > --- > diff --git a/strbuf.h b/strbuf.h > @@ -380,26 +380,29 @@ extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); > > /** > * Read a line from a FILE *, overwriting the existing contents > - * of the strbuf. The second argument specifies the line > - * terminator character, typically `'\n'`. > + * of the strbuf. There are three public functions with this > + * function signature, with different line termination convention. s/public// perhaps? Also, is it worth worrying that the comment may become outdated due to the mentioned "three"? Perhaps s/three/several/? Or: The family of strbuf_getline*() functions share the same signature, but have different line termination conventions. > * Reading stops after the terminator or at EOF. The terminator > * is removed from the buffer before returning. Returns 0 unless > * there was nothing left before EOF, in which case it returns `EOF`. > */ > -extern int strbuf_getline(struct strbuf *, FILE *, int); > - > > typedef int (*strbuf_getline_fn)(struct strbuf *, FILE *); > > +/* Uses LF as the line terminator */ > extern int strbuf_getline_lf(struct strbuf *sb, FILE *fp); > + > +/* Uses NUL as the line terminator */ > extern int strbuf_getline_nul(struct strbuf *sb, FILE *fp); This documentation could have been included in patch 3/21. > -/* > - * Similar to strbuf_getline(), but uses '\n' as the terminator, > - * and additionally treats a '\r' that comes immediately before '\n' > - * as part of the terminator. > +/** > + * Similar to strbuf_getline_lf(), but additionally treats > + * a '\r' that comes immediately before '\n' as part of the > + * terminator. This is the most friendly version to be used > + * to read "text" files that can come from platforms whose > + * native text format is CRLF terminated. > */ > -extern int strbuf_getline_crlf(struct strbuf *, FILE *); > +extern int strbuf_getline(struct strbuf *, FILE *); -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html