Commit 6846b003 authored by Dmitry Antipov's avatar Dmitry Antipov

Consistently use min and max macros from lisp.h.

* coding.c (min, max):
* font.c (MAX):
* unexhp9k800.c (min):
* unexw32.c (min, max): Use definitions from lisp.h.
* regex.c (MAX, MIN) [!emacs]: Define own max and min as such.
Adjust users.
* gmalloc.c (min): Tiny style change.
parent 11bd10a7
2014-10-03 Dmitry Antipov <dmantipov@yandex.ru>
Consistently use min and max macros from lisp.h.
* coding.c (min, max):
* font.c (MAX):
* unexhp9k800.c (min):
* unexw32.c (min, max): Use definitions from lisp.h.
* regex.c (MAX, MIN) [!emacs]: Define own max and min as such.
Adjust users.
* gmalloc.c (min): Tiny style change.
2014-10-03 Paul Eggert <eggert@cs.ucla.edu>
Fix x-focus-frame bug with "Not an in-range integer" (Bug#18586).
......
......@@ -642,15 +642,6 @@ static enum coding_category coding_priorities[coding_category_max];
Nth coding category. */
static struct coding_system coding_categories[coding_category_max];
/*** Commonly used macros and functions ***/
#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
/* Encode a flag that can be nil, something else, or t as -1, 0, 1. */
static int
......
......@@ -41,10 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
#ifndef MAX
# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
Lisp_Object Qopentype;
/* Important character set strings. */
......@@ -1310,7 +1306,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
val = AREF (font, FONT_SIZE_INDEX);
eassert (NUMBERP (val) || NILP (val));
char font_size_index_buf[sizeof "-*"
+ MAX (INT_STRLEN_BOUND (EMACS_INT),
+ max (INT_STRLEN_BOUND (EMACS_INT),
1 + DBL_MAX_10_EXP + 1)];
if (INTEGERP (val))
{
......
......@@ -1303,7 +1303,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
or (US mail) as Mike Haertel c/o Free Software Foundation. */
#ifndef min
#define min(A, B) ((A) < (B) ? (A) : (B))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
/* Debugging hook for realloc. */
......
......@@ -515,10 +515,12 @@ init_syntax_once (void)
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
#undef MAX
#undef MIN
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#ifndef emacs
# undef max
# undef min
# define max(a, b) ((a) > (b) ? (a) : (b))
# define min(a, b) ((a) < (b) ? (a) : (b))
#endif
/* Type of source-pattern and string chars. */
#ifdef _MSC_VER
......@@ -1394,14 +1396,14 @@ typedef struct
: ((fail_stack).stack \
= REGEX_REALLOCATE_STACK ((fail_stack).stack, \
(fail_stack).size * sizeof (fail_stack_elt_t), \
MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \
min (re_max_failures * TYPICAL_FAILURE_SIZE, \
((fail_stack).size * sizeof (fail_stack_elt_t) \
* FAIL_STACK_GROWTH_FACTOR))), \
\
(fail_stack).stack == NULL \
? 0 \
: ((fail_stack).size \
= (MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \
= (min (re_max_failures * TYPICAL_FAILURE_SIZE, \
((fail_stack).size * sizeof (fail_stack_elt_t) \
* FAIL_STACK_GROWTH_FACTOR)) \
/ sizeof (fail_stack_elt_t)), \
......@@ -2309,8 +2311,8 @@ set_image_of_range (struct range_table_work_area *work_area,
cmin = c, cmax = c;
else
{
cmin = MIN (cmin, c);
cmax = MAX (cmax, c);
cmin = min (cmin, c);
cmax = max (cmax, c);
}
}
}
......@@ -2989,7 +2991,7 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
#else /* emacs */
if (c < 128)
{
ch = MIN (127, c1);
ch = min (127, c1);
SETUP_ASCII_RANGE (range_table_work, c, ch);
c = ch + 1;
if (CHAR_BYTE8_P (c1))
......@@ -5210,7 +5212,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
{ /* No. So allocate them with malloc. We need one
extra element beyond `num_regs' for the `-1' marker
GNU code uses. */
regs->num_regs = MAX (RE_NREGS, num_regs + 1);
regs->num_regs = max (RE_NREGS, num_regs + 1);
regs->start = TALLOC (regs->num_regs, regoff_t);
regs->end = TALLOC (regs->num_regs, regoff_t);
if (regs->start == NULL || regs->end == NULL)
......@@ -5254,7 +5256,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
/* Go through the first `min (num_regs, regs->num_regs)'
registers, since that is all we initialized. */
for (reg = 1; reg < MIN (num_regs, regs->num_regs); reg++)
for (reg = 1; reg < min (num_regs, regs->num_regs); reg++)
{
if (REG_UNSET (regstart[reg]) || REG_UNSET (regend[reg]))
regs->start[reg] = regs->end[reg] = -1;
......
......@@ -72,7 +72,6 @@ run_time_remap (char *ignored)
#undef roundup
#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */
#define min(x,y) (((x) < (y)) ? (x) : (y))
/* Report a fatal error and exit. */
static _Noreturn void
......
......@@ -48,11 +48,6 @@ extern char *my_begbss_static;
#include "w32heap.h"
#undef min
#undef max
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define max(x, y) (((x) > (y)) ? (x) : (y))
/* Basically, our "initialized" flag. */
BOOL using_dynamic_heap = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment