summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-31 21:41:53 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-31 21:41:53 -0700
commitaed4c55e415754df64073565e3b9c4979d033370 (patch)
tree5cb84003d2c47cda6938e7df2ff2dcbc75c58b29
parent5d9e217bb248015823c948010c1f0b47efe2cdb4 (diff)
downloadtxr-aed4c55e415754df64073565e3b9c4979d033370.tar.gz
txr-aed4c55e415754df64073565e3b9c4979d033370.tar.bz2
txr-aed4c55e415754df64073565e3b9c4979d033370.zip
Don't enter symbols into cycle-identifying hash.
* lib.c (circle_print_eligible): New inline function. (obj_print_impl): Do not bother with hash lookup for interned objects that don't participate in circle notation. (populate_obj_hash): Replace open-coded test with call to circle_print_eligible.
-rw-r--r--lib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index 05541f5d..7b67c4d1 100644
--- a/lib.c
+++ b/lib.c
@@ -9209,11 +9209,16 @@ static void out_quasi_str(val args, val out, struct strm_ctx *ctx)
}
}
+INLINE int circle_print_eligible(val obj)
+{
+ return is_ptr(obj) && (!symbolp(obj) || !symbol_package(obj));
+}
+
val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
{
val ret = obj;
- if (ctx && is_ptr(obj)) {
+ if (ctx && circle_print_eligible(obj)) {
val cell = gethash_c(ctx->obj_hash, obj, nulloc);
val label = cdr(cell);
@@ -9515,7 +9520,7 @@ dot:
static void populate_obj_hash(val obj, struct strm_ctx *ctx)
{
tail:
- if (is_ptr(obj) && (!symbolp(obj) || !symbol_package(obj))) {
+ if (circle_print_eligible(obj)) {
val new_p;
val cell = gethash_c(ctx->obj_hash, obj, mkcloc(new_p));