diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-12 06:45:15 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-12 06:45:15 -0700 |
commit | 4dccf5b31a53bb42b333922243604ca6b1da4214 (patch) | |
tree | a7a80c818578445d2079b42bac7dccc3251e7038 | |
parent | af8729499466e0edd22d42648a714bb584856cf7 (diff) | |
download | txr-4dccf5b31a53bb42b333922243604ca6b1da4214.tar.gz txr-4dccf5b31a53bb42b333922243604ca6b1da4214.tar.bz2 txr-4dccf5b31a53bb42b333922243604ca6b1da4214.zip |
Honor *print-circle* disabling in print methods.
* lib.c (obj_print): Don't assume that if we have a circle
printing context in the stream, circle printing is
enabled. Check the variable.
-rw-r--r-- | lib.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -10341,12 +10341,16 @@ val obj_print(val obj, val out, val pretty) uw_simple_catch_begin; if (ctx) { - ctx->obj_hash_prev = ctx->obj_hash; - ctx->obj_hash = make_hash(nil, nil, nil); - populate_obj_hash(obj, ctx); - obj_hash_merge(ctx->obj_hash_prev, ctx->obj_hash); - ctx->obj_hash = ctx->obj_hash_prev; - ctx->obj_hash_prev = nil; + if (cdr(lookup_var(nil, print_circle_s))) { + ctx->obj_hash_prev = ctx->obj_hash; + ctx->obj_hash = make_hash(nil, nil, nil); + populate_obj_hash(obj, ctx); + obj_hash_merge(ctx->obj_hash_prev, ctx->obj_hash); + ctx->obj_hash = ctx->obj_hash_prev; + ctx->obj_hash_prev = nil; + } else { + ctx = 0; + } } else { if (print_circle_s && cdr(lookup_var(nil, print_circle_s))) { ctx = &ctx_struct; |