commit c691b4df12d2f9c7e91f8946a7e56ee48e76cf51
parent abe45f1ab06229d51a1f62bf0569ae99b804823b
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 9 Apr 2016 18:39:39 -0400
did I loose my c?
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
@@ -109,14 +109,17 @@ blkdel(Blk *b)
for (a=0; p->blk[a]!=b; a++)
assert(a+1<p->narg);
p->narg--;
- memcpy(&p->blk[a], &p->blk[a+1], p->narg-a);
- memcpy(&p->arg[a], &p->arg[a+1], p->narg-a);
+ memcpy(&p->blk[a], &p->blk[a+1],
+ sizeof p->blk[0] * (p->narg-a));
+ memcpy(&p->arg[a], &p->arg[a+1],
+ sizeof p->arg[0] * (p->narg-a));
}
if (s->npred != 0) {
for (a=0; s->pred[a]!=b; a++)
assert(a+1<s->npred);
s->npred--;
- memcpy(&s->pred[a], &s->pred[a+1], s->npred-a);
+ memcpy(&s->pred[a], &s->pred[a+1],
+ sizeof s->pred[0] * (s->npred-a));
}
}
}