emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a1cd8c9: Prefer NUMBERP to spelling it out


From: Paul Eggert
Subject: [Emacs-diffs] master a1cd8c9: Prefer NUMBERP to spelling it out
Date: Thu, 10 Sep 2015 16:53:56 +0000

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

    Prefer NUMBERP to spelling it out
    
    * src/editfns.c (styled_format):
    * src/frame.h (NUMVAL):
    * src/image.c (parse_image_spec):
    * src/lisp.h (CHECK_NUMBER_OR_FLOAT)
    (CHECK_NUMBER_OR_FLOAT_COERCE_MARKER):
    * src/process.c (Fsignal_process):
    * src/xdisp.c (calc_pixel_width_or_height, on_hot_spot_p):
    * src/xfaces.c (check_lface_attrs):
    * src/xselect.c (x_fill_property_data, x_send_client_event):
    Use NUMBERP rather than INTEGERP || FLOATP.
---
 src/editfns.c |    2 +-
 src/frame.h   |    2 +-
 src/image.c   |    2 +-
 src/lisp.h    |    4 ++--
 src/process.c |    2 +-
 src/xdisp.c   |    6 +++---
 src/xfaces.c  |    3 +--
 src/xselect.c |    4 ++--
 8 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index 831edb4..2080b53 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4154,7 +4154,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                      || conversion == 'X'))
            error ("Invalid format operation %%%c",
                   STRING_CHAR ((unsigned char *) format - 1));
-         else if (! (INTEGERP (args[n]) || FLOATP (args[n])))
+         else if (! NUMBERP (args[n]))
            error ("Format specifier doesn't match argument type");
          else
            {
diff --git a/src/frame.h b/src/frame.h
index 8ee37df..17e356d 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -618,7 +618,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object 
val)
 }
 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
 
-#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
+#define NUMVAL(X) (NUMBERP (X) ? XFLOATINT (X) : -1)
 
 INLINE double
 default_pixels_per_inch_x (void)
diff --git a/src/image.c b/src/image.c
index 2aa01e4..b586c53 100644
--- a/src/image.c
+++ b/src/image.c
@@ -797,7 +797,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
          return 0;
 
        case IMAGE_NUMBER_VALUE:
-         if (!INTEGERP (value) && !FLOATP (value))
+         if (! NUMBERP (value))
            return 0;
          break;
 
diff --git a/src/lisp.h b/src/lisp.h
index d2d3856..71630ed 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2736,7 +2736,7 @@ XFLOATINT (Lisp_Object n)
 INLINE void
 CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
 {
-  CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x);
+  CHECK_TYPE (NUMBERP (x), Qnumberp, x);
 }
 
 #define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x)                         \
@@ -2744,7 +2744,7 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
     if (MARKERP (x))                                                   \
       XSETFASTINT (x, marker_position (x));                            \
     else                                                               \
-      CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); \
+      CHECK_TYPE (NUMBERP (x), Qnumber_or_marker_p, x);                        
\
   } while (false)
 
 /* Since we can't assign directly to the CAR or CDR fields of a cons
diff --git a/src/process.c b/src/process.c
index 26f26c3..ed5f4c0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6269,7 +6269,7 @@ SIGCODE may be an integer, or a symbol whose name is a 
signal name.  */)
        {
          Lisp_Object process_number
            = string_to_number (SSDATA (process), 10, 1);
-         if (INTEGERP (process_number) || FLOATP (process_number))
+         if (NUMBERP (process_number))
            tem = process_number;
        }
       process = tem;
diff --git a/src/xdisp.c b/src/xdisp.c
index 1a5be59..bb31697 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -24063,7 +24063,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
        prop = Qnil;
     }
 
-  if (INTEGERP (prop) || FLOATP (prop))
+  if (NUMBERP (prop))
     {
       int base_unit = (width_p
                       ? FRAME_COLUMN_WIDTH (it->f)
@@ -24115,7 +24115,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
            car = Qnil;
        }
 
-      if (INTEGERP (car) || FLOATP (car))
+      if (NUMBERP (car))
        {
          double fact;
          pixels = XFLOATINT (car);
@@ -29062,7 +29062,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
       Lisp_Object lr, lx0, ly0;
       if (CONSP (circ)
          && CONSP (XCAR (circ))
-         && (lr = XCDR (circ), INTEGERP (lr) || FLOATP (lr))
+         && (lr = XCDR (circ), NUMBERP (lr))
          && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
          && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
        {
diff --git a/src/xfaces.c b/src/xfaces.c
index a4f1aa8..453fd58 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1669,8 +1669,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
           || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
-          || INTEGERP (attrs[LFACE_HEIGHT_INDEX])
-          || FLOATP (attrs[LFACE_HEIGHT_INDEX])
+          || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
           || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
diff --git a/src/xselect.c b/src/xselect.c
index 94a5584..e7e3fe7 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2271,7 +2271,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, 
void *ret, int format)
     {
       Lisp_Object o = XCAR (iter);
 
-      if (INTEGERP (o) || FLOATP (o) || CONSP (o))
+      if (NUMBERP (o) || CONSP (o))
         {
           if (CONSP (o)
              && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
@@ -2547,7 +2547,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
       else
         error ("DEST as a string must be one of PointerWindow or InputFocus");
     }
-  else if (INTEGERP (dest) || FLOATP (dest) || CONSP (dest))
+  else if (NUMBERP (dest) || CONSP (dest))
     CONS_TO_INTEGER (dest, Window, wdest);
   else
     error ("DEST must be a frame, nil, string, number or cons");



reply via email to

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