emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master d0d26c1: Remove XFLOATINT


From: Paul Eggert
Subject: [Emacs-diffs] master d0d26c1: Remove XFLOATINT
Date: Thu, 2 Mar 2017 12:22:21 -0500 (EST)

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

    Remove XFLOATINT
    
    * src/lisp.h (XFLOATINT): Remove this alias for extract_float.
    All callers changed to use extract_float.
    * src/frame.h (NUMVAL): Now an inline function, not a macro.
---
 src/floatfns.c |  4 ++--
 src/frame.c    |  4 ++--
 src/frame.h    |  6 +++++-
 src/image.c    |  6 +++---
 src/lisp.h     |  6 ------
 src/nsterm.m   |  2 +-
 src/window.c   |  4 ++--
 src/xdisp.c    | 26 +++++++++++++-------------
 8 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/src/floatfns.c b/src/floatfns.c
index 96711fa..737fb22 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -178,7 +178,7 @@ The function returns the cons cell (SGNFCAND . EXP).
 If X is zero, both parts (SGNFCAND and EXP) are zero.  */)
   (Lisp_Object x)
 {
-  double f = XFLOATINT (x);
+  double f = extract_float (x);
   int exponent;
   double sgnfcand = frexp (f, &exponent);
   return Fcons (make_float (sgnfcand), make_number (exponent));
@@ -191,7 +191,7 @@ EXPONENT must be an integer.   */)
 {
   CHECK_NUMBER (exponent);
   int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
-  return make_float (ldexp (XFLOATINT (sgnfcand), e));
+  return make_float (ldexp (extract_float (sgnfcand), e));
 }
 
 DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
diff --git a/src/frame.c b/src/frame.c
index 5e1e2f1..daf4245 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3530,9 +3530,9 @@ x_set_screen_gamma (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
 
   if (NILP (new_value))
     f->gamma = 0;
-  else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
+  else if (NUMBERP (new_value) && extract_float (new_value) > 0)
     /* The value 0.4545 is the normal viewing gamma.  */
-    f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
+    f->gamma = 1.0 / (0.4545 * extract_float (new_value));
   else
     signal_error ("Invalid screen-gamma", new_value);
 
diff --git a/src/frame.h b/src/frame.h
index 7331352..6f85f85 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -621,7 +621,11 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object 
val)
 }
 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
 
-#define NUMVAL(X) (NUMBERP (X) ? XFLOATINT (X) : -1)
+INLINE double
+NUMVAL (Lisp_Object x)
+{
+  return NUMBERP (x) ? extract_float (x) : -1;
+}
 
 INLINE double
 default_pixels_per_inch_x (void)
diff --git a/src/image.c b/src/image.c
index fc396c7..3711dd1 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4915,19 +4915,19 @@ x_edge_detection (struct frame *f, struct image *img, 
Lisp_Object matrix,
       for (i = 0;
           i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
           ++i, matrix = XCDR (matrix))
-       trans[i] = XFLOATINT (XCAR (matrix));
+       trans[i] = extract_float (XCAR (matrix));
     }
   else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
     {
       for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
-       trans[i] = XFLOATINT (AREF (matrix, i));
+       trans[i] = extract_float (AREF (matrix, i));
     }
 
   if (NILP (color_adjust))
     color_adjust = make_number (0xffff / 2);
 
   if (i == 9 && NUMBERP (color_adjust))
-    x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
+    x_detect_edges (f, img, trans, extract_float (color_adjust));
 }
 
 
diff --git a/src/lisp.h b/src/lisp.h
index a757dfd..a910411 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2803,12 +2803,6 @@ CHECK_NATNUM (Lisp_Object x)
       CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x);              \
   } while (false)
 
-INLINE double
-XFLOATINT (Lisp_Object n)
-{
-  return extract_float (n);
-}
-
 INLINE void
 CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
 {
diff --git a/src/nsterm.m b/src/nsterm.m
index eaefea7..80261d6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4814,7 +4814,7 @@ ns_term_init (Lisp_Object display_name)
       /* this is a standard variable */
       ns_default ("AppleAntiAliasingThreshold", &tmp,
                  make_float (10.0), make_float (6.0), YES, NO);
-      ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp);
+      ns_antialias_threshold = NILP (tmp) ? 10.0 : extract_float (tmp);
     }
 
   NSTRACE_MSG ("Colors");
diff --git a/src/window.c b/src/window.c
index 9569044..3e2eb16 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7129,8 +7129,8 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
       int old_dy = w->vscroll;
 
       w->vscroll = - (NILP (pixels_p)
-                     ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll)
-                     : XFLOATINT (vscroll));
+                     ? FRAME_LINE_HEIGHT (f) * extract_float (vscroll)
+                     : extract_float (vscroll));
       w->vscroll = min (w->vscroll, 0);
 
       if (w->vscroll != old_dy)
diff --git a/src/xdisp.c b/src/xdisp.c
index 851a32b..12f42d1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4870,7 +4870,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  height = safe_call1 (it->font_height,
                                       face->lface[LFACE_HEIGHT_INDEX]);
                  if (NUMBERP (height))
-                   new_height = XFLOATINT (height);
+                   new_height = extract_float (height);
                }
              else if (NUMBERP (it->font_height))
                {
@@ -4879,7 +4879,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
 
                  f = FACE_FROM_ID (it->f,
                                    lookup_basic_face (it->f, DEFAULT_FACE_ID));
-                 new_height = (XFLOATINT (it->font_height)
+                 new_height = (extract_float (it->font_height)
                                * XINT (f->lface[LFACE_HEIGHT_INDEX]));
                }
              else
@@ -4894,7 +4894,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  unbind_to (count, Qnil);
 
                  if (NUMBERP (value))
-                   new_height = XFLOATINT (value);
+                   new_height = extract_float (value);
                }
 
              if (new_height > 0)
@@ -4916,7 +4916,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
            return 0;
 
          value = XCAR (XCDR (spec));
-         if (NUMBERP (value) && XFLOATINT (value) > 0)
+         if (NUMBERP (value) && extract_float (value) > 0)
            it->space_width = value;
        }
 
@@ -4968,7 +4968,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
          if (NUMBERP (value))
            {
              struct face *face = FACE_FROM_ID (it->f, it->face_id);
-             it->voffset = - (XFLOATINT (value)
+             it->voffset = - (extract_float (value)
                               * (normal_char_height (face->font, -1)));
            }
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -11058,7 +11058,7 @@ resize_mini_window (struct window *w, bool exact_p)
 
       /* Compute the max. number of lines specified by the user.  */
       if (FLOATP (Vmax_mini_window_height))
-       max_height = XFLOATINT (Vmax_mini_window_height) * total_height;
+       max_height = extract_float (Vmax_mini_window_height) * total_height;
       else if (INTEGERP (Vmax_mini_window_height))
        max_height = XINT (Vmax_mini_window_height) * unit;
       else
@@ -15501,7 +15501,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
          height = WINDOW_BOX_TEXT_HEIGHT (w);
          if (NUMBERP (aggressive))
            {
-             double float_amount = XFLOATINT (aggressive) * height;
+             double float_amount = extract_float (aggressive) * height;
              int aggressive_scroll = float_amount;
              if (aggressive_scroll == 0 && float_amount > 0)
                aggressive_scroll = 1;
@@ -15617,7 +15617,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
              height = WINDOW_BOX_TEXT_HEIGHT (w);
              if (NUMBERP (aggressive))
                {
-                 double float_amount = XFLOATINT (aggressive) * height;
+                 double float_amount = extract_float (aggressive) * height;
                  int aggressive_scroll = float_amount;
                  if (aggressive_scroll == 0 && float_amount > 0)
                    aggressive_scroll = 1;
@@ -16968,7 +16968,7 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
             scroll-*-aggressively.  */
          if (!scroll_conservatively && NUMBERP (aggressive))
            {
-             double float_amount = XFLOATINT (aggressive);
+             double float_amount = extract_float (aggressive);
 
              pt_offset = float_amount * WINDOW_BOX_TEXT_HEIGHT (w);
              if (pt_offset == 0 && float_amount > 0)
@@ -24557,7 +24557,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
       int base_unit = (width_p
                       ? FRAME_COLUMN_WIDTH (it->f)
                       : FRAME_LINE_HEIGHT (it->f));
-      return OK_PIXELS (XFLOATINT (prop) * base_unit);
+      return OK_PIXELS (extract_float (prop) * base_unit);
     }
 
   if (CONSP (prop))
@@ -24612,7 +24612,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
       if (NUMBERP (car))
        {
          double fact;
-         pixels = XFLOATINT (car);
+         pixels = extract_float (car);
          if (NILP (cdr))
            return OK_PIXELS (pixels);
          if (calc_pixel_width_or_height (&fact, it, cdr,
@@ -27225,7 +27225,7 @@ x_produce_glyphs (struct it *it)
          bool stretched_p
            = it->char_to_display == ' ' && !NILP (it->space_width);
          if (stretched_p)
-           it->pixel_width *= XFLOATINT (it->space_width);
+           it->pixel_width *= extract_float (it->space_width);
 
          /* If face has a box, add the box thickness to the character
             height.  If character has a box line to the left and/or
@@ -29703,7 +29703,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
          && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
          && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
        {
-         double r = XFLOATINT (lr);
+         double r = extract_float (lr);
          double dx = XINT (lx0) - x;
          double dy = XINT (ly0) - y;
          return (dx * dx + dy * dy <= r * r);



reply via email to

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