diff options
Diffstat (limited to 'strbuf.h')
-rw-r--r-- | strbuf.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -388,13 +388,25 @@ extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); */ extern int strbuf_getline(struct strbuf *, FILE *, int); +/** + * The strbuf_getline*() family of functions share this signature, but + * have different line termination conventions. + */ +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); + /* - * 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 CR that + * comes immediately before the LF as part of the terminator. */ extern int strbuf_getline_crlf(struct strbuf *, FILE *); + /** * Like `strbuf_getline`, but keeps the trailing terminator (if * any) in the buffer. |