Skip to content

Commit

Permalink
g_type_class_add_private is deprecated since glib 2.58
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabber committed May 13, 2019
1 parent 02a3a9a commit 88a1c63
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
26 changes: 12 additions & 14 deletions loudmouth/lm-asyncns-resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
#include "lm-misc.h"
#include "lm-asyncns-resolver.h"

#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_ASYNCNS_RESOLVER, LmAsyncnsResolverPriv))
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_ASYNCNS_RESOLVER, LmAsyncnsResolverPrivate))

typedef struct LmAsyncnsResolverPriv LmAsyncnsResolverPriv;
struct LmAsyncnsResolverPriv {
typedef struct LmAsyncnsResolverPrivate LmAsyncnsResolverPrivate;
struct LmAsyncnsResolverPrivate {
GSource *watch_resolv;
asyncns_query_t *resolv_query;
asyncns_t *asyncns_ctx;
Expand All @@ -53,7 +53,7 @@ static void asyncns_resolver_lookup (LmResolver *resolver);
static void asyncns_resolver_cleanup (LmResolver *resolver);
static void asyncns_resolver_cancel (LmResolver *resolver);

G_DEFINE_TYPE (LmAsyncnsResolver, lm_asyncns_resolver, LM_TYPE_RESOLVER)
G_DEFINE_TYPE_WITH_PRIVATE (LmAsyncnsResolver, lm_asyncns_resolver, LM_TYPE_RESOLVER)

static void
lm_asyncns_resolver_class_init (LmAsyncnsResolverClass *class)
Expand All @@ -65,8 +65,6 @@ lm_asyncns_resolver_class_init (LmAsyncnsResolverClass *class)

resolver_class->lookup = asyncns_resolver_lookup;
resolver_class->cancel = asyncns_resolver_cancel;

g_type_class_add_private (object_class, sizeof (LmAsyncnsResolverPriv));
}

static void
Expand All @@ -87,7 +85,7 @@ asyncns_resolver_dispose (GObject *object)
static void
asyncns_resolver_cleanup (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);

if (priv->resolv_channel != NULL) {
g_io_channel_unref (priv->resolv_channel);
Expand All @@ -110,7 +108,7 @@ asyncns_resolver_cleanup (LmResolver *resolver)
static void
asyncns_resolver_done (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
struct addrinfo *ans;
int err;

Expand Down Expand Up @@ -142,7 +140,7 @@ asyncns_resolver_io_cb (GSource *source,
GIOCondition condition,
LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
LmAsyncnsResolverCallback func;

asyncns_wait (priv->asyncns_ctx, FALSE);
Expand All @@ -159,7 +157,7 @@ asyncns_resolver_io_cb (GSource *source,
static gboolean
asyncns_resolver_prep (LmResolver *resolver, GError **error)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
GMainContext *context;

if (priv->asyncns_ctx) {
Expand Down Expand Up @@ -193,7 +191,7 @@ asyncns_resolver_prep (LmResolver *resolver, GError **error)
static void
asyncns_resolver_lookup_host (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
gchar *host;
struct addrinfo req;

Expand Down Expand Up @@ -226,7 +224,7 @@ asyncns_resolver_lookup_host (LmResolver *resolver)
static void
asyncns_resolver_srv_done (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
unsigned char *srv_ans;
int srv_len;
gboolean result = FALSE;
Expand Down Expand Up @@ -281,7 +279,7 @@ asyncns_resolver_srv_done (LmResolver *resolver)
static void
asyncns_resolver_lookup_service (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv = GET_PRIV (resolver);
LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver);
gchar *domain;
gchar *service;
gchar *protocol;
Expand Down Expand Up @@ -348,7 +346,7 @@ asyncns_resolver_lookup (LmResolver *resolver)
static void
asyncns_resolver_cancel (LmResolver *resolver)
{
LmAsyncnsResolverPriv *priv;
LmAsyncnsResolverPrivate *priv;

g_return_if_fail (LM_IS_ASYNCNS_RESOLVER (resolver));

Expand Down
14 changes: 6 additions & 8 deletions loudmouth/lm-dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "lm-marshal.h"
#include "lm-dummy.h"

#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmDummyPriv))
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmDummyPrivate))

typedef struct LmDummyPriv LmDummyPriv;
struct LmDummyPriv {
typedef struct LmDummyPrivate LmDummyPrivate;
struct LmDummyPrivate {
gint my_prop;
};

Expand All @@ -38,7 +38,7 @@ static void dummy_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);

G_DEFINE_TYPE (LmDummy, lm_dummy, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (LmDummy, lm_dummy, G_TYPE_OBJECT)

enum {
PROP_0,
Expand Down Expand Up @@ -78,8 +78,6 @@ lm_dummy_class_init (LmDummyClass *class)
_lm_marshal_VOID__INT,
G_TYPE_NONE,
1, G_TYPE_INT);

g_type_class_add_private (object_class, sizeof (LmDummyPriv));
}

static void
Expand All @@ -102,7 +100,7 @@ dummy_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
LmDummyPriv *priv;
LmDummyPrivate *priv;

priv = GET_PRIV (object);

Expand All @@ -122,7 +120,7 @@ dummy_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
LmDummyPriv *priv;
LmDummyPrivate *priv;

priv = GET_PRIV (object);

Expand Down
13 changes: 6 additions & 7 deletions loudmouth/lm-simple-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include "lm-xmpp-writer.h"
#include "lm-simple-io.h"

#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOPriv))
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOPrivate))

typedef struct LmSimpleIOPriv LmSimpleIOPriv;
struct LmSimpleIOPriv {
typedef struct LmSimpleIOPrivate LmSimpleIOPrivate;
struct LmSimpleIOPrivate {
gint my_prop;
};

Expand All @@ -46,6 +46,7 @@ static void simple_io_send_text (LmXmppWriter *writer,
gsize len);

G_DEFINE_TYPE_WITH_CODE (LmSimpleIO, lm_simple_io, G_TYPE_OBJECT,
G_ADD_PRIVATE (LmSimpleIO)
G_IMPLEMENT_INTERFACE (LM_TYPE_XMPP_WRITER,
simple_io_writer_iface_init))

Expand All @@ -70,8 +71,6 @@ lm_simple_io_class_init (LmSimpleIOClass *class)
"My Property",
NULL,
G_PARAM_READWRITE));

g_type_class_add_private (object_class, sizeof (LmSimpleIOPriv));
}

static void
Expand Down Expand Up @@ -101,7 +100,7 @@ simple_io_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
LmSimpleIOPriv *priv;
LmSimpleIOPrivate *priv;

priv = GET_PRIV (object);

Expand All @@ -121,7 +120,7 @@ simple_io_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
LmSimpleIOPriv *priv;
LmSimpleIOPrivate *priv;

priv = GET_PRIV (object);

Expand Down

0 comments on commit 88a1c63

Please sign in to comment.