Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH 1/8] Use a clearer style to issue commands to remote helpers

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:47:12

On Sun, 9 Aug 2009, Johannes Schindelin wrote:
quoted
+	strbuf_addstr(&buf, "capabilities\n");
+	write_in_full(helper->in, buf.buf, buf.len);
+	strbuf_reset(&buf);
Hmm.  I think you use the same paradigm three times.  Maybe it is time to 
heed the DRY principle and introduce a helper function?

Maybe something like

void fprintf_in_full(struct strbuf *buf, int fd, const char *format, ...)
{
	va_list ap;

	va_start(ap, format);
	strbuf_reset(buf);
	strbuf_vaddf(buf, format, ap);
	write_in_full(fd, buf->buf, buf->len);
	va_end(ap);
}

But I keep forgetting that there is no strbuf_vaddf() in 'next'... maybe 
it is high time that I forget my promise and re-submit that series?
Yup, that's exactly what I started writing, until I ran into the lack of 
strbuf_vaddf() and remembered that there were portability issues I don't 
understand with copying va_lists.

	-Daniel
*This .sig left intentionally blank*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help