summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-21 06:22:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-21 06:22:09 -0700
commit0dafb8b8b7030dc63dce6c5bfb12dac526205696 (patch)
tree562c9db180b0f84b1172e0f201effebb6200525e /parser.c
parente933786bcdc0be5b01a64a70b3997013220443c0 (diff)
downloadtxr-0dafb8b8b7030dc63dce6c5bfb12dac526205696.tar.gz
txr-0dafb8b8b7030dc63dce6c5bfb12dac526205696.tar.bz2
txr-0dafb8b8b7030dc63dce6c5bfb12dac526205696.zip
Another fix to print method circular printing.
Continuing on the theme of the previous patch, we now properly detect the situation when the recursive call is re-introducing duplicate references to objects that have already been sent to the stream without at #<num>= label. It's too late to print those objects, so we throw an exception. * lib.c (obj_print_impl): When we print an object that doesn't have duplicates (its hash entry has a nil value), we replace that value with the : symbol to indicate that the object has already been printed. (obj_hash_merge): New function, factoring out the hash merging logic from obj_print, introduced in parent commit. Here, we detect the case that the recursive print call has submitted to us an object which was already printed without a label: because it is associated with the : symbol in the parent hash. This situation is a show-stopper so we throw. We cannot attempt to print the object in any manner because we can get into runaway recursion. (obj_print): Hash merging logic replaced with call to new static function.
Diffstat (limited to 'parser.c')
0 files changed, 0 insertions, 0 deletions