]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fset_window_margins): Simplify arg checking.
authorKim F. Storm <storm@cua.dk>
Tue, 14 Oct 2003 09:33:09 +0000 (09:33 +0000)
committerKim F. Storm <storm@cua.dk>
Tue, 14 Oct 2003 09:33:09 +0000 (09:33 +0000)
src/window.c

index 824200dc18f2f4e5f0e06e0569f5563b6ad8dfea..10de132fcce13ed837ed95f08d7bbf4c4c3e7cc8 100644 (file)
@@ -5856,24 +5856,22 @@ A nil width parameter means no margin.  */)
 {
   struct window *w = decode_window (window);
 
+  /* Translate negative or zero widths to nil.
+     Margins that are too wide have to be checked elsewhere.  */
+
   if (!NILP (left))
-    CHECK_NUMBER (left);
-  if (!NILP (right))
-    CHECK_NUMBER (right);
+    {
+      CHECK_NUMBER (left);
+      if (XINT (left) <= 0)
+       left = Qnil;
+    }
 
-  /* Check widths < 0 and translate a zero width to nil.
-     Margins that are too wide have to be checked elsewhere.  */
-  if ((INTEGERP (left) && XINT (left) < 0)
-      || (FLOATP (left) && XFLOAT_DATA (left) <= 0))
-     XSETFASTINT (left, 0);
-  if (INTEGERP (left) && XFASTINT (left) == 0)
-    left = Qnil;
-
-  if ((INTEGERP (right) && XINT (right) < 0)
-      || (FLOATP (right) && XFLOAT_DATA (right) <= 0))
-    XSETFASTINT (right, 0);
-  if (INTEGERP (right) && XFASTINT (right) == 0)
-    right = Qnil;
+  if (!NILP (right))
+    {
+      CHECK_NUMBER (right);
+      if (XINT (right) <= 0)
+       right = Qnil;
+    }
 
   if (!EQ (w->left_margin_cols, left)
       || !EQ (w->right_margin_cols, right))