summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-16 20:16:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-20 16:17:18 -0800
commit709587d9f92d8c49be0a2c532776900bc41e1ff1 (patch)
tree89fc3fb33119f5a5e515abe900d8276f4b79f86c
parent8b0f773dad83e5d7bb07ae391352b6ffb7aa5937 (diff)
downloadtxr-709587d9f92d8c49be0a2c532776900bc41e1ff1.tar.gz
txr-709587d9f92d8c49be0a2c532776900bc41e1ff1.tar.bz2
txr-709587d9f92d8c49be0a2c532776900bc41e1ff1.zip
Combat spurious retention in args handling code.
* args.c (args_normalize): Zap the argument in the array when moving it over to the list. * args.h (args_atz): When zapping the argument in the list, zap the actual car field, rather than the list itself. It seems there is a copy of the list somewhere, so zapping it is not effective.
-rw-r--r--args.c2
-rw-r--r--args.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/args.c b/args.c
index 7f65fc9e..c82d5f62 100644
--- a/args.c
+++ b/args.c
@@ -48,7 +48,7 @@ void args_normalize(struct args *args, cnum fill)
bug_unless (fill <= args->argc);
while (args->fill > fill)
- args->list = cons(args->arg[--args->fill], args->list);
+ args->list = cons(z(args->arg[--args->fill]), args->list);
while (args->fill < fill && args->list)
args_add(args, pop(&args->list));
diff --git a/args.h b/args.h
index a0ea1743..23869d30 100644
--- a/args.h
+++ b/args.h
@@ -143,9 +143,12 @@ INLINE val args_at(struct args *args, cnum arg_index)
INLINE val args_atz(struct args *args, cnum arg_index)
{
- if (arg_index < args->fill)
+ if (arg_index < args->fill) {
return z(args->arg[arg_index]);
- return car(z(args->list));
+ } else {
+ loc l = car_l(args->list);
+ return zap(valptr(l));
+ }
}
INLINE val args_get(struct args *args, cnum *arg_index)