[pulseaudio-discuss] signature of pa_proplist_copy() claims to modify rhs

Tanu Kaskinen tanuk at iki.fi
Thu Mar 8 23:25:18 PST 2012


On Mon, 2012-02-27 at 06:25 +0200, Tanu Kaskinen wrote:
> On Sun, 2012-02-26 at 12:04 +0100, Marcel Müller wrote:
> > Is there a serious reason why pa_proplist_copy takes a non constant 
> > pointer to the property list to copy?
> 
> I don't think there is, other than the hassle to implement a variant of
> pa_hashmap_iterate() (called by pa_proplist_update(), which is called by
> pa_proplist_copy()) that takes a const pa_hashmap pointer and returns
> const pointers. That could be avoided by doing some ugly casts in
> pa_proplist_update(). I'm not sure which is worse - duplicating
> pa_hashmap_iterate() or the ugly casts. In any case, if the
> non-constness of the pa_proplist_copy() argument is a problem for
> someone, I think we should fix pa_proplist_copy() in one way or another.

I chose the "ugly cast" option, but it turned out that the existing
MAKE_HASHMAP cast was already ugly enough to satisfy the compiler, so
the end result was a pretty clean commit:

http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=6f9e651e4e993ee95c4826fbee36b4d49d592151

-- 
Tanu



More information about the pulseaudio-discuss mailing list