Re: [PATCH 15/22] sequencer: introduce a helper to read files written by scripts

From
Dennis Kaarsemaker <hidden>
Date
2016-08-29 09:47:53
Reply to
Johannes Schindelin, 2016-08-29
On ma, 2016-08-29 at 10:06 +0200, Johannes Schindelin wrote:
+       if (strbuf_read_file(buf, path, 0) < 0) {
+               warning_errno("could not read '%s'", path);
+               return 0;
+       }
+
+       if (buf->len > orig_len && buf->buf[buf->len - 1] == '\n') {
+               if (--buf->len > orig_len && buf->buf[buf->len - 1]
== '\r')
+                       --buf->len;
+               buf->buf[buf->len] = '\0';
+       }
Why not use open + strbuf_getline instead of hand-rolling a newline
eradicator?

D.
Thread (218 messages) 218 messages, 9 authors, last reply 2016-11-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help