void *
xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size)
{
- eassert (0 <= nitems && 0 < item_size);
- if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
+ eassert (nitems >= 0 && item_size > 0);
+ if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size)
memory_full (SIZE_MAX);
return xmalloc (nitems * item_size);
}
void *
xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size)
{
- eassert (0 <= nitems && 0 < item_size);
- if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
+ eassert (nitems >= 0 && item_size > 0);
+ if (nitems > min (PTRDIFF_MAX, SIZE_MAX) / item_size)
memory_full (SIZE_MAX);
return xrealloc (pa, nitems * item_size);
}
ptrdiff_t nitems_incr_max = n_max - n;
ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max));
- eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max);
+ eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1);
if (! pa)
*nitems = 0;
- if (nitems_incr_max < incr)
+ if (incr > nitems_incr_max)
memory_full (SIZE_MAX);
n += incr;
pa = xrealloc (pa, n * item_size);
}
ABLOCKS_BUSY (abase) = (struct ablocks *) aligned;
- eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN);
+ eassert ((uintptr_t) abase % BLOCK_ALIGN == 0);
eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */
eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase);
eassert (ABLOCKS_BASE (abase) == base);
MALLOC_PROBE (nbytes);
- eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
+ eassert ((uintptr_t) val % BLOCK_ALIGN == 0);
return val;
}
double tot = total_bytes_of_live_objects ();
tot *= XFLOAT_DATA (Vgc_cons_percentage);
- if (0 < tot)
+ if (tot > 0)
{
if (tot < TYPE_MAXIMUM (EMACS_INT))
gc_relative_threshold = tot;
uintmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
- valid = 0 <= XINT (c);
+ valid = XINT (c) >= 0;
val = XINT (c);
}
else if (FLOATP (c))
{
double d = XFLOAT_DATA (c);
- if (0 <= d
+ if (d >= 0
&& d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1))
{
val = d;
else if (FLOATP (timeout))
{
double seconds = XFLOAT_DATA (timeout);
- if (! (0 < seconds))
+ if (! (seconds > 0))
return Qt;
else
{
if (FLOATP (val))
{
double v = XFLOAT_DATA (val);
- if (0 <= v
- && (sizeof (off_t) < sizeof v
+ if (v >= 0
+ && (sizeof v > sizeof (off_t)
? v <= TYPE_MAXIMUM (off_t)
: v < TYPE_MAXIMUM (off_t)))
return v;
&& errno == EINVAL)
{
int fd = emacs_open (lfname, O_RDONLY | O_BINARY | O_NOFOLLOW, 0);
- if (0 <= fd)
+ if (fd >= 0)
{
/* Use read, not emacs_read, since FD isn't unwind-protected. */
ptrdiff_t read_bytes = read (fd, lfinfo, MAX_LFINFO + 1);
}
/* Try to lock the lock. */
- if (0 < lock_if_free (&lock_info, lfname))
+ if (lock_if_free (&lock_info, lfname) > 0)
{
/* Someone else has the lock. Consider breaking it. */
Lisp_Object attack;
ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
? nitems_max : C_language_max);
eassert (VECTORP (vec));
- eassert (0 < incr_min && -1 <= nitems_max);
+ eassert (incr_min > 0 && nitems_max >= -1);
old_size = ASIZE (vec);
incr_max = n_max - old_size;
incr = max (incr_min, min (old_size >> 1, incr_max));
eassert (SYMBOLP (test.name));
eassert (INTEGERP (size) && XINT (size) >= 0);
eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
- || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)));
+ || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1));
eassert (FLOATP (rehash_threshold)
- && 0 < XFLOAT_DATA (rehash_threshold)
+ && XFLOAT_DATA (rehash_threshold) > 0
&& XFLOAT_DATA (rehash_threshold) <= 1.0);
if (XFASTINT (size) == 0)
/* 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) && 0 < XINT (rehash_size))
- || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))))
+ if (! ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
+ || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1)))
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)
- && 0 < XFLOAT_DATA (rehash_threshold)
+ && XFLOAT_DATA (rehash_threshold) > 0
&& XFLOAT_DATA (rehash_threshold) <= 1))
signal_error ("Invalid hash table rehash threshold", rehash_threshold);
if (len == 1 && *str == '*')
return Qnil;
- if (!force_symbol && 0 < len && '0' <= *str && *str <= '9')
+ if (!force_symbol && len > 0 && '0' <= *str && *str <= '9')
{
for (i = 1; i < len; i++)
if (! ('0' <= str[i] && str[i] <= '9'))
table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
CHECK_VECTOR (table);
i = XINT (val) & 0xFF;
- eassert (((i >> 4) & 0xF) < ASIZE (table));
+ eassert (ASIZE (table) > ((i >> 4) & 0xF));
elt = AREF (table, ((i >> 4) & 0xF));
CHECK_VECTOR (elt);
- eassert ((i & 0xF) + 1 < ASIZE (elt));
+ eassert (ASIZE (elt) > (i & 0xF) + 1);
elt = (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1));
CHECK_SYMBOL (elt);
return elt;
type or if I is a NaN. */
#define FIXNUM_OVERFLOW_P(i) \
- (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM))
+ (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= MOST_POSITIVE_FIXNUM))
INLINE ptrdiff_t
clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
while ((c = READCHAR) >= 0
&& c >= '0' && c <= '9')
{
- if ((STRING_BYTES_BOUND - extra) / 10 <= nskip)
+ if (nskip >= (STRING_BYTES_BOUND - extra) / 10)
string_overflow ();
digits++;
nskip *= 10;
/* Read a non-negative integer. */
while (c >= '0' && c <= '9')
{
- if (MOST_POSITIVE_FIXNUM / 10 < n
- || MOST_POSITIVE_FIXNUM < n * 10 + c - '0')
+ if (n > MOST_POSITIVE_FIXNUM / 10
+ || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM)
n = MOST_POSITIVE_FIXNUM + 1;
else
n = n * 10 + c - '0';
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
- if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
- if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
if (p == end)
{
ptrdiff_t offset = p - read_buffer;
- if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2)
memory_full (SIZE_MAX);
read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
read_buffer_size *= 2;
fprintf (stdout, "%c", hide_char);
if (len == size)
{
- if (STRING_BYTES_BOUND / 2 < size)
+ if (size > STRING_BYTES_BOUND / 2)
memory_full (SIZE_MAX);
size *= 2;
line = xrealloc (line, size);
if (alpha < 0.0)
return;
- else if (1.0 < alpha)
+ else if (alpha > 1.0)
alpha = 1.0;
- else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
+ else if (alpha >= 0.0 && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
#ifdef NS_IMPL_COCOA
time_limit = 0;
nsecs = -1;
}
- else if (TYPE_MAXIMUM (time_t) < time_limit)
+ else if (time_limit > TYPE_MAXIMUM (time_t))
time_limit = TYPE_MAXIMUM (time_t);
/* Since we may need to wait several times,
continue;
FD_CLR (channel, &Available);
XPROCESS (proc)->read_output_skip = 0;
- if (XPROCESS (proc)->read_output_delay < nsecs)
+ if (nsecs > XPROCESS (proc)->read_output_delay)
nsecs = XPROCESS (proc)->read_output_delay;
}
}
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)
ptrdiff_t len = end - start;
/* Gotta be in range. */
- eassert (0 <= start && end <= c->cache_len);
+ eassert (start >= 0 && end <= c->cache_len);
/* Gotta be in order. */
eassert (start <= end);
return;
else if (alpha > 1.0)
alpha = 1.0;
- else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
+ else if (alpha >= 0.0 && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
opac = alpha * OPAQUE;