# HG changeset patch # User Alan Mackenzie # Date 1204929249 0 # Node ID 897b09fb6e1015d2cccafd15557b4c3e9b176576 # Parent 35628f10d78a86b0b363bc067ece77692098dfee (c-in-knr-argdecl): Limit number of paren/bracket pairs parsed, to solve performance problem. diff -r 35628f10d78a -r 897b09fb6e10 lisp/progmodes/cc-engine.el --- a/lisp/progmodes/cc-engine.el Fri Mar 07 22:31:59 2008 +0000 +++ b/lisp/progmodes/cc-engine.el Fri Mar 07 22:34:09 2008 +0000 @@ -6336,7 +6336,8 @@ ;; the searchable range. (let* ((macro-start (c-query-macro-start)) (lim (max (or lim (point-min)) (or macro-start (point-min)))) - before-lparen after-rparen) + before-lparen after-rparen + (pp-count-out 20)) ; Max number of paren/brace constructs before we give up (narrow-to-region lim (c-point 'eol)) ;; Search backwards for the defun's argument list. We give up if we @@ -6358,7 +6359,8 @@ ;; { (catch 'knr - (while t ; go round one paren/bracket construct each time round. + (while (> pp-count-out 0) ; go back one paren/bracket pair each time. + (setq pp-count-out (1- pp-count-out)) (c-syntactic-skip-backward "^)]}") (cond ((eq (char-before) ?\)) (setq after-rparen (point)))