diff options
| author | Paul Eggert | 2014-07-26 06:17:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-07-26 06:17:25 -0700 |
| commit | 9e9f8582a893f1e97b1f8955f69b96f969ee1f85 (patch) | |
| tree | ef8b4c36f8b88d1273572b8140a8651854b65e6b /src/alloc.c | |
| parent | 54e3f15626296c1ece932852df2b3d4938b0b44a (diff) | |
| download | emacs-9e9f8582a893f1e97b1f8955f69b96f969ee1f85.tar.gz emacs-9e9f8582a893f1e97b1f8955f69b96f969ee1f85.zip | |
Revert previous change.
There is certainly nothing wrong with writing code like 'lo <= i
&& i <= hi', even if LO happens to a constant. There isn't even
anything wrong in general with writing 'a <= b' if A happens to
be a constant. At any rate stylistic changes shouldn't
be done like this without discussion.
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 f5f25d53435..a8ad44491fa 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 (nitems >= 0 && item_size > 0); | 809 | eassert (0 <= nitems && 0 < item_size); |
| 810 | if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size) | 810 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) |
| 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 (nitems >= 0 && item_size > 0); | 822 | eassert (0 <= nitems && 0 < item_size); |
| 823 | if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size) | 823 | if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems) |
| 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 (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1); | 876 | eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); |
| 877 | if (! pa) | 877 | if (! pa) |
| 878 | *nitems = 0; | 878 | *nitems = 0; |
| 879 | if (incr > nitems_incr_max) | 879 | if (nitems_incr_max < incr) |
| 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 ((uintptr_t) abase % BLOCK_ALIGN == 0); | 1186 | eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN); |
| 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 ((uintptr_t) val % BLOCK_ALIGN == 0); | 1208 | eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN); |
| 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 (tot > 0) | 5709 | if (0 < tot) |
| 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; |