emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100419: Limit recursion depth of


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100419: Limit recursion depth of c-forward-<>-arglist-recur (Bug#7722).
Date: Wed, 26 Jan 2011 19:51:41 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100419
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Wed 2011-01-26 19:51:41 -0500
message:
  Limit recursion depth of c-forward-<>-arglist-recur (Bug#7722).
  
  * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Set a limit
  to the recursion depth.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-engine.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-26 18:05:13 +0000
+++ b/lisp/ChangeLog    2011-01-27 00:51:41 +0000
@@ -1,3 +1,8 @@
+2011-01-27  Chong Yidong  <address@hidden>
+
+       * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Set a limit
+       to the recursion depth (Bug#7722).
+
 2011-01-26  Roy Liu <address@hidden> (tiny change)
 
        * term/ns-win.el (ns-find-file): Expand ns-input-file with

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2011-01-02 23:50:46 +0000
+++ b/lisp/progmodes/cc-engine.el       2011-01-27 00:51:41 +0000
@@ -4393,6 +4393,8 @@
       (goto-char safe-pos)
       t)))
 
+(defvar c-forward-<>-arglist-recur-depth)
+
 (defun c-forward-<>-arglist (all-types)
   ;; The point is assumed to be at a "<".  Try to treat it as the open
   ;; paren of an angle bracket arglist and move forward to the
@@ -4418,7 +4420,8 @@
        ;; If `c-record-type-identifiers' is set then activate
        ;; recording of any found types that constitute an argument in
        ;; the arglist.
-       (c-record-found-types (if c-record-type-identifiers t)))
+       (c-record-found-types (if c-record-type-identifiers t))
+       (c-forward-<>-arglist-recur--depth 0))
     (if (catch 'angle-bracket-arglist-escape
          (setq c-record-found-types
                (c-forward-<>-arglist-recur all-types)))
@@ -4434,6 +4437,14 @@
       nil)))
 
 (defun c-forward-<>-arglist-recur (all-types)
+
+  ;; Temporary workaround for Bug#7722.
+  (when (boundp 'c-forward-<>-arglist-recur--depth)
+    (if (> c-forward-<>-arglist-recur--depth 200)
+       (error "Max recursion depth reached in <> arglist")
+      (setq c-forward-<>-arglist-recur--depth
+           (1+ c-forward-<>-arglist-recur--depth))))
+
   ;; Recursive part of `c-forward-<>-arglist'.
   ;;
   ;; This function might do hidden buffer changes.


reply via email to

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