CC Mode: Optimize scanning of heavily nested brace blocks
This should have fixed bug#74357.
* lisp/progmodes/cc-engine.el (c-laomib-cache): Change the
size of this cache from 4 to 50.
(c-laomib-get-cache, c-laomib-put-cache): Use assq, memq, and
ntake or butlast, rather than looping through the cache with a
cdr loop. No longer attempt to preserve the "largest" cache
element.
(c-looking-at-or-maybe-in-bracelist): Extend the range covered
by a c-laomib-cache element, rather than adding a second
element to the cache.
(c-no-bracelist-cache): A new cache for the use of
c-inside-bracelist-p, based on the c-parse-state cache.
(c-inside-bracelist-p): Use the new cache to call
c-looking-at-or-maybe-in-bracelist less often.
* lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize
c-no-bracelist-cache.
(c-before-change): Invalidate c-no-bracelist-cache.
(cherry picked from commit
b5f1a9e6d3e565585352747733c73d45e6be3bda)