diff lisp/bytecomp.el @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children 8626e4521993
line wrap: on
line diff
--- a/lisp/bytecomp.el	Mon Aug 13 11:03:09 2007 +0200
+++ b/lisp/bytecomp.el	Mon Aug 13 11:04:06 2007 +0200
@@ -3125,15 +3125,15 @@
 	  (t (byte-compile-normal-call form)))))
 
 (defun byte-compile-buffer-substring (form)
-  (let ((len (length form)))
-    ;; buffer-substring used to take exactly two args, but now takes 0-3.
-    ;; convert 0-2 to two args and use special bytecode operand.
-    ;; convert 3 args to a normal call.
-    (cond ((= len 1) (setq form (append form '(nil nil)))
-	   (= len 2) (setq form (append form '(nil)))))
-    (cond ((= len 3) (byte-compile-two-args form))
-	  ((= len 4) (byte-compile-normal-call form))
-	  (t (byte-compile-subr-wrong-args form "0-3")))))
+  ;; buffer-substring used to take exactly two args, but now takes 0-3.
+  ;; convert 0-2 to two args and use special bytecode operand.
+  ;; convert 3 args to a normal call.
+  (case (length (cdr form))
+    (0 (byte-compile-two-args (append form '(nil nil))))
+    (1 (byte-compile-two-args (append form '(nil))))
+    (2 (byte-compile-two-args form))
+    (3 (byte-compile-normal-call form))
+    (t (byte-compile-subr-wrong-args form "0-3"))))
 
 (defun byte-compile-list (form)
   (let ((count (length (cdr form))))