From: Paul Eggert Date: Thu, 27 Jun 2019 19:31:27 +0000 (-0700) Subject: Omit a few minor unnecessary range checks X-Git-Tag: emacs-27.0.90~2177 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=06d2eb33e1d189eee8d89cb5159f779e1600c4f2;p=emacs.git 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. --- diff --git a/src/fileio.c b/src/fileio.c index 61e10dac47f..ed1d2aedf37 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 bbf25b4d58f..f3d6508f460 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 3026ec7e992..9023f4efa06 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