emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118022: Consistently use min and max macros from li


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r118022: Consistently use min and max macros from lisp.h.
Date: Fri, 03 Oct 2014 04:35:32 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118022
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2014-10-03 08:35:10 +0400
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
  src/font.c                     font.c-20091113204419-o5vbwnq5f7feedwu-8540
  src/gmalloc.c                  gmalloc.c-20091113204419-o5vbwnq5f7feedwu-1085
  src/regex.c                    regex.c-20091113204419-o5vbwnq5f7feedwu-518
  src/unexhp9k800.c              
unexhp9k800.c-20091113204419-o5vbwnq5f7feedwu-4481
  src/unexw32.c                  unexw32.c-20091113204419-o5vbwnq5f7feedwu-887
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-03 02:20:52 +0000
+++ b/src/ChangeLog     2014-10-03 04:35:10 +0000
@@ -1,3 +1,14 @@
+2014-10-03  Dmitry Antipov  <address@hidden>
+
+       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  <address@hidden>
 
        Fix x-focus-frame bug with "Not an in-range integer" (Bug#18586).

=== modified file 'src/coding.c'
--- a/src/coding.c      2014-09-07 22:27:59 +0000
+++ b/src/coding.c      2014-10-03 04:35:10 +0000
@@ -642,15 +642,6 @@
    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

=== modified file 'src/font.c'
--- a/src/font.c        2014-10-01 03:28:16 +0000
+++ b/src/font.c        2014-10-03 04:35:10 +0000
@@ -41,10 +41,6 @@
 #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 @@
   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))
     {

=== modified file 'src/gmalloc.c'
--- a/src/gmalloc.c     2014-09-28 22:31:59 +0000
+++ b/src/gmalloc.c     2014-10-03 04:35:10 +0000
@@ -1303,7 +1303,7 @@
    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.  */

=== modified file 'src/regex.c'
--- a/src/regex.c       2014-09-07 07:04:01 +0000
+++ b/src/regex.c       2014-10-03 04:35:10 +0000
@@ -515,10 +515,12 @@
 
 #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 @@
    : ((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 @@
                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 @@
 #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 @@
                { /* 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 @@
 
              /* 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;

=== modified file 'src/unexhp9k800.c'
--- a/src/unexhp9k800.c 2014-02-13 17:23:08 +0000
+++ b/src/unexhp9k800.c 2014-10-03 04:35:10 +0000
@@ -72,7 +72,6 @@
 
 #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

=== modified file 'src/unexw32.c'
--- a/src/unexw32.c     2014-09-01 02:37:22 +0000
+++ b/src/unexw32.c     2014-10-03 04:35:10 +0000
@@ -48,11 +48,6 @@
 
 #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;
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]