From: Rusty Russell Date: Mon, 9 Jan 2023 02:08:22 +0000 (+1030) Subject: ccanlint: do fewer reallocs, to speed up under -fsanitize=address X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=374a0b73cc507b3121cf40cab77dc0d3eab794a9;hp=523944ee598bfd43b2d2b944ee5b1cd2c7cc18ed ccanlint: do fewer reallocs, to speed up under -fsanitize=address This is just a hack, but it makes the speed managable for ccan/utf8 which produces a lot of output! Signed-off-by: Rusty Russell --- diff --git a/tools/ccanlint/async.c b/tools/ccanlint/async.c index f3d1a5ba..3f88bbcd 100644 --- a/tools/ccanlint/async.c +++ b/tools/ccanlint/async.c @@ -151,11 +151,12 @@ static void reap_output(void) int old_len, len; /* This length includes nul terminator! */ old_len = tal_count(c->output); - tal_resize(&c->output, old_len + 1024); - len = read(c->output_fd, c->output + old_len - 1, 1024); + tal_resize(&c->output, old_len + 65536); + len = read(c->output_fd, c->output + old_len - 1, 65536); if (len < 0) err(1, "Reading from async command"); - tal_resize(&c->output, old_len + len); + if (len != 65536) + tal_resize(&c->output, old_len + len); c->output[old_len + len - 1] = '\0'; if (len == 0) { struct rusage ru;