summaryrefslogtreecommitdiff
path: root/src/font.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-09-04 19:14:01 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-09-04 19:15:57 -0700
commitecb985c10d5241a65ab9552ebfcecaa150b35427 (patch)
treec4f12a76561d84518c597cb8e25cfd3813023456 /src/font.c
parente3661f8c35b3057c58e8c0b474f597697ce413ba (diff)
downloademacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.tar.gz
emacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.tar.bz2
emacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.zip
Simplify bignum->intmax conversion
* src/lisp.h (integer_to_intmax, integer_to_uintmax): New functions. * src/data.c (cons_to_unsigned, cons_to_signed) (arith_driver): * src/dbusbind.c (xd_extract_signed, xd_extract_unsigned): * src/dispnew.c (sit_for): * src/editfns.c (styled_format): * src/emacs-module.c (module_extract_integer): * src/fileio.c (file_offset): * src/font.c (font_unparse_xlfd, Fopen_font): * src/xdisp.c (calc_line_height_property): * src/process.c (handle_child_signal):
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/font.c b/src/font.c
index e2414582f67..50ec39a9a49 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1289,8 +1289,9 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1 + DBL_MAX_10_EXP + 1)];
if (INTEGERP (val))
{
- intmax_t v = FIXNUMP (val) ? XFIXNUM (val) : bignum_to_intmax (val);
- if (! (0 < v && v <= TYPE_MAXIMUM (uprintmax_t)))
+ intmax_t v;
+ if (! (integer_to_intmax (val, &v)
+ && 0 < v && v <= TYPE_MAXIMUM (uprintmax_t)))
v = pixel_size;
if (v > 0)
{
@@ -4747,16 +4748,10 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
else
{
CHECK_NUMBER (size);
- if (BIGNUMP (size))
- {
- isize = bignum_to_intmax (size);
- if (isize == 0)
- args_out_of_range (font_entity, size);
- }
- else
- isize = (FLOATP (size)
- ? POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f))
- : XFIXNUM (size));
+ if (FLOATP (size))
+ isize = POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f));
+ else if (! integer_to_intmax (size, &isize))
+ args_out_of_range (font_entity, size);
if (! (INT_MIN <= isize && isize <= INT_MAX))
args_out_of_range (font_entity, size);
if (isize == 0)