modargs: Ensure modargs can be accessed in their raw form.
authorColin Guthrie <colin@mageia.org>
Tue, 6 Sep 2011 10:35:33 +0000 (11:35 +0100)
committerColin Guthrie <colin@mageia.org>
Fri, 9 Sep 2011 18:50:49 +0000 (19:50 +0100)
commit3542112888c0dd563eda37a8be498dd5883fcb0e
tree499838dc5cf71bc64378c5468610442b614f7b5b
parente93b32744c1bafb33d5f3ee40b422bab2d017ae1
modargs: Ensure modargs can be accessed in their raw form.

When dealing with proplists passed as modargs, we need the unescaped form
in order to properly deal with quotes (ticks + double quotes). As the previous
code always called pa_unescape() before adding it into the modarg hashmap, this
was impossible.

This modification simply stores two proplists. If the unescaped value
is different from the raw value, we also keep the raw form.

When parsing proplist arguments, we use this raw form and do the unescaping
ourselves when processing it.

This changes the current behaviour which required you to double escape
proplists arguments. This double escape mechanism did allow you to mix
and match what types of quotes you used to delimit the individial
proplist values, but it made the actual data much harder to pass in.

This approach has the drawback that you cannot mix and match the quotes
you use, but this is a very minor issue and IMO pales in comparison to
the general clarity gained.

See the discussion on the mailing list for more background:
 http://lists.freedesktop.org/archives/pulseaudio-discuss/2011-September/011220.html
src/pulsecore/modargs.c
src/tests/proplist-test.c