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

Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c

From
MNMoritz Neeb <lists@moritzneeb.de>
Date
Jan 30, 2016, 14:30 UTC
Message-ID
<56ACC916.8020008@moritzneeb.de>

Currently I am working on replacing strbuf_getline_lf() by strbuf_getline() in places where the input is trimmed immediately after reading, cf. $gmane/284104, "Notes on the remaining strbuf_getline_lf() callers", 2nd point.

One instance I found was in wt-status.c. In read_rebase_todolist() the lines are read, checked for a comment_line_char and then trimmed. I wonder why the input is not trimmed before checking for this character? Is it safe to replace strbuf_getline_lf() by strbuf_getline() anyway?

The only case I can imagine that could lead to unexpected behaviour then would be when someone sets the comment_line_char to CR. How likely is that?

Why is the trim after checking for the comment char anyway? Should something like " # foobar" not be considered as comment?

Next: Moritz Neeb
Message 1 of 3 in “Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c”
  1. Moritz NeebJan 30, 2016
  2. Moritz NeebJan 30, 2016
  3. Junio C HamanoJan 31, 2016

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.