aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorRoland Paterson-Jones <[email protected]>2024-10-22 14:22:49 +0200
committerQuentin Carbonneaux <[email protected]>2025-03-14 09:47:05 +0100
commitca928f6f8d18b4cf3acd1dd4b7443a5631c06af2 (patch)
tree9eedbe65cc60f271a3ec12623b36cbcd68117815 /util.c
parent024dffac8bbfa709ed3aed53d14b235e67047490 (diff)
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.
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 4 insertions, 1 deletions
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));
}