diff options
| author | Paul Eggert | 2023-05-17 15:36:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2023-05-17 15:41:00 -0700 |
| commit | 5ef169ed701fa4f850fdca5563cdd468207d5d4f (patch) | |
| tree | 949560affb29a8d9b114bac310a317a8209542ab /src/image.c | |
| parent | afbdae00ab59bbda971780fa04dd75dc7d1e7df7 (diff) | |
| download | emacs-5ef169ed701fa4f850fdca5563cdd468207d5d4f.tar.gz emacs-5ef169ed701fa4f850fdca5563cdd468207d5d4f.zip | |
Prefer C23 ckd_* to Gnulib *_WRAPV macros
C23 has added ckd_add etc. macros with functionality equivalent to
the older Gnulib INT_ADD_WRAPV macros, so switch to the
more-standard names.
* admin/merge-gnulib (GNULIB_MODULES): Add stdckdint.
This merely makes the dependency explicit, as we were already
using this Gnulib module indirectly.
* lib-src/etags.c, src/lisp.h: Include stdckdint.h.
* lib-src/etags.c (xnmalloc, xnrealloc):
* src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string)
(mark_memory):
* src/bignum.c (emacs_mpz_pow_ui):
* src/buffer.c (record_overlay_string, overlay_strings):
* src/bytecode.c (exec_byte_code):
* src/casefiddle.c (do_casify_multibyte_string):
* src/ccl.c (ccl_driver, Fccl_execute_on_string):
* src/character.c (char_width, c_string_width)
(lisp_string_width, count_size_as_multibyte)
(string_escape_byte8):
* src/cmds.c (internal_self_insert):
* src/coding.c (coding_alloc_by_realloc, produce_chars):
* src/data.c (arith_driver):
* src/dispnew.c (realloc_glyph_pool, init_display_interactive):
* src/doprnt.c (parse_format_integer):
* src/editfns.c (Freplace_buffer_contents, str2num)
(styled_format):
* src/emacs-module.c (module_global_reference_p)
(module_make_global_ref, module_funcall):
* src/eval.c (max_ensure_room):
* src/fileio.c (blocks_to_bytes):
* src/fns.c (Ffillarray):
* src/font.c (font_intern_prop):
* src/frame.c (check_frame_pixels):
* src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead):
* src/gtkutil.c (get_utf8_string):
* src/haikuterm.c (haiku_term_init):
* src/image.c (xbm_scan, image_to_emacs_colors)
(image_detect_edges, png_load_body):
* src/keyboard.c (Frecursion_depth):
* src/keymap.c (Flookup_key, Fkey_description):
* src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA):
* src/lread.c (read_bool_vector):
* src/pgtkterm.c (pgtk_term_init):
* src/regex-emacs.c (regex_compile):
* src/term.c (encode_terminal_code):
* src/termcap.c (tputs):
* src/textconv.c (textconv_query):
* src/timefns.c (timespec_ticks, lisp_time_hz_ticks)
(Fdecode_time, check_tm_member):
* src/tparam.c (tparam1):
* src/w32term.c (w32_initialize_display_info):
* src/xdisp.c (fill_column_indicator_column, decode_mode_spec):
* src/xselect.c (selection_data_size, x_property_data_to_lisp):
* src/xsmfns.c (smc_save_yourself_CB):
* src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time)
(x_sync_current_monotonic_time, x_sync_note_frame_times)
(x_display_set_last_user_time, x_term_init):
Prefer the C23 stdckdint macros to their
Gnulib intprops.h counterparts, since C23 is standard.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/image.c b/src/image.c index 8ee802a9d62..87a0c1ca497 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4003,7 +4003,7 @@ xbm_scan (char **s, char *end, char *sval, int *ival) | |||
| 4003 | digit = char_hexdigit (c); | 4003 | digit = char_hexdigit (c); |
| 4004 | if (digit < 0) | 4004 | if (digit < 0) |
| 4005 | break; | 4005 | break; |
| 4006 | overflow |= INT_MULTIPLY_WRAPV (value, 16, &value); | 4006 | overflow |= ckd_mul (&value, value, 16); |
| 4007 | value += digit; | 4007 | value += digit; |
| 4008 | } | 4008 | } |
| 4009 | } | 4009 | } |
| @@ -4013,7 +4013,7 @@ xbm_scan (char **s, char *end, char *sval, int *ival) | |||
| 4013 | while (*s < end | 4013 | while (*s < end |
| 4014 | && (c = *(*s)++, '0' <= c && c <= '7')) | 4014 | && (c = *(*s)++, '0' <= c && c <= '7')) |
| 4015 | { | 4015 | { |
| 4016 | overflow |= INT_MULTIPLY_WRAPV (value, 8, &value); | 4016 | overflow |= ckd_mul (&value, value, 8); |
| 4017 | value += c - '0'; | 4017 | value += c - '0'; |
| 4018 | } | 4018 | } |
| 4019 | } | 4019 | } |
| @@ -4024,8 +4024,8 @@ xbm_scan (char **s, char *end, char *sval, int *ival) | |||
| 4024 | while (*s < end | 4024 | while (*s < end |
| 4025 | && (c = *(*s)++, c_isdigit (c))) | 4025 | && (c = *(*s)++, c_isdigit (c))) |
| 4026 | { | 4026 | { |
| 4027 | overflow |= INT_MULTIPLY_WRAPV (value, 10, &value); | 4027 | overflow |= ckd_mul (&value, value, 10); |
| 4028 | overflow |= INT_ADD_WRAPV (value, c - '0', &value); | 4028 | overflow |= ckd_add (&value, value, c - '0'); |
| 4029 | } | 4029 | } |
| 4030 | } | 4030 | } |
| 4031 | 4031 | ||
| @@ -4069,7 +4069,7 @@ xbm_scan (char **s, char *end, char *sval, int *ival) | |||
| 4069 | if (digit < 0) | 4069 | if (digit < 0) |
| 4070 | return 0; | 4070 | return 0; |
| 4071 | 4071 | ||
| 4072 | overflow |= INT_MULTIPLY_WRAPV (value, 16, &value); | 4072 | overflow |= ckd_mul (&value, value, 16); |
| 4073 | value += digit; | 4073 | value += digit; |
| 4074 | } | 4074 | } |
| 4075 | } | 4075 | } |
| @@ -6136,8 +6136,8 @@ image_to_emacs_colors (struct frame *f, struct image *img, bool rgb_p) | |||
| 6136 | HGDIOBJ prev; | 6136 | HGDIOBJ prev; |
| 6137 | #endif /* HAVE_NTGUI */ | 6137 | #endif /* HAVE_NTGUI */ |
| 6138 | 6138 | ||
| 6139 | if (INT_MULTIPLY_WRAPV (sizeof *colors, img->width, &nbytes) | 6139 | if (ckd_mul (&nbytes, sizeof *colors, img->width) |
| 6140 | || INT_MULTIPLY_WRAPV (img->height, nbytes, &nbytes) | 6140 | || ckd_mul (&nbytes, nbytes, img->height) |
| 6141 | || SIZE_MAX < nbytes) | 6141 | || SIZE_MAX < nbytes) |
| 6142 | memory_full (SIZE_MAX); | 6142 | memory_full (SIZE_MAX); |
| 6143 | colors = xmalloc (nbytes); | 6143 | colors = xmalloc (nbytes); |
| @@ -6282,8 +6282,8 @@ image_detect_edges (struct frame *f, struct image *img, | |||
| 6282 | 6282 | ||
| 6283 | #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) | 6283 | #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) |
| 6284 | 6284 | ||
| 6285 | if (INT_MULTIPLY_WRAPV (sizeof *new, img->width, &nbytes) | 6285 | if (ckd_mul (&nbytes, sizeof *new, img->width) |
| 6286 | || INT_MULTIPLY_WRAPV (img->height, nbytes, &nbytes)) | 6286 | || ckd_mul (&nbytes, nbytes, img->height)) |
| 6287 | memory_full (SIZE_MAX); | 6287 | memory_full (SIZE_MAX); |
| 6288 | new = xmalloc (nbytes); | 6288 | new = xmalloc (nbytes); |
| 6289 | 6289 | ||
| @@ -7655,8 +7655,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) | |||
| 7655 | row_bytes = png_get_rowbytes (png_ptr, info_ptr); | 7655 | row_bytes = png_get_rowbytes (png_ptr, info_ptr); |
| 7656 | 7656 | ||
| 7657 | /* Allocate memory for the image. */ | 7657 | /* Allocate memory for the image. */ |
| 7658 | if (INT_MULTIPLY_WRAPV (row_bytes, sizeof *pixels, &nbytes) | 7658 | if (ckd_mul (&nbytes, row_bytes, sizeof *pixels) |
| 7659 | || INT_MULTIPLY_WRAPV (nbytes, height, &nbytes)) | 7659 | || ckd_mul (&nbytes, nbytes, height)) |
| 7660 | memory_full (SIZE_MAX); | 7660 | memory_full (SIZE_MAX); |
| 7661 | c->pixels = pixels = xmalloc (nbytes); | 7661 | c->pixels = pixels = xmalloc (nbytes); |
| 7662 | c->rows = rows = xmalloc (height * sizeof *rows); | 7662 | c->rows = rows = xmalloc (height * sizeof *rows); |