diff options
author | Cristian Rodríguez <crrodriguez@opensuse.org> | 2013-04-01 03:08:05 -0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-01 23:43:48 -0400 |
commit | 9607d9470eec07df817e58f64d312ccb5ac4cfcc (patch) | |
tree | d0d933b13ec47e4d22dcee3078af94e89a998e6e /src/bootchart | |
parent | e5ec62c56963d997edaffa904af5dc45dac23988 (diff) |
Always use our own MAX/MIN definitions
code in src/shared/macro.h only defined MAX/MIN in case
they were not defined previously. however the MAX/MIN
macros implemented in glibc are not of the "safe" kind but defined
as:
define MIN(a,b) (((a)<(b))?(a):(b))
define MAX(a,b) (((a)>(b))?(a):(b))
Avoid nasty side effects by using our own versions instead.
Also fix the warnings derived from this change.
[zj: - modify MAX3 macro to fix warning about _a shadowing _a,
- do bootchart/svg.c too,
- remove unused MIN3.]
Diffstat (limited to 'src/bootchart')
-rw-r--r-- | src/bootchart/svg.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c index 0fb9fffd9b..a4086c5227 100644 --- a/src/bootchart/svg.c +++ b/src/bootchart/svg.c @@ -44,9 +44,6 @@ #define kb_to_graph(m) ((m) * arg_scale_y * 0.0001) #define to_color(n) (192.0 - ((n) * 192.0)) -#define max(x, y) (((x) > (y)) ? (x) : (y)) -#define min(x, y) (((x) < (y)) ? (x) : (y)) - static char str[8092]; #define svg(a...) do { snprintf(str, 8092, ## a); fputs(str, of); fflush(of); } while (0) @@ -441,8 +438,8 @@ static void svg_io_bi_bar(void) { int stop; double tot; - start = max(i - ((range / 2) - 1), 0); - stop = min(i + (range / 2), samples - 1); + start = MAX(i - ((range / 2) - 1), 0); + stop = MIN(i + (range / 2), samples - 1); tot = (double)(blockstat[stop].bi - blockstat[start].bi) / (stop - start); @@ -463,8 +460,8 @@ static void svg_io_bi_bar(void) { double tot; double pbi; - start = max(i - ((range / 2) - 1), 0); - stop = min(i + (range / 2), samples); + start = MAX(i - ((range / 2) - 1), 0); + stop = MIN(i + (range / 2), samples); tot = (double)(blockstat[stop].bi - blockstat[start].bi) / (stop - start); @@ -517,8 +514,8 @@ static void svg_io_bo_bar(void) { int stop; double tot; - start = max(i - ((range / 2) - 1), 0); - stop = min(i + (range / 2), samples - 1); + start = MAX(i - ((range / 2) - 1), 0); + stop = MIN(i + (range / 2), samples - 1); tot = (double)(blockstat[stop].bi - blockstat[start].bi) / (stop - start); @@ -539,8 +536,8 @@ static void svg_io_bo_bar(void) { double tot; double pbo; - start = max(i - ((range / 2) - 1), 0); - stop = min(i + (range / 2), samples); + start = MAX(i - ((range / 2) - 1), 0); + stop = MIN(i + (range / 2), samples); tot = (double)(blockstat[stop].bo - blockstat[start].bo) / (stop - start); |