Revision: 4798 http://geany.svn.sourceforge.net/geany/?rev=4798&view=rev Author: ntrel Date: 2010-04-01 15:57:19 +0000 (Thu, 01 Apr 2010)
Log Message: ----------- Cache G_TYPE_INSTANCE_GET_PRIVATE() result when initializing an object for efficiency.
Modified Paths: -------------- trunk/ChangeLog trunk/src/geanyentryaction.c trunk/src/geanyentryaction.h trunk/src/geanymenubuttonaction.c trunk/src/geanymenubuttonaction.h trunk/src/geanywraplabel.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/ChangeLog 2010-04-01 15:57:19 UTC (rev 4798) @@ -1,3 +1,12 @@ +2010-04-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/geanymenubuttonaction.c, src/geanymenubuttonaction.h, + src/geanyentryaction.c, src/geanyentryaction.h, + src/geanywraplabel.c: + Cache G_TYPE_INSTANCE_GET_PRIVATE() result when initializing an + object for efficiency. + + 2010-03-31 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/classbuilder.c:
Modified: trunk/src/geanyentryaction.c =================================================================== --- trunk/src/geanyentryaction.c 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/src/geanyentryaction.c 2010-04-01 15:57:19 UTC (rev 4798) @@ -33,8 +33,7 @@
typedef struct _GeanyEntryActionPrivate GeanyEntryActionPrivate;
-#define GEANY_ENTRY_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ - GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionPrivate)) +#define GEANY_ENTRY_ACTION_GET_PRIVATE(obj) (GEANY_ENTRY_ACTION(obj)->priv)
struct _GeanyEntryActionPrivate @@ -147,8 +146,12 @@
static void geany_entry_action_init(GeanyEntryAction *action) { - GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action); + GeanyEntryActionPrivate *priv;
+ action->priv = G_TYPE_INSTANCE_GET_PRIVATE(action, + GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionPrivate); + + priv = action->priv; priv->entry = NULL; priv->numeric = FALSE; }
Modified: trunk/src/geanyentryaction.h =================================================================== --- trunk/src/geanyentryaction.h 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/src/geanyentryaction.h 2010-04-01 15:57:19 UTC (rev 4798) @@ -38,9 +38,12 @@ typedef struct _GeanyEntryAction GeanyEntryAction; typedef struct _GeanyEntryActionClass GeanyEntryActionClass;
+struct _GeanyEntryActionPrivate; + struct _GeanyEntryAction { GtkAction parent; + struct _GeanyEntryActionPrivate *priv; };
struct _GeanyEntryActionClass
Modified: trunk/src/geanymenubuttonaction.c =================================================================== --- trunk/src/geanymenubuttonaction.c 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/src/geanymenubuttonaction.c 2010-04-01 15:57:19 UTC (rev 4798) @@ -32,8 +32,7 @@
typedef struct _GeanyMenubuttonActionPrivate GeanyMenubuttonActionPrivate;
-#define GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ - GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionPrivate)) +#define GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(obj) (GEANY_MENU_BUTTON_ACTION(obj)->priv)
struct _GeanyMenubuttonActionPrivate @@ -159,7 +158,12 @@
static void geany_menu_button_action_init(GeanyMenubuttonAction *action) { - GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action); + GeanyMenubuttonActionPrivate *priv; + + action->priv = G_TYPE_INSTANCE_GET_PRIVATE(action, + GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionPrivate); + + priv = action->priv; priv->tooltip_arrow = NULL; priv->menu = NULL; }
Modified: trunk/src/geanymenubuttonaction.h =================================================================== --- trunk/src/geanymenubuttonaction.h 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/src/geanymenubuttonaction.h 2010-04-01 15:57:19 UTC (rev 4798) @@ -38,9 +38,12 @@ typedef struct _GeanyMenubuttonAction GeanyMenubuttonAction; typedef struct _GeanyMenubuttonActionClass GeanyMenubuttonActionClass;
+struct _GeanyMenubuttonActionPrivate; + struct _GeanyMenubuttonAction { GtkAction parent; + struct _GeanyMenubuttonActionPrivate *priv; };
struct _GeanyMenubuttonActionClass
Modified: trunk/src/geanywraplabel.c =================================================================== --- trunk/src/geanywraplabel.c 2010-04-01 15:55:13 UTC (rev 4797) +++ trunk/src/geanywraplabel.c 2010-04-01 15:57:19 UTC (rev 4798) @@ -33,8 +33,7 @@
-#define GEANY_WRAP_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),\ - GEANY_WRAP_LABEL_TYPE, GeanyWrapLabelPrivate)) +#define GEANY_WRAP_LABEL_GET_PRIVATE(obj) (GEANY_WRAP_LABEL(obj)->priv)
struct _GeanyWrapLabelClass @@ -42,17 +41,18 @@ GtkLabelClass parent_class; };
+typedef struct +{ + gsize wrap_width; +} GeanyWrapLabelPrivate; + struct _GeanyWrapLabel { GtkLabel parent; + GeanyWrapLabelPrivate *priv; };
-typedef struct -{ - gsize wrap_width; -} GeanyWrapLabelPrivate;
- static void geany_wrap_label_size_request (GtkWidget *widget, GtkRequisition *req); static void geany_wrap_label_size_allocate (GtkWidget *widget, GtkAllocation *alloc); static void geany_wrap_label_set_wrap_width (GtkWidget *widget, gsize width); @@ -73,8 +73,12 @@
static void geany_wrap_label_init(GeanyWrapLabel *self) { - GeanyWrapLabelPrivate *priv = GEANY_WRAP_LABEL_GET_PRIVATE(self); + GeanyWrapLabelPrivate *priv;
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, + GEANY_WRAP_LABEL_TYPE, GeanyWrapLabelPrivate); + + priv = self->priv; priv->wrap_width = 0; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.