]> git.tue.mpg.de Git - dss.git/commitdiff
dss: Do not shadow a global declaration.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 17 Jun 2016 08:17:28 +0000 (10:17 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 29 Jul 2016 09:01:01 +0000 (11:01 +0200)
num_complete_snapshots is a local variable in
compute_next_snapshot_time(), but also the name of a public function
declared in snap.h, causing a warning on some (old) gcc versions.

This patch avoids the ambiguity and thus the warning by renaming the
variable. It was unusually long anyway.

dss.c

diff --git a/dss.c b/dss.c
index 0bc891373bd7e6096063ebc45aa953582433d68c..a50a3dedd9235274ae380ad6272279ba8ba6ada8 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -303,7 +303,7 @@ static int64_t compute_next_snapshot_time(void)
        int64_t x = 0, now = get_current_time(), unit_interval
                = 24 * 3600 * conf.unit_interval_arg, ret;
        unsigned wanted = desired_number_of_snapshots(0, conf.num_intervals_arg),
-               num_complete_snapshots = 0;
+               num_complete = 0;
        int i;
        struct snapshot *s = NULL;
        struct snapshot_list sl;
@@ -312,15 +312,15 @@ static int64_t compute_next_snapshot_time(void)
        FOR_EACH_SNAPSHOT(s, i, &sl) {
                if (!(s->flags & SS_COMPLETE))
                        continue;
-               num_complete_snapshots++;
+               num_complete++;
                x += s->completion_time - s->creation_time;
        }
        assert(x >= 0);
 
        ret = now;
-       if (num_complete_snapshots == 0)
+       if (num_complete == 0)
                goto out;
-       x /= num_complete_snapshots; /* avg time to create one snapshot */
+       x /= num_complete; /* avg time to create one snapshot */
        if (unit_interval < x * wanted) /* oops, no sleep at all */
                goto out;
        ret = s->completion_time + unit_interval / wanted - x;