tally: Fix a c++ warning
authorVolker Lendecke <vl@samba.org>
Wed, 10 Aug 2011 17:42:54 +0000 (19:42 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 01:09:09 +0000 (10:39 +0930)
(Imported from SAMBA commit 54282e9f4eda083e70c7e56dda2bf425209add6d)

ccan/tally/tally.c

index 0d49319608d2ff6dc53edf9d62429e055c50f152..d3d320eb1b0657d0e53bf2d042d49f913f207fdd 100644 (file)
@@ -31,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;