From 2a13bb50f95c221000f37b91181a8dd08ae8fa54 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 14 Apr 2015 10:35:52 -0400 Subject: [PATCH] Fixed a small bug in stack.c. Unrelated to the previous commit; that one is that the uiParentUpdate() isn't updating...? --- stack.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stack.c b/stack.c index a5de6a48..480b2f0b 100644 --- a/stack.c +++ b/stack.c @@ -365,12 +365,13 @@ void uiStackRemove(uiControl *st, uintmax_t index) { stack *s = (stack *) (st->data); uiControl *removed; - uintmax_t nAfter; + uintmax_t i; removed = s->controls[index].c; - nAfter = s->len - index - 1; - // TODO make sure this is correct - memmove(&(s->controls[index + 1]), &(s->controls[index]), nAfter * sizeof (stackControl)); + // TODO switch to memmove? + for (i = index; i < s->len - 1; i++) + s->controls[i] = s->controls[i + 1]; + // TODO memset the last one to NULL s->len--; if (s->parent != NULL) { uiControlSetParent(removed, NULL);