summaryrefslogtreecommitdiff
path: root/pez.c
diff options
context:
space:
mode:
Diffstat (limited to 'pez.c')
-rw-r--r--pez.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pez.c b/pez.c
index 84d24c9..bc68b38 100644
--- a/pez.c
+++ b/pez.c
@@ -475,14 +475,21 @@ delproto(PezContext *cx, Proto *pr)
}
static void
-closeups(PezContext *cx, Val *vals)
+closeups(PezContext *cx, Val *ptr)
{
- for (Upval *up = cx->openup, *next; up; up = next) {
+ for (Upval *up = cx->openup, *prev = NULL, *next; up; up = next) {
next = up->nextup;
- if (up->ptr >= vals) {
- cx->openup = next;
+ if (up->ptr >= ptr) {
+ if (prev) {
+ prev->nextup = next;
+ }
+ if (up == cx->openup) {
+ cx->openup = next;
+ }
up->slot = *up->ptr;
up->ptr = &up->slot;
+ } else {
+ prev = up;
}
}
}