]> git.eshelyaron.com Git - emacs.git/commitdiff
c-find-decl-spots: Replace an arbitrary search limit by a parameter
authorAlan Mackenzie <acm@muc.de>
Wed, 26 Oct 2022 16:02:49 +0000 (16:02 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 26 Oct 2022 16:02:49 +0000 (16:02 +0000)
The old arbitrary limit led to errors thrown whilst fontifying large areas of
syntactic whitespace containing "#undef", as in src/comp.c.

* lisp/progmodes/cc-engine.el (c-find-decl-spots): Replace the limit argument
to two calls of c-forward-syntactic-ws by the parameter `cfd-limit'.

lisp/progmodes/cc-engine.el

index e71560fa25f6bd6839c78fa73b86d1a848fdb3ef..ed06807a87e51cb11a4a9ac7063a122535024ac2 100644 (file)
@@ -6693,8 +6693,7 @@ comment at the start of cc-engine.el for more info."
          ;; syntactic ws.
          (when (and cfd-match-pos (< cfd-match-pos syntactic-pos))
            (goto-char syntactic-pos)
-           (c-forward-syntactic-ws
-            (min (+ (point) 2000) (point-max)))
+           (c-forward-syntactic-ws cfd-limit)
            (and cfd-continue-pos
                 (< cfd-continue-pos (point))
                 (setq cfd-token-pos (point))))
@@ -6735,8 +6734,7 @@ comment at the start of cc-engine.el for more info."
                        ;; can't be nested, and that's already been done in
                        ;; `c-find-decl-prefix-search'.
                        (when (> cfd-continue-pos cfd-token-pos)
-                         (c-forward-syntactic-ws
-                          (min (+ (point) 2000) (point-max)))
+                         (c-forward-syntactic-ws cfd-limit)
                          (setq cfd-token-pos (point)))
 
                        ;; Continue if the following token fails the