]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/cc-defs.el (c-safe-scan-lists): Evaluate LIMIT just once
authorAlan Mackenzie <acm@muc.de>
Wed, 17 Aug 2022 20:34:43 +0000 (20:34 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 17 Aug 2022 20:34:43 +0000 (20:34 +0000)
lisp/progmodes/cc-defs.el

index 04f519dd0a503047b30a6288d5d6c451c4faa35f..48ae4368a7c46ac7ae89c4a3f496d3bded920953 100644 (file)
@@ -794,15 +794,16 @@ right side of it."
               `(c-safe (scan-lists ,from ,count ,depth)))))
     (if limit
        `(save-restriction
-          (when ,limit
-            ,(if (numberp count)
-                 (if (< count 0)
-                     `(narrow-to-region ,limit (point-max))
-                   `(narrow-to-region (point-min) ,limit))
-               `(if (< ,count 0)
-                    (narrow-to-region ,limit (point-max))
-                  (narrow-to-region (point-min) ,limit))))
-          ,res)
+          (let ((-limit- ,limit))
+            (when -limit-
+              ,(if (numberp count)
+                   (if (< count 0)
+                       `(narrow-to-region -limit- (point-max))
+                     `(narrow-to-region (point-min) -limit-))
+                 `(if (< ,count 0)
+                      (narrow-to-region -limit- (point-max))
+                    (narrow-to-region (point-min) -limit-))))
+            ,res))
       res)))
 
 \f