diff options
| author | Andreas Schwab | 2014-07-26 13:58:24 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2014-07-26 13:58:24 +0200 |
| commit | 3acf58eec890249179b6f992c59f9adcf05b8ca8 (patch) | |
| tree | 330419ff2ccea3f5aea9d49bd0e5aba8b1d386b2 /src/alloc.c | |
| parent | a072c708aaa91e61fa148b1a69884a40a5d8f9fb (diff) | |
| download | emacs-3acf58eec890249179b6f992c59f9adcf05b8ca8.tar.gz emacs-3acf58eec890249179b6f992c59f9adcf05b8ca8.zip | |
Reorder conditions that are written backwards
* alloc.c (xnmalloc, xnrealloc, xpalloc, make_save_value)
(Fgarbage_collect): Reorder conditions that are written backwards.
* data.c (cons_to_unsigned): Likewise.
* dispnew.c (update_frame_1, sit_for): Likewise.
* fileio.c (file_offset): Likewise.
* filelock.c (read_lock_data, lock_file): Likewise.
* fns.c (larger_vector, make_hash_table, Fmake_hash_table):
Likewise.
* font.c (font_intern_prop, font_style_symbolic): Likewise.
* lisp.h (FIXNUM_OVERFLOW_P): Likewise.
* lread.c (read1): Likewise.
* minibuf.c (read_minibuf_noninteractive): Likewise.
* nsterm.m (x_set_frame_alpha): Likewise.
* process.c (wait_reading_process_output): Likewise.
* region-cache.c (delete_cache_boundaries): Likewise.
* xterm.c (x_set_frame_alpha): Likewise.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/alloc.c b/src/alloc.c index a8ad44491fa..f5f25d53435 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -806,8 +806,8 @@ verify (INT_MAX <= PTRDIFF_MAX); | |||
| 806 | void * | 806 | void * |
| 807 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) | 807 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) |
| 808 | { | 808 | { |
| 809 | eassert (0 <= nitems && 0 < item_size); | 809 | eassert (nitems >= 0 && item_size > 0); |
| 810 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) | 810 | if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size) |
| 811 | memory_full (SIZE_MAX); | 811 | memory_full (SIZE_MAX); |
| 812 | return xmalloc (nitems * item_size); | 812 | return xmalloc (nitems * item_size); |
| 813 | } | 813 | } |
| @@ -819,8 +819,8 @@ xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) | |||
| 819 | void * | 819 | void * |
| 820 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) | 820 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) |
| 821 | { | 821 | { |
| 822 | eassert (0 <= nitems && 0 < item_size); | 822 | eassert (nitems >= 0 && item_size > 0); |
| 823 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) | 823 | if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size) |
| 824 | memory_full (SIZE_MAX); | 824 | memory_full (SIZE_MAX); |
| 825 | return xrealloc (pa, nitems * item_size); | 825 | return xrealloc (pa, nitems * item_size); |
| 826 | } | 826 | } |
| @@ -873,10 +873,10 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 873 | ptrdiff_t nitems_incr_max = n_max - n; | 873 | ptrdiff_t nitems_incr_max = n_max - n; |
| 874 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); | 874 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); |
| 875 | 875 | ||
| 876 | eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); | 876 | eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1); |
| 877 | if (! pa) | 877 | if (! pa) |
| 878 | *nitems = 0; | 878 | *nitems = 0; |
| 879 | if (nitems_incr_max < incr) | 879 | if (incr > nitems_incr_max) |
| 880 | memory_full (SIZE_MAX); | 880 | memory_full (SIZE_MAX); |
| 881 | n += incr; | 881 | n += incr; |
| 882 | pa = xrealloc (pa, n * item_size); | 882 | pa = xrealloc (pa, n * item_size); |
| @@ -1183,7 +1183,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type) | |||
| 1183 | } | 1183 | } |
| 1184 | ABLOCKS_BUSY (abase) = (struct ablocks *) aligned; | 1184 | ABLOCKS_BUSY (abase) = (struct ablocks *) aligned; |
| 1185 | 1185 | ||
| 1186 | eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN); | 1186 | eassert ((uintptr_t) abase % BLOCK_ALIGN == 0); |
| 1187 | eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ | 1187 | eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ |
| 1188 | eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); | 1188 | eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); |
| 1189 | eassert (ABLOCKS_BASE (abase) == base); | 1189 | eassert (ABLOCKS_BASE (abase) == base); |
| @@ -1205,7 +1205,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type) | |||
| 1205 | 1205 | ||
| 1206 | MALLOC_PROBE (nbytes); | 1206 | MALLOC_PROBE (nbytes); |
| 1207 | 1207 | ||
| 1208 | eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN); | 1208 | eassert ((uintptr_t) val % BLOCK_ALIGN == 0); |
| 1209 | return val; | 1209 | return val; |
| 1210 | } | 1210 | } |
| 1211 | 1211 | ||
| @@ -5706,7 +5706,7 @@ garbage_collect_1 (void *end) | |||
| 5706 | double tot = total_bytes_of_live_objects (); | 5706 | double tot = total_bytes_of_live_objects (); |
| 5707 | 5707 | ||
| 5708 | tot *= XFLOAT_DATA (Vgc_cons_percentage); | 5708 | tot *= XFLOAT_DATA (Vgc_cons_percentage); |
| 5709 | if (0 < tot) | 5709 | if (tot > 0) |
| 5710 | { | 5710 | { |
| 5711 | if (tot < TYPE_MAXIMUM (EMACS_INT)) | 5711 | if (tot < TYPE_MAXIMUM (EMACS_INT)) |
| 5712 | gc_relative_threshold = tot; | 5712 | gc_relative_threshold = tot; |