[giggle] Improve startup time



commit 72dbad7a4b0db2bed612d8666a640ae66082f936
Author: Javier Jardón <jjardon gnome org>
Date:   Tue Mar 30 03:42:59 2010 +0200

    Improve startup time
    
    Use ->priv instead GET_PRIV() macro all the time in
    giggle_ref_* functions.

 libgiggle/giggle-ref.c |   27 +++++++++------------------
 libgiggle/giggle-ref.h |    3 +++
 2 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/libgiggle/giggle-ref.c b/libgiggle/giggle-ref.c
index 2b3a4f2..d264dea 100644
--- a/libgiggle/giggle-ref.c
+++ b/libgiggle/giggle-ref.c
@@ -24,9 +24,7 @@
 #include "giggle-revision.h"
 #include "giggle-ref.h"
 
-typedef struct GiggleRefPriv GiggleRefPriv;
-
-struct GiggleRefPriv {
+struct _GiggleRefPriv {
 	gchar          *name;
 	gchar          *sha;
 	GiggleRevision *revision;
@@ -51,8 +49,6 @@ enum {
 	PROP_HEAD,
 };
 
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIGGLE_TYPE_REF, GiggleRefPriv))
-
 static void
 giggle_ref_class_init (GiggleRefClass *class)
 {
@@ -93,6 +89,9 @@ giggle_ref_class_init (GiggleRefClass *class)
 static void
 giggle_ref_init (GiggleRef *ref)
 {
+	ref->priv = G_TYPE_INSTANCE_GET_PRIVATE (ref,
+	                                         GIGGLE_TYPE_REF,
+	                                         GiggleRefPriv);
 }
 
 static void
@@ -100,7 +99,7 @@ giggle_ref_finalize (GObject *object)
 {
 	GiggleRefPriv *priv;
 
-	priv = GET_PRIV (object);
+	priv = GIGGLE_REF (object)->priv;
 
 	g_free (priv->name);
 	g_free (priv->sha);
@@ -120,7 +119,7 @@ giggle_ref_get_property (GObject    *object,
 {
 	GiggleRefPriv *priv;
 
-	priv = GET_PRIV (object);
+	priv = GIGGLE_REF (object)->priv;
 
 	switch (param_id) {
 	case PROP_NAME:
@@ -146,7 +145,7 @@ giggle_ref_set_property (GObject      *object,
 {
 	GiggleRefPriv *priv;
 	
-	priv = GET_PRIV (object);
+	priv = GIGGLE_REF (object)->priv;
 
 	switch (param_id) {
 	case PROP_NAME:
@@ -180,23 +179,15 @@ giggle_ref_new (const gchar *name)
 G_CONST_RETURN gchar *
 giggle_ref_get_name (GiggleRef *ref)
 {
-	GiggleRefPriv *priv;
-
 	g_return_val_if_fail (GIGGLE_IS_REF (ref), NULL);
 
-	priv = GET_PRIV (ref);
-
-	return priv->name;
+	return ref->priv->name;
 }
 
 G_CONST_RETURN gchar *
 giggle_ref_get_sha (GiggleRef *ref)
 {
-	GiggleRefPriv *priv;
-
 	g_return_val_if_fail (GIGGLE_IS_REF (ref), NULL);
 
-	priv = GET_PRIV (ref);
-
-	return priv->sha;
+	return ref->priv->sha;
 }
diff --git a/libgiggle/giggle-ref.h b/libgiggle/giggle-ref.h
index 09b73d7..a278100 100644
--- a/libgiggle/giggle-ref.h
+++ b/libgiggle/giggle-ref.h
@@ -34,9 +34,12 @@ G_BEGIN_DECLS
 
 typedef struct _GiggleRef      GiggleRef;
 typedef struct _GiggleRefClass GiggleRefClass;
+typedef struct _GiggleRefPriv  GiggleRefPriv;
 
 struct _GiggleRef {
 	GObject parent_instance;
+
+	GiggleRefPriv *priv;
 };
 
 struct _GiggleRefClass {



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