>From 7219f991a94015e06851d54b77acb4b1161749a5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 27 Jun 2019 12:31:27 -0700 Subject: [PATCH] Omit a few minor unnecessary range checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 61e10dac47..ed1d2aedf3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5852,7 +5852,7 @@ DEFUN ("do-auto-save", Fdo_auto_save, Sdo_auto_save, 0, 2, "", 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 bbf25b4d58..f3d6508f46 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 3026ec7e99..9023f4efa0 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -799,10 +799,10 @@ DEFUN ("next-single-char-property-change", Fnext_single_char_property_change, 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 -- 2.21.0