[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117579: Revert previous change.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r117579: Revert previous change. |
Date: |
Sat, 26 Jul 2014 13:17:33 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117579
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2014-07-26 06:17:25 -0700
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/alloc.c alloc.c-20091113204419-o5vbwnq5f7feedwu-252
src/data.c data.c-20091113204419-o5vbwnq5f7feedwu-251
src/dispnew.c dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
src/fileio.c fileio.c-20091113204419-o5vbwnq5f7feedwu-210
src/filelock.c filelock.c-20091113204419-o5vbwnq5f7feedwu-179
src/fns.c fns.c-20091113204419-o5vbwnq5f7feedwu-203
src/font.c font.c-20091113204419-o5vbwnq5f7feedwu-8540
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
src/lread.c lread.c-20091113204419-o5vbwnq5f7feedwu-266
src/minibuf.c minibuf.c-20091113204419-o5vbwnq5f7feedwu-242
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
src/process.c process.c-20091113204419-o5vbwnq5f7feedwu-462
src/region-cache.c
regioncache.c-20091113204419-o5vbwnq5f7feedwu-850
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-26 12:14:42 +0000
+++ b/src/ChangeLog 2014-07-26 13:17:25 +0000
@@ -1,3 +1,12 @@
+2014-07-26 Paul Eggert <address@hidden>
+
+ 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.
+
2014-07-26 Andreas Schwab <address@hidden>
* alloc.c (xnmalloc, xnrealloc, xpalloc, make_save_value)
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2014-07-26 11:58:24 +0000
+++ b/src/alloc.c 2014-07-26 13:17:25 +0000
@@ -806,8 +806,8 @@
void *
xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size)
{
- eassert (nitems >= 0 && item_size > 0);
- if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size)
+ eassert (0 <= nitems && 0 < item_size);
+ if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
memory_full (SIZE_MAX);
return xmalloc (nitems * item_size);
}
@@ -819,8 +819,8 @@
void *
xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size)
{
- eassert (nitems >= 0 && item_size > 0);
- if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size)
+ eassert (0 <= nitems && 0 < item_size);
+ if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
memory_full (SIZE_MAX);
return xrealloc (pa, nitems * item_size);
}
@@ -873,10 +873,10 @@
ptrdiff_t nitems_incr_max = n_max - n;
ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max));
- eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1);
+ eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max);
if (! pa)
*nitems = 0;
- if (incr > nitems_incr_max)
+ if (nitems_incr_max < incr)
memory_full (SIZE_MAX);
n += incr;
pa = xrealloc (pa, n * item_size);
@@ -1183,7 +1183,7 @@
}
ABLOCKS_BUSY (abase) = (struct ablocks *) aligned;
- eassert ((uintptr_t) abase % BLOCK_ALIGN == 0);
+ eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN);
eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */
eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase);
eassert (ABLOCKS_BASE (abase) == base);
@@ -1205,7 +1205,7 @@
MALLOC_PROBE (nbytes);
- eassert ((uintptr_t) val % BLOCK_ALIGN == 0);
+ eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
return val;
}
@@ -5706,7 +5706,7 @@
double tot = total_bytes_of_live_objects ();
tot *= XFLOAT_DATA (Vgc_cons_percentage);
- if (tot > 0)
+ if (0 < tot)
{
if (tot < TYPE_MAXIMUM (EMACS_INT))
gc_relative_threshold = tot;
=== modified file 'src/data.c'
--- a/src/data.c 2014-07-26 11:58:24 +0000
+++ b/src/data.c 2014-07-26 13:17:25 +0000
@@ -2460,13 +2460,13 @@
uintmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
- valid = XINT (c) >= 0;
+ valid = 0 <= XINT (c);
val = XINT (c);
}
else if (FLOATP (c))
{
double d = XFLOAT_DATA (c);
- if (d >= 0
+ if (0 <= d
&& d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1))
{
val = d;
=== modified file 'src/dispnew.c'
--- a/src/dispnew.c 2014-07-26 11:58:24 +0000
+++ b/src/dispnew.c 2014-07-26 13:17:25 +0000
@@ -5829,7 +5829,7 @@
else if (FLOATP (timeout))
{
double seconds = XFLOAT_DATA (timeout);
- if (! (seconds > 0))
+ if (! (0 < seconds))
return Qt;
else
{
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2014-07-26 11:58:24 +0000
+++ b/src/fileio.c 2014-07-26 13:17:25 +0000
@@ -3367,8 +3367,8 @@
if (FLOATP (val))
{
double v = XFLOAT_DATA (val);
- if (v >= 0
- && (sizeof v > sizeof (off_t)
+ if (0 <= v
+ && (sizeof (off_t) < sizeof v
? v <= TYPE_MAXIMUM (off_t)
: v < TYPE_MAXIMUM (off_t)))
return v;
=== modified file 'src/filelock.c'
--- a/src/filelock.c 2014-07-26 11:58:24 +0000
+++ b/src/filelock.c 2014-07-26 13:17:25 +0000
@@ -504,7 +504,7 @@
&& errno == EINVAL)
{
int fd = emacs_open (lfname, O_RDONLY | O_BINARY | O_NOFOLLOW, 0);
- if (fd >= 0)
+ if (0 <= fd)
{
/* Use read, not emacs_read, since FD isn't unwind-protected. */
ptrdiff_t read_bytes = read (fd, lfinfo, MAX_LFINFO + 1);
@@ -713,7 +713,7 @@
}
/* Try to lock the lock. */
- if (lock_if_free (&lock_info, lfname) > 0)
+ if (0 < lock_if_free (&lock_info, lfname))
{
/* Someone else has the lock. Consider breaking it. */
Lisp_Object attack;
=== modified file 'src/fns.c'
--- a/src/fns.c 2014-07-26 11:58:24 +0000
+++ b/src/fns.c 2014-07-26 13:17:25 +0000
@@ -3496,7 +3496,7 @@
ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
? nitems_max : C_language_max);
eassert (VECTORP (vec));
- eassert (incr_min > 0 && nitems_max >= -1);
+ eassert (0 < incr_min && -1 <= nitems_max);
old_size = ASIZE (vec);
incr_max = n_max - old_size;
incr = max (incr_min, min (old_size >> 1, incr_max));
@@ -3659,9 +3659,9 @@
eassert (SYMBOLP (test.name));
eassert (INTEGERP (size) && XINT (size) >= 0);
eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
- || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1));
+ || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)));
eassert (FLOATP (rehash_threshold)
- && XFLOAT_DATA (rehash_threshold) > 0
+ && 0 < XFLOAT_DATA (rehash_threshold)
&& XFLOAT_DATA (rehash_threshold) <= 1.0);
if (XFASTINT (size) == 0)
@@ -4399,15 +4399,15 @@
/* Look for `:rehash-size SIZE'. */
i = get_key_arg (QCrehash_size, nargs, args, used);
rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE);
- if (! ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
- || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1)))
+ if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size))
+ || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))))
signal_error ("Invalid hash table rehash size", rehash_size);
/* Look for `:rehash-threshold THRESHOLD'. */
i = get_key_arg (QCrehash_threshold, nargs, args, used);
rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD);
if (! (FLOATP (rehash_threshold)
- && XFLOAT_DATA (rehash_threshold) > 0
+ && 0 < XFLOAT_DATA (rehash_threshold)
&& XFLOAT_DATA (rehash_threshold) <= 1))
signal_error ("Invalid hash table rehash threshold", rehash_threshold);
=== modified file 'src/font.c'
--- a/src/font.c 2014-07-26 11:58:24 +0000
+++ b/src/font.c 2014-07-26 13:17:25 +0000
@@ -280,7 +280,7 @@
if (len == 1 && *str == '*')
return Qnil;
- if (!force_symbol && len > 0 && '0' <= *str && *str <= '9')
+ if (!force_symbol && 0 < len && '0' <= *str && *str <= '9')
{
for (i = 1; i < len; i++)
if (! ('0' <= str[i] && str[i] <= '9'))
@@ -445,10 +445,10 @@
table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
CHECK_VECTOR (table);
i = XINT (val) & 0xFF;
- eassert (ASIZE (table) > ((i >> 4) & 0xF));
+ eassert (((i >> 4) & 0xF) < ASIZE (table));
elt = AREF (table, ((i >> 4) & 0xF));
CHECK_VECTOR (elt);
- eassert (ASIZE (elt) > (i & 0xF) + 1);
+ eassert ((i & 0xF) + 1 < ASIZE (elt));
elt = (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1));
CHECK_SYMBOL (elt);
return elt;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2014-07-26 11:58:24 +0000
+++ b/src/lisp.h 2014-07-26 13:17:25 +0000
@@ -782,7 +782,7 @@
type or if I is a NaN. */
#define FIXNUM_OVERFLOW_P(i) \
- (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <=
MOST_POSITIVE_FIXNUM))
+ (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <=
MOST_POSITIVE_FIXNUM))
INLINE ptrdiff_t
clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
=== modified file 'src/lread.c'
--- a/src/lread.c 2014-07-26 11:58:24 +0000
+++ b/src/lread.c 2014-07-26 13:17:25 +0000
@@ -2747,7 +2747,7 @@
while ((c = READCHAR) >= 0
&& c >= '0' && c <= '9')
{
- if (nskip >= (STRING_BYTES_BOUND - extra) / 10)
+ if ((STRING_BYTES_BOUND - extra) / 10 <= nskip)
string_overflow ();
digits++;
nskip *= 10;
@@ -2861,8 +2861,8 @@
/* Read a non-negative integer. */
while (c >= '0' && c <= '9')
{
- if (n > MOST_POSITIVE_FIXNUM / 10
- || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM)
+ if (MOST_POSITIVE_FIXNUM / 10 < n
+ || MOST_POSITIVE_FIXNUM < n * 10 + c - '0')
n = MOST_POSITIVE_FIXNUM + 1;
else
n = n * 10 + c - '0';
@@ -3058,7 +3058,7 @@
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
- if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
@@ -3192,7 +3192,7 @@
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
- if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
@@ -3222,7 +3222,7 @@
if (p == end)
{
ptrdiff_t offset = p - read_buffer;
- if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
=== modified file 'src/minibuf.c'
--- a/src/minibuf.c 2014-07-26 11:58:24 +0000
+++ b/src/minibuf.c 2014-07-26 13:17:25 +0000
@@ -265,7 +265,7 @@
fprintf (stdout, "%c", hide_char);
if (len == size)
{
- if (size > STRING_BYTES_BOUND / 2)
+ if (STRING_BYTES_BOUND / 2 < size)
memory_full (SIZE_MAX);
size *= 2;
line = xrealloc (line, size);
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2014-07-26 11:58:24 +0000
+++ b/src/nsterm.m 2014-07-26 13:17:25 +0000
@@ -1795,9 +1795,9 @@
if (alpha < 0.0)
return;
- else if (alpha > 1.0)
+ else if (1.0 < alpha)
alpha = 1.0;
- else if (alpha >= 0.0 && alpha < alpha_min && alpha_min <= 1.0)
+ else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
#ifdef NS_IMPL_COCOA
=== modified file 'src/process.c'
--- a/src/process.c 2014-07-26 11:58:24 +0000
+++ b/src/process.c 2014-07-26 13:17:25 +0000
@@ -4303,7 +4303,7 @@
time_limit = 0;
nsecs = -1;
}
- else if (time_limit > TYPE_MAXIMUM (time_t))
+ else if (TYPE_MAXIMUM (time_t) < time_limit)
time_limit = TYPE_MAXIMUM (time_t);
/* Since we may need to wait several times,
@@ -4580,7 +4580,7 @@
continue;
FD_CLR (channel, &Available);
XPROCESS (proc)->read_output_skip = 0;
- if (nsecs > XPROCESS (proc)->read_output_delay)
+ if (XPROCESS (proc)->read_output_delay < nsecs)
nsecs = XPROCESS (proc)->read_output_delay;
}
}
@@ -4696,7 +4696,7 @@
if (timers_run != old_timers_run
&& waiting_for_user_input_p == -1
&& (old_buffer != current_buffer
- || !EQ (old_window, selected_window)))
+ || !EQ (old_window, selected_window)))
record_asynch_buffer_change ();
if (leave)
=== modified file 'src/region-cache.c'
--- a/src/region-cache.c 2014-07-26 11:58:24 +0000
+++ b/src/region-cache.c 2014-07-26 13:17:25 +0000
@@ -315,7 +315,7 @@
ptrdiff_t len = end - start;
/* Gotta be in range. */
- eassert (start >= 0 && end <= c->cache_len);
+ eassert (0 <= start && end <= c->cache_len);
/* Gotta be in order. */
eassert (start <= end);
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-07-26 11:58:24 +0000
+++ b/src/xterm.c 2014-07-26 13:17:25 +0000
@@ -394,7 +394,7 @@
return;
else if (alpha > 1.0)
alpha = 1.0;
- else if (alpha >= 0.0 && alpha < alpha_min && alpha_min <= 1.0)
+ else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
opac = alpha * OPAQUE;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117579: Revert previous change.,
Paul Eggert <=