diff options
| author | Alan Mackenzie | 2008-04-01 21:41:21 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2008-04-01 21:41:21 +0000 |
| commit | f333bb770456b648dff22bd7dae046e9d567e88c (patch) | |
| tree | 7905591983192a88dda2343a12fb679ace1e6877 | |
| parent | 11322a61fd7498e327a1e1ccbdd7a653945deed4 (diff) | |
| download | emacs-f333bb770456b648dff22bd7dae046e9d567e88c.tar.gz emacs-f333bb770456b648dff22bd7dae046e9d567e88c.zip | |
(c-in-knr-argdecl): Limit number of paren/bracket pairs parsed, to solve
performance problem.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index acc876d576a..0282b156bb0 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6333,7 +6333,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6333 | ;; the searchable range. | 6333 | ;; the searchable range. |
| 6334 | (let* ((macro-start (c-query-macro-start)) | 6334 | (let* ((macro-start (c-query-macro-start)) |
| 6335 | (lim (max (or lim (point-min)) (or macro-start (point-min)))) | 6335 | (lim (max (or lim (point-min)) (or macro-start (point-min)))) |
| 6336 | before-lparen after-rparen) | 6336 | before-lparen after-rparen |
| 6337 | (pp-count-out 20)) ; Max number of paren/brace constructs before we give up | ||
| 6337 | (narrow-to-region lim (c-point 'eol)) | 6338 | (narrow-to-region lim (c-point 'eol)) |
| 6338 | 6339 | ||
| 6339 | ;; Search backwards for the defun's argument list. We give up if we | 6340 | ;; Search backwards for the defun's argument list. We give up if we |
| @@ -6355,7 +6356,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6355 | ;; { | 6356 | ;; { |
| 6356 | 6357 | ||
| 6357 | (catch 'knr | 6358 | (catch 'knr |
| 6358 | (while t ; go round one paren/bracket construct each time round. | 6359 | (while (> pp-count-out 0) ; go back one paren/bracket pair each time. |
| 6360 | (setq pp-count-out (1- pp-count-out)) | ||
| 6359 | (c-syntactic-skip-backward "^)]}") | 6361 | (c-syntactic-skip-backward "^)]}") |
| 6360 | (cond ((eq (char-before) ?\)) | 6362 | (cond ((eq (char-before) ?\)) |
| 6361 | (setq after-rparen (point))) | 6363 | (setq after-rparen (point))) |