diff options
author | Alan Mackenzie <acm@muc.de> | 2020-12-24 11:29:27 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2020-12-24 11:29:27 +0000 |
commit | 3096437593ca6d1ea07809f7d0e2198705f20e55 (patch) | |
tree | 013eeb294c23ba48540962c1cdc9a7ab39bd24c0 /lib/malloc/scratch_buffer_grow.c | |
parent | ccb3efffc5a41353abb6ae223a7dcff1ea20e5fb (diff) | |
download | emacs-3096437593ca6d1ea07809f7d0e2198705f20e55.tar.gz emacs-3096437593ca6d1ea07809f7d0e2198705f20e55.tar.bz2 emacs-3096437593ca6d1ea07809f7d0e2198705f20e55.zip |
CC Mode: introduce a new cache for brace structures. This fixes bug #45248
Also fix three infinite loops. The new cache accelerates backward searches
for struct beginnings in c-looking-at-or-maybe-in-bracelist.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): In the final loop
over unary operators, add a check (> (point) lim) to avoid certain infinite
loops.
(c-beginning-of-decl-1): In the first loop add a similar check on point and
lim.
(c-laomib-loop): New function extracted from
c-looking-at-or-maybe-in-bracelist.
(c-laomib-cache): New buffer local variable.
(c-laomib-get-cache, c-laomib-put-cache, c-laomib-fix-elt)
(c-laomib-invalidate-cache): New functions which implement the cache.
(c-looking-at-or-maybe-in-bracelist): Replace two invocations of
c-go-up-list-backwards with calls to c-parse-state. Extract the new function
c-laomib-loop. Insert code which calls c-laomib-loop minimally, with the help
of the new cache.
* lisp/progmodes/cc-mode.el (c-basic-common-init): Initialise the new cach
(at mode start).
(c-before-change): Invalidate the new cache.
(c-fl-decl-start): Add an extra check (> (point) bod-lim) to prevent looping.
Determine the enclosing brace to pass as arguments to
c-looking-at-or-maybe-in-bracelist.
Diffstat (limited to 'lib/malloc/scratch_buffer_grow.c')
0 files changed, 0 insertions, 0 deletions