changeset 52852:ac400ff02a1c

(Fset_window_margins): Simplify arg checking.
author Kim F. Storm <storm@cua.dk>
date Tue, 14 Oct 2003 09:33:09 +0000
parents f137e448c2f2
children 91a9da753e30
files src/window.c
diffstat 1 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Tue Oct 14 09:32:52 2003 +0000
+++ b/src/window.c	Tue Oct 14 09:33:09 2003 +0000
@@ -5856,24 +5856,22 @@
 {
   struct window *w = decode_window (window);
 
-  if (!NILP (left))
-    CHECK_NUMBER (left);
-  if (!NILP (right))
-    CHECK_NUMBER (right);
-
-  /* Check widths < 0 and translate a zero width to nil.
+  /* Translate negative or zero widths 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 (left))
+    {
+      CHECK_NUMBER (left);
+      if (XINT (left) <= 0)
+	left = 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))