diff options
| author | Paul Eggert | 2017-03-02 13:48:47 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-03-02 13:50:03 -0800 |
| commit | 56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3 (patch) | |
| tree | 00d5a4ce84331590cbb4b11b532f054585922219 /src/editfns.c | |
| parent | dacafa8c30cdae92f934512664fd2d322d91432b (diff) | |
| download | emacs-56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3.tar.gz emacs-56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3.zip | |
Restore XFLOATINT but with restricted args
Turn instances of extract_float into XFLOAT_DATA when possible,
and to a resurrected XFLOATINT when the arg is a number.
The resurrected XFLOATINT is more like XFLOAT and XINT in
that is valid only if its arg is a number. This clarifies
the ways in which floats can be extracted at the C level.
* src/editfns.c (styled_format):
* src/floatfns.c (extract_float, Fexpt):
Use XFLOATINT rather than open-coding it.
* src/fns.c (internal_equal):
* src/image.c (imagemagick_load_image):
* src/xdisp.c (resize_mini_window):
Prefer XFLOAT_DATA to extract_float on values known to be floats.
* src/frame.c (x_set_screen_gamma):
* src/frame.h (NUMVAL):
* src/image.c (x_edge_detection, compute_image_size):
* src/lread.c (read_filtered_event):
* src/window.c (Fset_window_vscroll):
* src/xdisp.c (handle_single_display_spec, try_scrolling)
(redisplay_window, calc_pixel_width_or_height, x_produce_glyphs)
(on_hot_spot_p):
Prefer XFLOATINT to extract_float on values known to be numbers.
* src/lisp.h (XFLOATINT): Bring back this function, except
it now assumes its argument is a number.
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/editfns.c b/src/editfns.c index e3c8548b5a4..8f85f99b94c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4312,12 +4312,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4312 | char sprintf_buf[SPRINTF_BUFSIZE]; | 4312 | char sprintf_buf[SPRINTF_BUFSIZE]; |
| 4313 | ptrdiff_t sprintf_bytes; | 4313 | ptrdiff_t sprintf_bytes; |
| 4314 | if (conversion == 'e' || conversion == 'f' || conversion == 'g') | 4314 | if (conversion == 'e' || conversion == 'f' || conversion == 'g') |
| 4315 | { | 4315 | sprintf_bytes = sprintf (sprintf_buf, convspec, prec, |
| 4316 | double x = (INTEGERP (args[n]) | 4316 | XFLOATINT (args[n])); |
| 4317 | ? XINT (args[n]) | ||
| 4318 | : XFLOAT_DATA (args[n])); | ||
| 4319 | sprintf_bytes = sprintf (sprintf_buf, convspec, prec, x); | ||
| 4320 | } | ||
| 4321 | else if (conversion == 'c') | 4317 | else if (conversion == 'c') |
| 4322 | { | 4318 | { |
| 4323 | /* Don't use sprintf here, as it might mishandle prec. */ | 4319 | /* Don't use sprintf here, as it might mishandle prec. */ |