Commit db3a7dc7 authored by Christian Hergert's avatar Christian Hergert
Browse files

build-tools: avoid va_args for property sets

To avoid copying the string into a new GValue, we just create the gvalue
up front and allow it to own the generated string. This allows us to
also avoid the va_list g_object_set() calls for a very slight performance
improvement.
parent 5d740712
......@@ -314,10 +314,15 @@ gbp_build_panel_text_func (GtkCellLayout *layout,
gpointer user_data)
{
g_autoptr(IdeDiagnostic) diagnostic = NULL;
g_auto(GValue) value = { 0 };
gtk_tree_model_get (model, iter, 0, &diagnostic, -1);
gtk_tree_model_get (model, iter,
COLUMN_DIAGNOSTIC, &diagnostic,
-1);
g_value_init (&value, G_TYPE_STRING);
if (diagnostic != NULL)
if G_LIKELY (diagnostic != NULL)
{
GString *str;
const gchar *text;
......@@ -356,12 +361,13 @@ gbp_build_panel_text_func (GtkCellLayout *layout,
if (text != NULL)
g_string_append (str, text);
g_object_set (renderer, "markup", str->str, NULL);
g_value_take_string (&value, g_string_free (str, FALSE));
g_object_set_property (G_OBJECT (renderer), "markup", &value);
g_string_free (str, TRUE);
return;
}
else
g_object_set (renderer, "text", NULL, NULL);
g_object_set_property (G_OBJECT (renderer), "text", &value);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment