[PATCH V3] chg: use validate to make sure the server is up to date

Yuya Nishihara yuya at tcha.org
Fri Mar 4 10:38:33 EST 2016


On Fri, 4 Mar 2016 14:14:37 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1457100004 0
> #      Fri Mar 04 14:00:04 2016 +0000
> # Node ID 329ae1c21f95f22d133df541041541d94d08c8c6
> # Parent  314e2f98e29e590d2bae1d3604f54478ce47cbc6
> chg: use validate to make sure the server is up to date

> +static void runinstructions(hgclient_t *hgc, struct cmdserveropts *opts,
> +			    size_t instsize)
> +{
> +	assert(instsize > 0);
> +	const char **instbuf = mallocx(instsize * sizeof(char *));
> +
> +	size_t n = hgc_parselist(hgc, instbuf, instsize);

Uh, I meant it could be a simple fixed-size buffer.

  const char *insts[42];
  n = hgc_validate(..., insts, sizeof(insts) / sizeof(insts[0]));

But if you don't agree, I'd prefer the original "free by caller" version.


More information about the Mercurial-devel mailing list