• Paul Eggert's avatar
    Fix print.c infloop on circular lists · f2a72bb8
    Paul Eggert authored
    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.
    f2a72bb8
print.c 69.7 KB