Skip to content

glib/gvariant: avoid GVariantType copy for stack builders

g_variant_builder_init() is not available to bindings which is the primary reason that the GVariantType would need to stay alive.

This makes only the heap form of GVariantBuilder copy the GVariantType and uses that instead.

Since technically one could write code that does g_variant_builder_init() and frees an allocated string cast with G_VARIANT_TYPE() I wanted to put this up for review separately.

About 6% of time creating a simple (ii) GVariant is spent doing the malloc, memcpy, and free of the GVariantType in a stack_builder.

Merge request reports

Loading