Re: [PATCH 1/7] tools lib: Add bitmap_alloc function

David Ahern
2016-08-01T19:51:46Z

On 8/1/16 12:02 PM, Jiri Olsa wrote:
> @@ -65,4 +66,13 @@ static inline int test_and_set_bit(int nr, unsigned long *addr)
> return (old & mask) != 0;
> }
>
> +/**
> + * bitmap_alloc - Allocate bitmap
> + * @nr: Bit to set
> + */
> +static inline unsigned long *bitmap_alloc(int nbits)
> +{
> + return malloc(BITS_TO_LONGS(nbits) * sizeof(unsigned long));
> +}
> +
> #endif /* _PERF_BITOPS_H */

calloc? Can't imagine any user wanting an uninitialized bitmap.