diff options
| author | Paul Eggert | 2018-09-04 19:14:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-09-04 19:15:57 -0700 |
| commit | ecb985c10d5241a65ab9552ebfcecaa150b35427 (patch) | |
| tree | c4f12a76561d84518c597cb8e25cfd3813023456 /src/fileio.c | |
| parent | e3661f8c35b3057c58e8c0b474f597697ce413ba (diff) | |
| download | emacs-ecb985c10d5241a65ab9552ebfcecaa150b35427.tar.gz 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/fileio.c')
| -rw-r--r-- | src/fileio.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/fileio.c b/src/fileio.c index a91bdaa53d1..66b23333172 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3424,17 +3424,13 @@ read_non_regular_quit (Lisp_Object ignore) | |||
| 3424 | static off_t | 3424 | static off_t |
| 3425 | file_offset (Lisp_Object val) | 3425 | file_offset (Lisp_Object val) |
| 3426 | { | 3426 | { |
| 3427 | if (RANGED_FIXNUMP (0, val, TYPE_MAXIMUM (off_t))) | 3427 | if (INTEGERP (val)) |
| 3428 | return XFIXNUM (val); | ||
| 3429 | |||
| 3430 | if (BIGNUMP (val)) | ||
| 3431 | { | 3428 | { |
| 3432 | intmax_t v = bignum_to_intmax (val); | 3429 | intmax_t v; |
| 3433 | if (0 < v && v <= TYPE_MAXIMUM (off_t)) | 3430 | if (integer_to_intmax (val, &v) && 0 <= v && v <= TYPE_MAXIMUM (off_t)) |
| 3434 | return v; | 3431 | return v; |
| 3435 | } | 3432 | } |
| 3436 | 3433 | else if (FLOATP (val)) | |
| 3437 | if (FLOATP (val)) | ||
| 3438 | { | 3434 | { |
| 3439 | double v = XFLOAT_DATA (val); | 3435 | double v = XFLOAT_DATA (val); |
| 3440 | if (0 <= v && v < 1.0 + TYPE_MAXIMUM (off_t)) | 3436 | if (0 <= v && v < 1.0 + TYPE_MAXIMUM (off_t)) |