strbuf: give strbuf_getline() to the "most text friendly" variant

Now there is no direct caller to strbuf_getline(), we can demote it
to file-scope static that is private to strbuf.c 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@pobox.com>
This commit is contained in:
Junio C Hamano
2016-01-13 18:32:23 -08:00
parent a392f57daf
commit 1a0c8dfd89
4 changed files with 20 additions and 21 deletions

View File

@ -501,7 +501,7 @@ int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term)
}
#endif
int strbuf_getline(struct strbuf *sb, FILE *fp, int term)
static int strbuf_getdelim(struct strbuf *sb, FILE *fp, int term)
{
if (strbuf_getwholeline(sb, fp, term))
return EOF;
@ -510,7 +510,7 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term)
return 0;
}
int strbuf_getline_crlf(struct strbuf *sb, FILE *fp)
int strbuf_getline(struct strbuf *sb, FILE *fp)
{
if (strbuf_getwholeline(sb, fp, '\n'))
return EOF;
@ -524,12 +524,12 @@ int strbuf_getline_crlf(struct strbuf *sb, FILE *fp)
int strbuf_getline_lf(struct strbuf *sb, FILE *fp)
{
return strbuf_getline(sb, fp, '\n');
return strbuf_getdelim(sb, fp, '\n');
}
int strbuf_getline_nul(struct strbuf *sb, FILE *fp)
{
return strbuf_getline(sb, fp, '\0');
return strbuf_getdelim(sb, fp, '\0');
}
int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term)