]> git.eshelyaron.com Git - emacs.git/commitdiff
Consistently use min and max macros from lisp.h.
authorDmitry Antipov <dmantipov@yandex.ru>
Fri, 3 Oct 2014 04:35:10 +0000 (08:35 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Fri, 3 Oct 2014 04:35:10 +0000 (08:35 +0400)
* 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.

src/ChangeLog
src/coding.c
src/font.c
src/gmalloc.c
src/regex.c
src/unexhp9k800.c
src/unexw32.c

index f5f1d8e04585ddabb5b83d628fb791593e2300be..6a4ef3a1dd963455541f7524d9ca201e608e7b78 100644 (file)
@@ -1,3 +1,14 @@
+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).
index ed107a297baf08e3b7fcc05149f5ae6f813216c7..0337c0df60e333d560acd48bc91d3612c906c316 100644 (file)
@@ -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
index 4d99087ef7d324345489ccd31f4f9816b7a18879..8405065a0d0315acb1aa116ec546db62018b821b 100644 (file)
@@ -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))
     {
index 47046cc6747b382375e9384a74f89c1a5a44af79..3456ff0ec6f5c100f443d4b5bdeca6efe9cda7e8 100644 (file)
@@ -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.  */
index 9e9018bff88eb457537f06f013e4ae11f1012345..766ad26e709dbe43ad16126d219b1f583640a748 100644 (file)
@@ -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;
index 55db8071b76a7ff642c0331919fe4c7aa03302d0..cbf1835b9eefae6e233180088a717aeff4b183a7 100644 (file)
@@ -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
index 95c805d09ae95658f81f28cb43a5247e821166ed..5c1c1f3f391bbd375df74cfd3bd84e6bfecb6b02 100644 (file)
@@ -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;