aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2008-03-07 22:34:09 +0000
committerAlan Mackenzie2008-03-07 22:34:09 +0000
commit6b6481ed7222da77a1fb5c68aa4861477e2d6e44 (patch)
tree929281525f570732aae762b4c04e2306abe18c45
parentf1bb4ee1b8e34a55b5640e46bc5e7ea7d3070d12 (diff)
downloademacs-6b6481ed7222da77a1fb5c68aa4861477e2d6e44.tar.gz
emacs-6b6481ed7222da77a1fb5c68aa4861477e2d6e44.zip
(c-in-knr-argdecl): Limit number of paren/bracket pairs parsed, to solve
performance problem.
-rw-r--r--lisp/progmodes/cc-engine.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6ccd41a164c..2007f8ef919 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6336,7 +6336,8 @@ comment at the start of cc-engine.el for more info."
6336 ;; the searchable range. 6336 ;; the searchable range.
6337 (let* ((macro-start (c-query-macro-start)) 6337 (let* ((macro-start (c-query-macro-start))
6338 (lim (max (or lim (point-min)) (or macro-start (point-min)))) 6338 (lim (max (or lim (point-min)) (or macro-start (point-min))))
6339 before-lparen after-rparen) 6339 before-lparen after-rparen
6340 (pp-count-out 20)) ; Max number of paren/brace constructs before we give up
6340 (narrow-to-region lim (c-point 'eol)) 6341 (narrow-to-region lim (c-point 'eol))
6341 6342
6342 ;; Search backwards for the defun's argument list. We give up if we 6343 ;; Search backwards for the defun's argument list. We give up if we
@@ -6358,7 +6359,8 @@ comment at the start of cc-engine.el for more info."
6358 ;; { 6359 ;; {
6359 6360
6360 (catch 'knr 6361 (catch 'knr
6361 (while t ; go round one paren/bracket construct each time round. 6362 (while (> pp-count-out 0) ; go back one paren/bracket pair each time.
6363 (setq pp-count-out (1- pp-count-out))
6362 (c-syntactic-skip-backward "^)]}") 6364 (c-syntactic-skip-backward "^)]}")
6363 (cond ((eq (char-before) ?\)) 6365 (cond ((eq (char-before) ?\))
6364 (setq after-rparen (point))) 6366 (setq after-rparen (point)))