bison-patches
[Top][All Lists]
Advanced

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

[PATCH 2/5] Use max_int instead of max because MSVC defines this symbol


From: anonymous . maarten
Subject: [PATCH 2/5] Use max_int instead of max because MSVC defines this symbol already
Date: Thu, 30 Jul 2020 20:53:32 +0200

From: Anonymous Maarten <anonymous.maarten@gmail.com>

---
 src/counterexample.c | 6 +++---
 src/derivation.c     | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/counterexample.c b/src/counterexample.c
index cdf3f218..37c6d372 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -113,7 +113,7 @@ free_counterexample (counterexample *cex)
   free (cex);
 }
 
-static int max (int a, int b)
+static int max_int (int a, int b)
 {
   return a < b ? b : a;
 }
@@ -131,8 +131,8 @@ counterexample_print (const counterexample *cex, FILE *out, 
const char *prefix)
   const char *deriv2_label
     = cex->shift_reduce ? _("Reduce derivation") : _("Second reduce 
derivation");
   const int width =
-    max (max (mbswidth (example1_label, 0), mbswidth (example2_label, 0)),
-         max (mbswidth (deriv1_label, 0),   mbswidth (deriv2_label, 0)));
+    max_int (max_int (mbswidth (example1_label, 0), mbswidth (example2_label, 
0)),
+             max_int (mbswidth (deriv1_label, 0),   mbswidth (deriv2_label, 
0)));
   if (flat)
     fprintf (out, "  %s%s%*s ", prefix,
              example1_label, width - mbswidth (example1_label, 0), "");
diff --git a/src/derivation.c b/src/derivation.c
index 9772cabd..d9300711 100644
--- a/src/derivation.c
+++ b/src/derivation.c
@@ -136,7 +136,7 @@ derivation_size (const derivation *deriv)
 
 
 static int
-max (int a, int b)
+max_int (int a, int b)
 {
   return a < b ? b : a;
 }
@@ -154,7 +154,7 @@ derivation_depth (const derivation *deriv)
       for (gl_list_iterator_t it = gl_list_iterator (deriv->children);
            derivation_list_next (&it, &child);
            )
-        res = max (res, derivation_depth (child));
+        res = max_int (res, derivation_depth (child));
       return res + 1;
     }
   else
@@ -237,7 +237,7 @@ derivation_width (const derivation *deriv)
           // No separator at the beginning.
           children_width -= derivation_separator_width;
         }
-      return max (self_width, children_width);
+      return max_int (self_width, children_width);
     }
   else if (deriv == &d_dot)
     {
-- 
2.21.3




reply via email to

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