summary refs log tree commit diff
path: root/util.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 18:39:39 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 18:39:39 -0400
commitc691b4df12d2f9c7e91f8946a7e56ee48e76cf51 (patch)
tree03baf79083b58d48eaf1706b02021cfec2c3ac92 /util.c
parentabe45f1ab06229d51a1f62bf0569ae99b804823b (diff)
downloadroux-c691b4df12d2f9c7e91f8946a7e56ee48e76cf51.tar.gz
did I loose my c?
Diffstat (limited to 'util.c')
-rw-r--r--util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util.c b/util.c
index 15f9dea..ee8030f 100644
--- 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));
 		}
 	}
 }