mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 04:36:17 +01:00
gio/gdbus-codegen: use g_variant_builder_init_static()
Make the generated GDBus-based code use GVariantBuilder with a static GVariantType to avoid copying the GVariantType on each use. This is gated behind a GLib 2.83.0 check.
This commit is contained in:
parent
c50e44a6e0
commit
bfac590364
@ -3975,7 +3975,11 @@ class CodeGenerator:
|
||||
"\n"
|
||||
" GVariantBuilder builder;\n"
|
||||
" guint n;\n"
|
||||
"#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84\n"
|
||||
' g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}"));\n'
|
||||
"#else\n"
|
||||
' g_variant_builder_init(&builder, G_VARIANT_TYPE ("a{sv}"));\n'
|
||||
"#endif\n"
|
||||
" if (_%s_interface_info.parent_struct.properties == NULL)\n"
|
||||
" goto out;\n"
|
||||
" for (n = 0; _%s_interface_info.parent_struct.properties[n] != NULL; n++)\n"
|
||||
@ -4184,8 +4188,13 @@ class CodeGenerator:
|
||||
" guint num_changes;\n"
|
||||
"\n"
|
||||
" g_mutex_lock (&skeleton->priv->lock);\n"
|
||||
"#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84\n"
|
||||
' g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}"));\n'
|
||||
' g_variant_builder_init_static (&invalidated_builder, G_VARIANT_TYPE ("as"));\n'
|
||||
"#else\n"
|
||||
' g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));\n'
|
||||
' g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));\n'
|
||||
"#endif\n"
|
||||
" for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)\n"
|
||||
" {\n"
|
||||
" ChangedProperty *cp = l->data;\n"
|
||||
|
Loading…
Reference in New Issue
Block a user