[pulseaudio-discuss] [PATCH 1/3] hashmap: Add a key+value iterator

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Fri Sep 20 05:30:28 PDT 2013


On Fri, 2013-09-20 at 17:55 +0530, Arun Raghavan wrote:
> On Fri, 2013-09-20 at 15:13 +0300, Tanu Kaskinen wrote:
> > On Fri, 2013-09-20 at 17:27 +0530, Arun Raghavan wrote:
> > > ---
> > >  src/pulsecore/hashmap.h | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/src/pulsecore/hashmap.h b/src/pulsecore/hashmap.h
> > > index ae030ed..e42732a 100644
> > > --- a/src/pulsecore/hashmap.h
> > > +++ b/src/pulsecore/hashmap.h
> > > @@ -85,6 +85,10 @@ void* pa_hashmap_last(pa_hashmap *h);
> > >  #define PA_HASHMAP_FOREACH(e, h, state) \
> > >      for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), NULL); (e); (e) = pa_hashmap_iterate((h), &(state), NULL))
> > >  
> > > +/* A macro to ease itration through all key, value pairs */
> > > +#define PA_HASHMAP_FOREACH_KV(k, e, h, state) \
> > > +    for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), (const void **) &(k)); (e); (e) = pa_hashmap_iterate((h), &(state), (const void **) &(k)))
> > 
> > Are the (const void **) casts really needed?
> 
> Yes, the compiler complains about casts from (const type **) to (const
> void **).

Ok. Silly compiler.

I noticed that this casting is not done anywhere in the current code
base, but on closer look it turned out that in every case the original
type is const void ** anyway.

-- 
Tanu



More information about the pulseaudio-discuss mailing list