From 943767c1fd4686fc6159a2d5654b9efe1698e82c Mon Sep 17 00:00:00 2001 From: Sebastien Godard Date: Tue, 14 Jun 2011 13:29:24 +0200 Subject: [PATCH] Cosmetic changes in sar.c and sadf.c files. Instead of calling print methods twice, use the following syntax: print_method_name(arg1, arg2, arg3, NEED_GLOBAL_ITV(act[i]->options) ? g_itv : itv); --- CHANGES | 1 + sa.h | 2 +- sadf.c | 18 ++++-------------- sar.c | 12 ++++-------- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index 7478f3a..18c7181 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Changes: xxxx/xx/xx: Version 10.0.2 - Sebastien Godard (sysstat orange.fr) * [Jeroen Roovers]: Automate translation files handling in Makefile.in. + * Various cosmetic changes (sar.c, sadf.c). * CREDITS file updated. 2011/06/03: Version 10.0.1 - Sebastien Godard (sysstat orange.fr) diff --git a/sa.h b/sa.h index cfd0486..08af4fd 100644 --- a/sa.h +++ b/sa.h @@ -264,7 +264,7 @@ #define IS_COLLECTED(m) (((m) & AO_COLLECTED) == AO_COLLECTED) #define IS_SELECTED(m) (((m) & AO_SELECTED) == AO_SELECTED) #define IS_REMANENT(m) (((m) & AO_REMANENT) == AO_REMANENT) -#define NEEDS_GLOBAL_ITV(m) (((m) & AO_GLOBAL_ITV) == AO_GLOBAL_ITV) +#define NEED_GLOBAL_ITV(m) (((m) & AO_GLOBAL_ITV) == AO_GLOBAL_ITV) #define CLOSE_MARKUP(m) (((m) & AO_CLOSE_MARKUP) == AO_CLOSE_MARKUP) #define HAS_MULTIPLE_OUTPUTS(m) (((m) & AO_MULTIPLE_OUTPUTS) == AO_MULTIPLE_OUTPUTS) diff --git a/sadf.c b/sadf.c index cc1b2c0..b3538d3 100644 --- a/sadf.c +++ b/sadf.c @@ -261,13 +261,8 @@ void write_mech_stats(int curr, unsigned long dt, unsigned long long itv, continue; if (IS_SELECTED(act[i]->options) && (act[i]->nr > 0)) { - - if (NEEDS_GLOBAL_ITV(act[i]->options)) { - (*act[i]->f_render)(act[i], isdb, pre, curr, g_itv); - } - else { - (*act[i]->f_render)(act[i], isdb, pre, curr, itv); - } + (*act[i]->f_render)(act[i], isdb, pre, curr, + NEED_GLOBAL_ITV(act[i]->options) ? g_itv : itv); } } @@ -459,13 +454,8 @@ int write_xml_stats(int curr, int use_tm_start, int use_tm_end, int reset, if (CLOSE_MARKUP(act[i]->options) || (IS_SELECTED(act[i]->options) && (act[i]->nr > 0))) { - - if (NEEDS_GLOBAL_ITV(act[i]->options)) { - (*act[i]->f_xml_print)(act[i], curr, tab, g_itv); - } - else { - (*act[i]->f_xml_print)(act[i], curr, tab, itv); - } + (*act[i]->f_xml_print)(act[i], curr, tab, + NEED_GLOBAL_ITV(act[i]->options) ? g_itv : itv); } } diff --git a/sar.c b/sar.c index 07fca43..d09f959 100644 --- a/sar.c +++ b/sar.c @@ -392,10 +392,8 @@ void write_stats_avg(int curr, int read_from_file, unsigned int act_id) if (IS_SELECTED(act[i]->options) && (act[i]->nr > 0)) { /* Display current average activity statistics */ - if (NEEDS_GLOBAL_ITV(act[i]->options)) - (*act[i]->f_print_avg)(act[i], 2, curr, g_itv); - else - (*act[i]->f_print_avg)(act[i], 2, curr, itv); + (*act[i]->f_print_avg)(act[i], 2, curr, + NEED_GLOBAL_ITV(act[i]->options) ? g_itv : itv); } } @@ -501,10 +499,8 @@ int write_stats(int curr, int read_from_file, long *cnt, int use_tm_start, if (IS_SELECTED(act[i]->options) && (act[i]->nr > 0)) { /* Display current activity statistics */ - if (NEEDS_GLOBAL_ITV(act[i]->options)) - (*act[i]->f_print)(act[i], !curr, curr, g_itv); - else - (*act[i]->f_print)(act[i], !curr, curr, itv); + (*act[i]->f_print)(act[i], !curr, curr, + NEED_GLOBAL_ITV(act[i]->options) ? g_itv : itv); } } -- 2.40.0