• Paul Eggert's avatar
    Signal list cycles in ‘length’ etc. · 14dd9101
    Paul Eggert authored
    Use macros like FOR_EACH_TAIL instead of maybe_quit to
    catch list cycles automatically instead of relying on the
    user becoming impatient and typing C-g (Bug#25606).
    * src/fns.c (Flength, Fmember, Fmemq, Fmemql, Fassq, Fassoc, Frassq)
    (Frassoc, Fdelete, Freverse):
    Use FOR_EACH_TAIL instead of maybe_quit.
    (Fnreverse): Use simple EQ to check for circular list instead
    of rarely_quit, as this suffices in this unusual case.
    (Fplist_put, Flax_plist_put, Flax_plist_put):
    Use FOR_EACH_TAIL_CONS instead of maybe_quit.
    (internal_equal): Use FOR_EACH_TAIL_CONS to check lists, instead
    of by-hand tail recursion that did not catch cycles.
    * src/fns.c (Fsafe_length, Fplist_get):
    * src/xdisp.c (display_mode_element):
    Use FOR_EACH_TAIL_SAFE instead of by-hand Floyd’s algorithm.
    * src/lisp.h (QUIT_COUNT_HEURISTIC): Remove; no longer needed.
    (rarely_quit): Simply count toward USHRT_MAX + 1, since the
    fancier versions are no longer needed.
    (FOR_EACH_TAIL_CONS, FOR_EACH_TAIL_SAFE)
    (FOR_EACH_TAIL_INTERNAL): New macros, the last with definiens
    mostly taken from FOR_EACH_TAIL.
    (FOR_EACH_TAIL): Rewrite in terms of FOR_EACH_TAIL_INTERNAL.
    14dd9101
xdisp.c 993 KB