[giggle] GiggleRevision: Set properties directly



commit 733fc2210051f02aa27693f5ecc8255cbb92c2a4
Author: Edward Hervey <bilboed bilboed com>
Date:   Thu Apr 1 09:59:22 2010 +0200

    GiggleRevision: Set properties directly
    
    Going through g_object_set just adds extra overhead for nothing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614546

 libgiggle/giggle-revision.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/libgiggle/giggle-revision.c b/libgiggle/giggle-revision.c
index bd602e5..9042846 100644
--- a/libgiggle/giggle-revision.c
+++ b/libgiggle/giggle-revision.c
@@ -259,7 +259,10 @@ giggle_revision_set_author (GiggleRevision *revision,
 {
 	g_return_if_fail (GIGGLE_IS_REVISION (revision));
 	g_return_if_fail (GIGGLE_IS_AUTHOR (author) | !author);
-	g_object_set (revision, "author", author, NULL);
+
+	if (revision->priv->author)
+		g_object_unref (revision->priv->author);
+	revision->priv->author = g_object_ref (author);
 }
 
 GiggleAuthor *
@@ -276,7 +279,10 @@ giggle_revision_set_committer (GiggleRevision *revision,
 {
 	g_return_if_fail (GIGGLE_IS_REVISION (revision));
 	g_return_if_fail (GIGGLE_IS_AUTHOR (committer) | !committer);
-	g_object_set (revision, "committer", committer, NULL);
+
+	if (revision->priv->committer)
+		g_object_unref (revision->priv->committer);
+	revision->priv->committer = g_object_ref (committer);
 }
 
 const struct tm *
@@ -293,7 +299,9 @@ giggle_revision_set_date (GiggleRevision  *revision,
 {
 	g_return_if_fail (GIGGLE_IS_REVISION (revision));
 	g_return_if_fail (NULL != date);
-	g_object_set (revision, "date", date, NULL);
+
+	g_free (revision->priv->date);
+	revision->priv->date = date;
 }
 
 const gchar *
@@ -309,7 +317,9 @@ giggle_revision_set_short_log (GiggleRevision *revision,
 			       const char     *short_log)
 {
 	g_return_if_fail (GIGGLE_IS_REVISION (revision));
-	g_object_set (revision, "short-log", short_log, NULL);
+
+	g_free (revision->priv->short_log);
+	revision->priv->short_log = g_strdup (short_log);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]