glib/gvariant: use g_utf8_validate() for strlen
We can get the length of the string if we provide an out argument to
g_utf8_validate(). This avoids an extra strlen()
when creating GVariant
for UTF-8 strings.
This is good for nearly 7% reduction of CPU samples when building
heavily string-based GVariant
using GVariantBuilder
as a benchmark.