From ca928f6f8d18b4cf3acd1dd4b7443a5631c06af2 Mon Sep 17 00:00:00 2001 From: Roland Paterson-Jones Date: Tue, 22 Oct 2024 14:22:49 +0200 Subject: Blk::ins is a vector Scratching an itch - avoid unnecesary re-allocation in idup() which is called often in the optimisation chain. Blk::ins is reallocated in xxx_abi() - needs further fiddling. --- util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util.c') diff --git a/util.c b/util.c index 2e4b4cc..a2dfffa 100644 --- a/util.c +++ b/util.c @@ -255,7 +255,10 @@ emiti(Ins i) void idup(Ins **pd, Ins *s, ulong n) { - *pd = alloc(n * sizeof(Ins)); + if (*pd) + vgrow(pd, n); + else + *pd = vnew(n, sizeof(Ins), PFn); if (n) memcpy(*pd, s, n * sizeof(Ins)); } -- cgit v1.2.3