]> granicus.if.org Git - sysstat/commitdiff
Cosmetic changes in sar.c and sadf.c files.
authorSebastien Godard <sysstat@orange.fr>
Tue, 14 Jun 2011 11:29:24 +0000 (13:29 +0200)
committerSebastien Godard <sysstat@orange.fr>
Tue, 14 Jun 2011 11:29:24 +0000 (13:29 +0200)
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
sa.h
sadf.c
sar.c

diff --git a/CHANGES b/CHANGES
index 7478f3a9f9e1a5db6497788ca05fe71f3d8289ff..18c7181e9ea4012a81adf4696498a4591e5ebbdd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ Changes:
 xxxx/xx/xx: Version 10.0.2 - Sebastien Godard (sysstat <at> 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 <at> orange.fr)
diff --git a/sa.h b/sa.h
index cfd0486d966f237d30df5e22708d3759efcc8b44..08af4fd08e726ba114e32d54022421254230e0b9 100644 (file)
--- a/sa.h
+++ b/sa.h
 #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 cc1b2c01d37f0cb4ef7b236dc691eff09ae6f5ca..b3538d33bba307ccbe4af41eed9b07b1989ca8c4 100644 (file)
--- 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 07fca43acb82999e429f74afbe760e100ccf7844..d09f95911c1116f66e3456ce247de1e6806a7b35 100644 (file)
--- 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);
                }
        }