]> git.eshelyaron.com Git - emacs.git/commit
Fix print.c infloop on circular lists
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Oct 2019 21:40:06 +0000 (14:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Oct 2019 21:43:14 +0000 (14:43 -0700)
commitf2a72bb8ed29223dd1197492d4270c171db5e443
tree60d90f60474f34750bf6c95b356c6128529cb1a4
parent581601e650cc8bdcf3ed83c6ae36744601c12ce9
Fix print.c infloop on circular lists

Fix infinite loops in print.c when a circular list is passed
to command-error-default-function or to error-message-string.
* src/print.c (print_error_message):
Use FOR_EACH_TAIL to avoid infloop on circular lists.
(print_object): Use FOR_EACH_TAIL_SAFE, as it uses
Brent’s teleporting tortoise-hare algorithm which is
asymptotically better than the classic tortoise-hare
algorithm that the code wsas using.
* test/src/print-tests.el (print-circle-2): When print-circle
is nil, do not insist on a particular cycle-detection heuristic.
(error-message-string-circular): New test.
src/print.c
test/src/print-tests.el