1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-03 14:10:47 -08:00

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.
This commit is contained in:
Paul Eggert 2019-06-27 12:31:27 -07:00
parent f59a3f3d61
commit 06d2eb33e1
3 changed files with 9 additions and 9 deletions

View file

@ -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))

View file

@ -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);

View file

@ -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