diff options
| author | Paul Eggert | 2019-08-11 16:42:38 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-08-11 17:10:48 -0700 |
| commit | 57fc1a5f7c49fbe7288de6ad567c934db2ceaf96 (patch) | |
| tree | 3bcf2eac0a4d966dbad0729caf57c22da7fa30c0 /src/alloc.c | |
| parent | f01365f62c921407acead13bb350816a313a8c42 (diff) | |
| download | emacs-57fc1a5f7c49fbe7288de6ad567c934db2ceaf96.tar.gz emacs-57fc1a5f7c49fbe7288de6ad567c934db2ceaf96.zip | |
Prefer signed when testing for signed overflow
* src/alloc.c (free_cons):
* src/casefiddle.c (do_casify_multibyte_string):
* src/editfns.c (styled_format):
* src/image.c (png_load_body):
Use signed arguments to INT_MULTIPLY_WRAPV etc. This doesn’t fix
any bugs, but GCC emits better code when all args are signed.
Also, this removes the need for an if in free_cons (Bug#37006).
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c index d9022ac46c3..8227feadae5 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2542,9 +2542,8 @@ free_cons (struct Lisp_Cons *ptr) | |||
| 2542 | ptr->u.s.u.chain = cons_free_list; | 2542 | ptr->u.s.u.chain = cons_free_list; |
| 2543 | ptr->u.s.car = dead_object (); | 2543 | ptr->u.s.car = dead_object (); |
| 2544 | cons_free_list = ptr; | 2544 | cons_free_list = ptr; |
| 2545 | if (consing_until_gc <= 0) | 2545 | int incr = sizeof *ptr; |
| 2546 | consing_until_gc += sizeof *ptr; | 2546 | if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc)) |
| 2547 | else if (INT_ADD_WRAPV (consing_until_gc, sizeof *ptr, &consing_until_gc)) | ||
| 2548 | consing_until_gc = OBJECT_CT_MAX; | 2547 | consing_until_gc = OBJECT_CT_MAX; |
| 2549 | gcstat.total_free_conses++; | 2548 | gcstat.total_free_conses++; |
| 2550 | } | 2549 | } |