]> git.ozlabs.org Git - ccan/commitdiff
tally: Adapt tally_add to Samba coding conventions
authorVolker Lendecke <vl@samba.org>
Wed, 10 Aug 2011 17:46:24 +0000 (19:46 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 01:09:10 +0000 (10:39 +0930)
(Imported from SAMBA commit 9c32c86783bf6a3e126e6e83f51ccdf0ecdd132d)

ccan/tally/tally.c

index 4c5e37e9e05d9eb256569573863e8e18714430be..28a66a9f7fa0ebf384c62d69de8b04b396f71cad 100644 (file)
@@ -138,15 +138,17 @@ void tally_add(struct tally *tally, ssize_t val)
                new_max = val;
                need_renormalize = true;
        }
-       if (need_renormalize)
+       if (need_renormalize) {
                renormalize(tally, new_min, new_max);
+       }
 
        /* 128-bit arithmetic!  If we didn't want exact mean, we could just
         * pull it out of counts. */
-       if (val > 0 && tally->total[0] + val < tally->total[0])
+       if (val > 0 && tally->total[0] + val < tally->total[0]) {
                tally->total[1]++;
-       else if (val < 0 && tally->total[0] + val > tally->total[0])
+       } else if (val < 0 && tally->total[0] + val > tally->total[0]) {
                tally->total[1]--;
+       }
        tally->total[0] += val;
        tally->counts[bucket_of(tally->min, tally->step_bits, val)]++;
 }