GVariant: add internal tree-form locking helper
authorRyan Lortie <desrt@desrt.ca>
Fri, 28 Nov 2014 20:42:34 +0000 (15:42 -0500)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Fri, 10 Jul 2015 09:47:42 +0000 (11:47 +0200)
commit11a21a2a1c2b2d7e0ea1339a8596a2e05c55dfe3
treed083e2d33cc4fb215fea26eee407c5e065a26889
parent03282541a8f86bc3b047773751ca9e0450974996
GVariant: add internal tree-form locking helper

Many of the core GVariant operations have two modes: one for tree-form
and one for serialised.

Once a GVariant is in serialised form it will always be serialised, so
it is safe to simply check for that and proceed with the operation in
that case.

A tree-form GVariant instance always has a chance of being implicitly
serialised, however, so we have to take locks when performing operations
on these.

Write a helper function that reliably checks if the instance is in
tree-form, locking it if it is.  Rewrite some of the other functions to
use this helper.  In some cases this simplifies the code and in others
it reduces locking.
glib/gvariant-core.c