summaryrefslogtreecommitdiff
path: root/x11/gtk3/patches/patch-gtk_fallback-c89.c
blob: 2468fc4382cc8d6c1d41bff78132136fbe7f401f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-gtk_fallback-c89.c,v 1.2.2.2 2015/11/08 08:41:49 bsiegert Exp $

Work around the fact that math.h may declare these functions
non-static.

--- gtk/fallback-c89.c.orig	2014-03-06 04:42:58.000000000 +0000
+++ gtk/fallback-c89.c
@@ -22,19 +22,20 @@
 /* Workaround for round() for non-GCC/non-C99 compilers */
 #ifndef HAVE_ROUND
 static inline double
-round (double x)
+my_round (double x)
 {
   if (x >= 0)
     return floor (x + 0.5);
   else
     return ceil (x - 0.5);
 }
+#define round(x)	my_round(x)
 #endif
 
 /* Workaround for rint() for non-GCC/non-C99 compilers */
 #ifndef HAVE_RINT
 static inline double
-rint (double x)
+my_rint (double x)
 {
   if (ceil (x + 0.5) == floor (x + 0.5))
   {
@@ -53,6 +54,7 @@ rint (double x)
       return ceil (x - 0.5);
   }
 }
+#define rint(x)		my_rint(x)
 #endif
 
 #ifndef HAVE_NEARBYINT
@@ -60,8 +62,9 @@ rint (double x)
 /* This is quite similar to rint() in most respects */
 
 static inline double
-nearbyint (double x)
+my_nearbyint (double x)
 {
   return floor (x + 0.5);
 }
+#define nearbyint(x)	my_nearbyint(x)
 #endif