* src/composite.c (find_automatic_composition):
* src/lisp.h (clip_to_bounds):
* src/pgtkfns.c (PATH_MAX_LEN):
* src/profiler.c (approximate_median):
* src/unexmacosx.c (unexec_write_zero, unexec_copy, unexec_realloc):
* src/xdisp.c (get_nearby_bol_pos): Prefer the 'min' and 'max' macros.
(cherry picked from commit
c37aa3df9d84325924a7a163271154447dfc0cfd)
}
else
{
- head = backlim < 0 ? 0 : backlim, tail = SCHARS (string), stop = -1;
+ head = max (backlim, 0), tail = SCHARS (string), stop = -1;
cur.pos_byte = string_char_to_byte (string, cur.pos);
cur.p = SDATA (string) + cur.pos_byte;
}
INLINE intmax_t
clip_to_bounds (intmax_t lower, intmax_t num, intmax_t upper)
{
- return num < lower ? lower : num <= upper ? num : upper;
+ return num < lower ? lower : min (num, upper);
}
\f
/* Construct a Lisp_Object from a value or address. */
#define PATH_FOR_CLASS_TYPE "/org/gnu/emacs/defaults-by-class/"
#define PATH_PREFIX_FOR_NAME_TYPE "/org/gnu/emacs/defaults-by-name/"
#define PATH_MAX_LEN \
- (sizeof PATH_FOR_CLASS_TYPE > sizeof PATH_PREFIX_FOR_NAME_TYPE ? \
- sizeof PATH_FOR_CLASS_TYPE : sizeof PATH_PREFIX_FOR_NAME_TYPE)
+ (max (sizeof PATH_FOR_CLASS_TYPE, sizeof PATH_PREFIX_FOR_NAME_TYPE))
static inline int
pgtk_is_lower_char (int c)
EMACS_INT i3 = approximate_median (log, start2 + newsize,
size - 2 * newsize);
return (i1 < i2
- ? (i2 < i3 ? i2 : (i1 < i3 ? i3 : i1))
- : (i1 < i3 ? i1 : (i2 < i3 ? i3 : i2)));
+ ? (i2 < i3 ? i2 : max (i1, i3))
+ : (i1 < i3 ? i1 : max (i2, i3)));
}
}
while (count > 0)
{
- bytes = count > UNEXEC_COPY_BUFSZ ? UNEXEC_COPY_BUFSZ : count;
+ bytes = min (count, UNEXEC_COPY_BUFSZ);
if (write (outfd, buf, bytes) != bytes)
return 0;
count -= bytes;
while (count > 0)
{
- bytes_to_read = count > UNEXEC_COPY_BUFSZ ? UNEXEC_COPY_BUFSZ : count;
+ bytes_to_read = min (count, UNEXEC_COPY_BUFSZ);
bytes_read = read (infd, buf, bytes_to_read);
if (bytes_read <= 0)
return 0;
if (ptr_in_unexec_regions (old_ptr))
{
size_t old_size = ((unexec_malloc_header_t *) old_ptr)[-1].u.size;
- size_t size = new_size > old_size ? old_size : new_size;
+ size_t size = min (new_size, old_size);
p = malloc (new_size);
if (size)
for (dist = 500; dist <= 500000; dist *= 10)
{
pos_bytepos = pos == BEGV ? BEGV_BYTE : CHAR_TO_BYTE (pos);
- start = pos - dist < BEGV ? BEGV : pos - dist;
+ start = max (pos - dist, BEGV);
for (cur = start; cur < pos; cur = next)
{
next = find_newline1 (cur, CHAR_TO_BYTE (cur),
if (bol >= BEGV || start == BEGV)
break;
else
- pos = pos - dist < BEGV ? BEGV : pos - dist;
+ pos = max (pos - dist, BEGV);
}
eassert (bol <= init_pos);
return bol;