git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/4] strbuf: improve strbuf_get*line documentation

From
Thomas Rast <trast@student.ethz.ch>
Date
Feb 23, 2012, 09:42 UTC
Message-ID
<d5522f8d1154321804cb60fb4f53d538242ead88.1329988335.git.trast@student.ethz.ch>
In-Reply-To
<cover.1329988335.git.trast@student.ethz.ch>

strbuf_getline() was not documented very clearly, though a reader familiar with getline() would not have had any questions about it. strbuf_getwholeline() was not documented at all.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 Documentation/technical/api-strbuf.txt |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt
index afe2759..cc6db5e 100644
--- a/Documentation/technical/api-strbuf.txt
+++ b/Documentation/technical/api-strbuf.txt
@@ -255,8 +255,16 @@ same behaviour as well.
 
 `strbuf_getline`::
 
-	Read a line from a FILE* pointer. The second argument specifies the line
-	terminator character, typically `'\n'`.
+	Read a line from a FILE*. The second argument specifies the
+	line terminator character, typically `'\n'`.  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`.
+
+`strbuf_getwholeline`::
+	
+	Like `strbuf_getline`, but keeps the trailing terminator (if
+	any) in the buffer.
 
 `stripspace`::
 
-- 
1.7.9.1.430.g4998543
Previous: Thomas RastNext: Jeff King
Message 2 of 8 in “Making an elephant out of a getline() bug”
  1. 0/4 Making an elephant out of a getline() bugThomas Rast, Feb 23, 2012
  2. 1/4 strbuf: improve strbuf_get*line documentationThomas Rast, Feb 23, 2012
  3. Jeff KingFeb 23, 2012
  4. 2/4 bundle: put strbuf_readline_fd in strbuf.c with adjustmentsThomas Rast, Feb 23, 2012
  5. 3/4 t5704: match tests to modern styleThomas Rast, Feb 23, 2012
  6. Junio C HamanoFeb 23, 2012
  7. 4/4 bundle: use a strbuf to scan the log for boundary commitsThomas Rast, Feb 23, 2012
  8. Junio C HamanoFeb 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.