From 434cf5fdc4ba027f0ac04cd198658860b6fc034a Mon Sep 17 00:00:00 2001 From: Roland Paterson-Jones Date: Tue, 22 Oct 2024 16:07:43 +0200 Subject: idup(Ins **, Ins *, ulong) -> idup(Blk *, Ins *, ulong) Always used this way and factors setting b->nins. Makes b->ins vector contract more obvious. --- util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index a2dfffa..babaa58 100644 --- a/util.c +++ b/util.c @@ -253,14 +253,15 @@ emiti(Ins i) } void -idup(Ins **pd, Ins *s, ulong n) +idup(Blk *b, Ins *s, ulong n) { - if (*pd) - vgrow(pd, n); + if (b->ins) + vgrow(&b->ins, n); else - *pd = vnew(n, sizeof(Ins), PFn); + b->ins = vnew(n, sizeof(Ins), PFn); if (n) - memcpy(*pd, s, n * sizeof(Ins)); + memcpy(b->ins, s, n * sizeof(Ins)); + b->nins = n; } Ins * -- cgit v1.2.3