emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 06d2eb3 3/3: Omit a few minor unnecessary range che


From: Paul Eggert
Subject: [Emacs-diffs] master 06d2eb3 3/3: Omit a few minor unnecessary range checks
Date: Thu, 27 Jun 2019 15:35:15 -0400 (EDT)

branch: master
commit 06d2eb33e1d189eee8d89cb5159f779e1600c4f2
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Omit a few minor unnecessary range checks
    
    Based on Pip Cet’s review (Bug#36370#19).
    * src/fileio.c (Fdo_auto_save):
    * src/image.c (lookup_image):
    * src/textprop.c (Fnext_single_char_property_change):
    Prefer XFIXNUM to XFIXNAT for clarity and consistency with
    neighboring code, and to avoid unnecessary range checks.
    * src/image.c (lookup_image): Omit unnecessary range checks.
---
 src/fileio.c   |  2 +-
 src/image.c    | 12 ++++++------
 src/textprop.c |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/fileio.c b/src/fileio.c
index 61e10da..ed1d2ae 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5852,7 +5852,7 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
                   spare the user annoying messages.  */
                && XFIXNUM (BVAR (b, save_length)) > 5000
                && (growth_factor * (BUF_Z (b) - BUF_BEG (b))
-                   < (growth_factor - 1) * XFIXNAT (BVAR (b, save_length)))
+                   < (growth_factor - 1) * XFIXNUM (BVAR (b, save_length)))
                /* These messages are frequent and annoying for `*mail*'.  */
                && !NILP (BVAR (b, filename))
                && NILP (no_message))
diff --git a/src/image.c b/src/image.c
index bbf25b4..f3d6508 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2385,18 +2385,18 @@ lookup_image (struct frame *f, Lisp_Object spec)
 #endif
 
          ascent = image_spec_value (spec, QCascent, NULL);
-         if (RANGED_FIXNUMP (0, ascent, INT_MAX))
-           img->ascent = XFIXNAT (ascent);
+         if (FIXNUMP (ascent))
+           img->ascent = XFIXNUM (ascent);
          else if (EQ (ascent, Qcenter))
            img->ascent = CENTERED_IMAGE_ASCENT;
 
          margin = image_spec_value (spec, QCmargin, NULL);
-         if (RANGED_FIXNUMP (0, margin, INT_MAX))
-           img->vmargin = img->hmargin = XFIXNAT (margin);
+         if (FIXNUMP (margin))
+           img->vmargin = img->hmargin = XFIXNUM (margin);
          else if (CONSP (margin))
            {
-             img->hmargin = XFIXNAT (XCAR (margin));
-             img->vmargin = XFIXNAT (XCDR (margin));
+             img->hmargin = XFIXNUM (XCAR (margin));
+             img->vmargin = XFIXNUM (XCDR (margin));
            }
 
          relief = image_spec_value (spec, QCrelief, NULL);
diff --git a/src/textprop.c b/src/textprop.c
index 3026ec7..9023f4e 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -799,10 +799,10 @@ last valid position in OBJECT.  */)
       else
        CHECK_FIXNUM_COERCE_MARKER (limit);
 
-      if (XFIXNAT (position) >= XFIXNUM (limit))
+      if (XFIXNUM (position) >= XFIXNUM (limit))
        {
          position = limit;
-         if (XFIXNAT (position) > ZV)
+         if (XFIXNUM (position) > ZV)
            XSETFASTINT (position, ZV);
        }
       else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]