emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 1392ec7 2/3: A quicker check for quit


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 1392ec7 2/3: A quicker check for quit
Date: Tue, 31 Jan 2017 11:31:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>>> regex.c calls maybe_quit internally, so why do we need this
>>> additional call?
>> 
>> The regex code does not always call maybe_quit. For example, without
>> this additional call, (re-search-forward "[[:alpha:]]" nil nil
>> most-positive-fixnum) would loop indefinitely in a buffer containing
>> only alphabetic characters on a 64-bit platform.
>
> Then maybe we should add maybe_quit calls in regex.c instead?

FWIW, in the case or (re-search-forward "[[:alpha:]]" nil nil
most-positive-fixnum) the regexp matches themselves are constant-time
operations, repeated in search.c, so it makes sense to put the maybe_quit
in search.c rather than in regexp.c.

Clearly both options will/would work, but I think the general design of
maybe_quit is that we should not need to put one in code whose runtime
is constant.  IOW the maybe_quit calls should be on the backward-edges
of loops which means that running a loop a single time may but does not
need to call maybe_quit.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]