[gtk+/portal] Avoid a strdup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/portal] Avoid a strdup
- Date: Thu, 7 Jul 2016 03:29:47 +0000 (UTC)
commit f9bb3296a88e6931b7ec55b0fbd26d97feccbb6a
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 6 21:05:24 2016 -0400
Avoid a strdup
We can use g_variant_new_take_string to avoid a strdup here.
gtk/gtkpagesetup.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpagesetup.c b/gtk/gtkpagesetup.c
index 22885ed..1c12adb 100644
--- a/gtk/gtkpagesetup.c
+++ b/gtk/gtkpagesetup.c
@@ -883,8 +883,7 @@ gtk_page_setup_to_gvariant (GtkPageSetup *setup)
orientation = enum_to_string (GTK_TYPE_PAGE_ORIENTATION,
gtk_page_setup_get_orientation (setup));
- g_variant_builder_add (&builder, "{sv}", "Orientation", g_variant_new_string (orientation));
- g_free (orientation);
+ g_variant_builder_add (&builder, "{sv}", "Orientation", g_variant_new_take_string (orientation));
return g_variant_builder_end (&builder);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]