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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 9, 2009, 20:17 UTC
Message-ID
<alpine.DEB.1.00.0908092211030.8306@pacific.mpi-cbg.de>
In-Reply-To
<alpine.LNX.2.00.0908091526350.27553@iabervon.org>
Hi,
On Sun, 9 Aug 2009, Daniel Barkalow wrote:
Show 6 quoted lines
> This style is overkill for some commands, but it's worthwhile to use
> the same style to issue all commands, and it's useful to avoid
> open-coding string lengths.
> 
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> ---

Thanks. I am positively surprised that you did this patch in spite of the basis already being in 'next'.

> +	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?

Ciao, Dscho

Previous: Daniel BarkalowNext: Daniel Barkalow
Message 2 of 3 in “Use a clearer style to issue commands to remote helpers”
  1. 1/8 Use a clearer style to issue commands to remote helpersDaniel Barkalow, Aug 9, 2009
  2. Johannes SchindelinAug 9, 2009
  3. Daniel BarkalowAug 9, 2009

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.