]> git.eshelyaron.com Git - emacs.git/commitdiff
Check result from c-backward-token-2 to avoid infinite loop
authorAlan Mackenzie <acm@muc.de>
Thu, 20 Dec 2018 12:21:16 +0000 (12:21 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 20 Dec 2018 12:21:16 +0000 (12:21 +0000)
This fixes bug #33784.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): While moving back
over enclosing parentheses, check that c-backward-token-2 actually moves.

lisp/progmodes/cc-fonts.el

index 39d167f0190645b7ee528c8c8f3fec285824ad1b..2e47bdab56701c1c6edbb0348a997d71106f789a 100644 (file)
@@ -1284,8 +1284,8 @@ casts and declarations are fontified.  Used on level 2 and higher."
                (save-excursion
                  (goto-char match-pos)
                  (while
-                     (progn (c-backward-token-2)
-                            (eq (char-after) ?\()))
+                     (and (zerop (c-backward-token-2))
+                          (eq (char-after) ?\()))
                  (looking-at c-arithmetic-op-regexp)))
           (cons nil nil))
          ;; In a C++ member initialization list.