git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] strbuf: describe the return value of strbuf_read_file()
@ 2016-06-13 20:23 Pranit Bauva
  2016-06-13 22:10 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Pranit Bauva @ 2016-06-13 20:23 UTC (permalink / raw)
  To: git; +Cc: larsxschneider, chriscool, christian.couder, Pranit Bauva

Mentored-by: Lars Schneider <larsxschneider@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
---
It is easy to be misguided on the return value of the function
strbuf_read_file(). It does follow the pattern of other standard functions
for reading files but its better to explicitly specify it.

 strbuf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/strbuf.h b/strbuf.h
index 7987405..4b487f7 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -377,6 +377,8 @@ 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.
+ * Return the number of bytes read or -1 if some error occurred while
+ * opening or reading the file.
  */
 extern ssize_t strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-14  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 20:23 [PATCH] strbuf: describe the return value of strbuf_read_file() Pranit Bauva
2016-06-13 22:10 ` Junio C Hamano
2016-06-14  5:57   ` Pranit Bauva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).