Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1453703
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/7] tools lib: Add bitmap_alloc function |
| Date | 2016-08-02 11:40 +0200 |
| Message-ID | <s1El3-2B6-13@gated-at.bofh.it> (permalink) |
| References | <s1pYK-1pc-11@gated-at.bofh.it> <s1pYK-1pc-9@gated-at.bofh.it> <s1rxv-2ia-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Aug 01, 2016 at 12:45:18PM -0600, David Ahern wrote:
> 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.
hum, right.. all my code used bitmap_zero,
but zalloc would be better choice in here
thanks,
jirka
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/7] tools lib: Add bitmap_alloc function Jiri Olsa <jolsa@kernel.org> - 2016-08-01 20:20 +0200
Re: [PATCH 1/7] tools lib: Add bitmap_alloc function David Ahern <dsahern@gmail.com> - 2016-08-01 22:00 +0200
Re: [PATCH 1/7] tools lib: Add bitmap_alloc function Jiri Olsa <jolsa@redhat.com> - 2016-08-02 11:40 +0200
[PATCHv2 1/7] tools lib: Add bitmap_alloc function Jiri Olsa <jolsa@redhat.com> - 2016-08-02 13:50 +0200
Re: [PATCHv2 1/7] tools lib: Add bitmap_alloc function Jiri Olsa <jolsa@redhat.com> - 2016-08-02 15:20 +0200
Re: [PATCHv2 1/7] tools lib: Add bitmap_alloc function Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-02 16:20 +0200
[tip:perf/urgent] tools lib: Add bitmap_alloc function tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-08-04 11:20 +0200
csiph-web