From c682c3682220c0d5177d547ab18584bd846ae41d Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 28 Jun 2019 14:29:36 +0200 Subject: [PATCH] sadf: Fix compilation warnings Signed-off-by: Sebastien GODARD --- json_stats.c | 3 +-- pcp_stats.c | 3 +-- raw_stats.c | 3 +-- rndr_stats.c | 3 +-- svg_stats.c | 39 +++++++++++++++++++-------------------- xml_stats.c | 3 +-- 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/json_stats.c b/json_stats.c index 2b8a828..661417a 100644 --- a/json_stats.c +++ b/json_stats.c @@ -2253,10 +2253,9 @@ __print_funct_t json_print_fchost_stats(struct activity *a, int curr, int tab, for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - /* Look for corresponding structure in previous iteration */ j = i; diff --git a/pcp_stats.c b/pcp_stats.c index 6d08479..6a5a34c 100644 --- a/pcp_stats.c +++ b/pcp_stats.c @@ -2193,10 +2193,9 @@ __print_funct_t pcp_print_fchost_stats(struct activity *a, int curr, unsigned lo for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - /* Look for corresponding structure in previous iteration */ j = i; diff --git a/raw_stats.c b/raw_stats.c index 43b83f9..035df5d 100644 --- a/raw_stats.c +++ b/raw_stats.c @@ -1541,10 +1541,9 @@ __print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int cu for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - /* Look for corresponding structure in previous iteration */ j = i; diff --git a/rndr_stats.c b/rndr_stats.c index 1136c93..a6aaa97 100644 --- a/rndr_stats.c +++ b/rndr_stats.c @@ -3006,10 +3006,9 @@ __print_funct_t render_fchost_stats(struct activity *a, int isdb, char *pre, for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - /* Look for corresponding structure in previous iteration */ j = i; diff --git a/svg_stats.c b/svg_stats.c index ad5b74a..05482dc 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -4980,37 +4980,36 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action, for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - - /* Look for corresponding graph */ + /* Look for corresponding graph */ + for (k = 0; k < a->item_list_sz; k++) { + item_name = *(out + k * 5 + 4); + if (!strcmp(sfcc->fchost_name, item_name)) + /* Graph found! */ + break; + } + if (k == a->item_list_sz) { + /* Graph not found: Look for first free entry */ for (k = 0; k < a->item_list_sz; k++) { item_name = *(out + k * 5 + 4); - if (!strcmp(sfcc->fchost_name, item_name)) - /* Graph found! */ + if (!strcmp(item_name, "")) break; } if (k == a->item_list_sz) { - /* Graph not found: Look for first free entry */ - for (k = 0; k < a->item_list_sz; k++) { - item_name = *(out + k * 5 + 4); - if (!strcmp(item_name, "")) - break; - } - if (k == a->item_list_sz) { - /* No free graph entry: Ignore it (should never happen) */ + /* No free graph entry: Ignore it (should never happen) */ #ifdef DEBUG - fprintf(stderr, "%s: Name=%s\n", - __FUNCTION__, sfcc->fchost_name); + fprintf(stderr, "%s: Name=%s\n", + __FUNCTION__, sfcc->fchost_name); #endif - continue; - } + continue; } + } - pos = k * 5; - unregistered = outsize + pos + 4; + pos = k * 5; + unregistered = outsize + pos + 4; + if (a->nr[!curr] > 0) { /* Look for corresponding structure in previous iteration */ j = i; diff --git a/xml_stats.c b/xml_stats.c index 168d922..a345a2d 100644 --- a/xml_stats.c +++ b/xml_stats.c @@ -2153,10 +2153,9 @@ __print_funct_t xml_print_fchost_stats(struct activity *a, int curr, int tab, for (i = 0; i < a->nr[curr]; i++) { found = FALSE; + sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); if (a->nr[!curr] > 0) { - sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize); - /* Look for corresponding structure in previous iteration */ j = i; -- 2.40.0