[libsoup/hsts: 8/36] Use G_ADD_PRIVATE instead of deprecated private helpers



commit 00dffeb1725e70dd65636c4000d36f0437f47351
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Aug 16 12:37:22 2018 +0300

    Use G_ADD_PRIVATE instead of deprecated private helpers

 libsoup/soup-hsts-enforcer-db.c |  9 +++------
 libsoup/soup-hsts-enforcer.c    | 15 ++++++---------
 2 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/libsoup/soup-hsts-enforcer-db.c b/libsoup/soup-hsts-enforcer-db.c
index 21104b6b..d01bb368 100644
--- a/libsoup/soup-hsts-enforcer-db.c
+++ b/libsoup/soup-hsts-enforcer-db.c
@@ -40,16 +40,15 @@ struct _SoupHSTSEnforcerDBPrivate {
        sqlite3 *db;
 };
 
-#define SOUP_HSTS_ENFORCER_DB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_HSTS_ENFORCER_DB, 
SoupHSTSEnforcerDBPrivate))
-
-G_DEFINE_TYPE (SoupHSTSEnforcerDB, soup_hsts_enforcer_db, SOUP_TYPE_HSTS_ENFORCER)
+G_DEFINE_TYPE_WITH_CODE (SoupHSTSEnforcerDB, soup_hsts_enforcer_db, SOUP_TYPE_HSTS_ENFORCER,
+                        G_ADD_PRIVATE(SoupHSTSEnforcerDB))
 
 static void load (SoupHSTSEnforcer *hsts_enforcer);
 
 static void
 soup_hsts_enforcer_db_init (SoupHSTSEnforcerDB *db)
 {
-       db->priv = SOUP_HSTS_ENFORCER_DB_GET_PRIVATE (db);
+       db->priv = soup_hsts_enforcer_db_get_instance_private (db);
 }
 
 static void
@@ -307,8 +306,6 @@ soup_hsts_enforcer_db_class_init (SoupHSTSEnforcerDBClass *db_class)
                SOUP_HSTS_ENFORCER_CLASS (db_class);
        GObjectClass *object_class = G_OBJECT_CLASS (db_class);
 
-       g_type_class_add_private (db_class, sizeof (SoupHSTSEnforcerDBPrivate));
-
        hsts_enforcer_class->is_persistent = soup_hsts_enforcer_db_is_persistent;
        hsts_enforcer_class->has_valid_policy = soup_hsts_enforcer_db_has_valid_policy;
        hsts_enforcer_class->changed       = soup_hsts_enforcer_db_changed;
diff --git a/libsoup/soup-hsts-enforcer.c b/libsoup/soup-hsts-enforcer.c
index e19668dc..0871bf5a 100644
--- a/libsoup/soup-hsts-enforcer.c
+++ b/libsoup/soup-hsts-enforcer.c
@@ -50,10 +50,6 @@
 
 static void soup_hsts_enforcer_session_feature_init (SoupSessionFeatureInterface *feature_interface, 
gpointer interface_data);
 
-G_DEFINE_TYPE_WITH_CODE (SoupHSTSEnforcer, soup_hsts_enforcer, G_TYPE_OBJECT,
-                        G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
-                                               soup_hsts_enforcer_session_feature_init))
-
 enum {
        CHANGED,
        LAST_SIGNAL
@@ -66,12 +62,15 @@ struct _SoupHSTSEnforcerPrivate {
        GHashTable *session_policies;
 };
 
-#define SOUP_HSTS_ENFORCER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_HSTS_ENFORCER, 
SoupHSTSEnforcerPrivate))
+G_DEFINE_TYPE_WITH_CODE (SoupHSTSEnforcer, soup_hsts_enforcer, G_TYPE_OBJECT,
+                        G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
+                                               soup_hsts_enforcer_session_feature_init)
+                        G_ADD_PRIVATE(SoupHSTSEnforcer))
 
 static void
 soup_hsts_enforcer_init (SoupHSTSEnforcer *hsts_enforcer)
 {
-       hsts_enforcer->priv = SOUP_HSTS_ENFORCER_GET_PRIVATE (hsts_enforcer);
+       hsts_enforcer->priv = soup_hsts_enforcer_get_instance_private (hsts_enforcer);
 
        hsts_enforcer->priv->host_policies = g_hash_table_new_full (soup_str_case_hash,
                                                                    soup_str_case_equal,
@@ -143,8 +142,6 @@ soup_hsts_enforcer_class_init (SoupHSTSEnforcerClass *hsts_enforcer_class)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (hsts_enforcer_class);
 
-       g_type_class_add_private (hsts_enforcer_class, sizeof (SoupHSTSEnforcerPrivate));
-
        object_class->finalize = soup_hsts_enforcer_finalize;
 
        hsts_enforcer_class->is_persistent = soup_hsts_enforcer_real_is_persistent;
@@ -469,7 +466,7 @@ static void
 rewrite_message_uri_to_https (SoupMessage *msg)
 {
        SoupURI *uri;
-       uint original_port;
+       guint original_port;
 
        uri = soup_uri_copy (soup_message_get_uri (msg));
 


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