]> git.ozlabs.org Git - ccan/blobdiff - ccan/tally/tally.c
tally: Fix a c++ warning
[ccan] / ccan / tally / tally.c
index 396474b250e0c04be0b8a581a2fddc1bb553c7a4..d3d320eb1b0657d0e53bf2d042d49f913f207fdd 100644 (file)
@@ -1,3 +1,4 @@
+/* Licensed under LGPLv3+ - see LICENSE file for details */
 #include <ccan/tally/tally.h>
 #include <ccan/build_assert/build_assert.h>
 #include <ccan/likely/likely.h>
@@ -30,7 +31,8 @@ struct tally *tally_new(unsigned buckets)
        /* Overly cautious check for overflow. */
        if (sizeof(*tally) * buckets / sizeof(*tally) != buckets)
                return NULL;
-       tally = malloc(sizeof(*tally) + sizeof(tally->counts[0])*(buckets-1));
+       tally = (struct tally *)malloc(
+               sizeof(*tally) + sizeof(tally->counts[0])*(buckets-1));
        if (tally) {
                tally->max = ((size_t)1 << (SIZET_BITS - 1));
                tally->min = ~tally->max;