Merge branch 'jk/sanity'
[gitweb.git] / strbuf.h
index 7123fca7aff5182b66af6d76991552081139467c..2bf90e70fcf1e9bcbfcbfdf4bc8b30e1d7b61d10 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -366,6 +366,14 @@ extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
  */
 extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);
 
+/**
+ * Read the contents of a given file descriptor partially by using only one
+ * attempt of xread. The third argument can be used to give a hint about the
+ * file size, to avoid reallocs. Returns the number of new bytes appended to
+ * the sb.
+ */
+extern ssize_t strbuf_read_once(struct strbuf *, int fd, size_t hint);
+
 /**
  * Read the contents of a file, specified by its path. The third argument
  * can be used to give a hint about the file size, to avoid reallocs.