[gnome-online-accounts] mail-auth: Drop the priv pointer
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] mail-auth: Drop the priv pointer
- Date: Tue, 5 Dec 2017 18:44:10 +0000 (UTC)
commit 5289de6aec1c725f4ca3b053e699c961491bfa05
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Nov 22 17:44:25 2017 +0100
mail-auth: Drop the priv pointer
The current GObject recommendation is to use the generated
get_instance_private function instead of a separate priv pointer in the
instance struct. This saves one pointer per class in the hierarchy
multiplied by the number of instances of the type, and the function is
fast enough because it only does pointer arithmetic.
src/goabackend/goamailauth.c | 31 +++++++++++++++++++++++--------
src/goabackend/goamailauth.h | 1 -
2 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/goabackend/goamailauth.c b/src/goabackend/goamailauth.c
index d657cdb..1f9ceb6 100644
--- a/src/goabackend/goamailauth.c
+++ b/src/goabackend/goamailauth.c
@@ -77,7 +77,9 @@ static void
goa_mail_auth_dispose (GObject *object)
{
GoaMailAuth *self = GOA_MAIL_AUTH (object);
- GoaMailAuthPrivate *priv = self->priv;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
g_clear_object (&priv->input);
g_clear_object (&priv->output);
@@ -92,7 +94,9 @@ goa_mail_auth_get_property (GObject *object,
GParamSpec *pspec)
{
GoaMailAuth *self = GOA_MAIL_AUTH (object);
- GoaMailAuthPrivate *priv = self->priv;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
switch (prop_id)
{
@@ -117,7 +121,9 @@ goa_mail_auth_set_property (GObject *object,
GParamSpec *pspec)
{
GoaMailAuth *self = GOA_MAIL_AUTH (object);
- GoaMailAuthPrivate *priv = self->priv;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
switch (prop_id)
{
@@ -140,7 +146,6 @@ goa_mail_auth_set_property (GObject *object,
static void
goa_mail_auth_init (GoaMailAuth *self)
{
- self->priv = goa_mail_auth_get_instance_private (self);
}
static void
@@ -287,14 +292,19 @@ goa_mail_auth_starttls_finish (GoaMailAuth *self,
GDataInputStream *
goa_mail_auth_get_input (GoaMailAuth *self)
{
- return self->priv->input;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
+ return priv->input;
}
void
goa_mail_auth_set_input (GoaMailAuth *self,
GDataInputStream *input)
{
- GoaMailAuthPrivate *priv = self->priv;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
if (priv->input == input)
return;
@@ -307,14 +317,19 @@ goa_mail_auth_set_input (GoaMailAuth *self,
GDataOutputStream *
goa_mail_auth_get_output (GoaMailAuth *self)
{
- return self->priv->output;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
+ return priv->output;
}
void
goa_mail_auth_set_output (GoaMailAuth *self,
GDataOutputStream *output)
{
- GoaMailAuthPrivate *priv = self->priv;
+ GoaMailAuthPrivate *priv;
+
+ priv = goa_mail_auth_get_instance_private (self);
if (priv->output == output)
return;
diff --git a/src/goabackend/goamailauth.h b/src/goabackend/goamailauth.h
index 7a35d98..d9e3a03 100644
--- a/src/goabackend/goamailauth.h
+++ b/src/goabackend/goamailauth.h
@@ -44,7 +44,6 @@ struct _GoaMailAuth
{
/*< private >*/
GObject parent_instance;
- GoaMailAuthPrivate *priv;
};
struct _GoaMailAuthClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]