X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftally%2Ftally.c;h=2af7353380f9af18221971aba90d1f7648ab8b2b;hp=396474b250e0c04be0b8a581a2fddc1bb553c7a4;hb=a81be540c665d2e751ed06510a47b934fa075140;hpb=af7a902d74a7926693f55da9e21a67dde46931d4 diff --git a/ccan/tally/tally.c b/ccan/tally/tally.c index 396474b2..2af73533 100644 --- a/ccan/tally/tally.c +++ b/ccan/tally/tally.c @@ -1,3 +1,4 @@ +/* Licensed under LGPLv3+ - see LICENSE file for details */ #include #include #include @@ -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; @@ -448,7 +450,7 @@ char *tally_histogram(const struct tally *tally, largest_bucket = tally->counts[i]; } - p = graph = malloc(height * (width + 1) + 1); + p = graph = (char *)malloc(height * (width + 1) + 1); if (!graph) { free(tmp); return NULL;