[gnome-software: 27/29] gs-plugin: Drop gs_plugin_alloc_data()




commit 109b43576ec86b7e87506ee257e4630a1f6cfaa2
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Oct 11 18:11:28 2021 +0100

    gs-plugin: Drop gs_plugin_alloc_data()
    
    It’s no longer used by the plugins. They use their own private data in
    classes derived from `GsPlugin`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-plugin-private.h |  1 -
 lib/gs-plugin.c         | 59 -------------------------------------------------
 lib/gs-plugin.h         |  5 -----
 3 files changed, 65 deletions(-)
---
diff --git a/lib/gs-plugin-private.h b/lib/gs-plugin-private.h
index d958371b2..61d98d092 100644
--- a/lib/gs-plugin-private.h
+++ b/lib/gs-plugin-private.h
@@ -24,7 +24,6 @@ const gchar   *gs_plugin_action_to_string             (GsPluginAction  action);
 GsPluginAction  gs_plugin_action_from_string           (const gchar    *action);
 const gchar    *gs_plugin_action_to_function_name      (GsPluginAction  action);
 
-void            gs_plugin_clear_data                   (GsPlugin       *plugin);
 void            gs_plugin_set_scale                    (GsPlugin       *plugin,
                                                         guint           scale);
 guint           gs_plugin_get_order                    (GsPlugin       *plugin);
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index ee4844f15..767bb2332 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -52,7 +52,6 @@ typedef struct
        GHashTable              *cache;
        GMutex                   cache_mutex;
        GModule                 *module;
-       GsPluginData            *data;                  /* for gs-plugin-{name}.c */
        GsPluginFlags            flags;
        SoupSession             *soup_session;
        GPtrArray               *rules[GS_PLUGIN_RULE_LAST];
@@ -220,7 +219,6 @@ gs_plugin_finalize (GObject *object)
                g_source_remove (priv->timer_id);
        g_free (priv->name);
        g_free (priv->appstream_id);
-       g_free (priv->data);
        g_free (priv->language);
        if (priv->soup_session != NULL)
                g_object_unref (priv->soup_session);
@@ -240,63 +238,6 @@ gs_plugin_finalize (GObject *object)
        G_OBJECT_CLASS (gs_plugin_parent_class)->finalize (object);
 }
 
-/**
- * gs_plugin_get_data:
- * @plugin: a #GsPlugin
- *
- * Gets the private data for the plugin if gs_plugin_alloc_data() has
- * been called.
- *
- * Returns: the #GsPluginData, or %NULL
- *
- * Since: 3.22
- **/
-GsPluginData *
-gs_plugin_get_data (GsPlugin *plugin)
-{
-       GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
-       g_assert (priv->data != NULL);
-       return priv->data;
-}
-
-/**
- * gs_plugin_alloc_data:
- * @plugin: a #GsPlugin
- * @sz: the size of data to allocate, e.g. `sizeof(FooPluginPrivate)`
- *
- * Allocates a private data area for the plugin which can be retrieved
- * using gs_plugin_get_data().
- * This is normally called in gs_plugin_initialize() and the data should
- * not be manually freed.
- *
- * Returns: the #GsPluginData, cleared to NUL bytes
- *
- * Since: 3.22
- **/
-GsPluginData *
-gs_plugin_alloc_data (GsPlugin *plugin, gsize sz)
-{
-       GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
-       g_assert (priv->data == NULL);
-       priv->data = g_malloc0 (sz);
-       return priv->data;
-}
-
-/**
- * gs_plugin_clear_data:
- * @plugin: a #GsPlugin
- *
- * Clears and resets the private data. Only run this from the self tests.
- **/
-void
-gs_plugin_clear_data (GsPlugin *plugin)
-{
-       GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
-       if (priv->data == NULL)
-               return;
-       g_clear_pointer (&priv->data, g_free);
-}
-
 /**
  * gs_plugin_get_symbol: (skip)
  * @plugin: a #GsPlugin
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index fbd64ee27..b4c529324 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -48,17 +48,12 @@ struct _GsPluginClass
        gpointer                 padding[24];
 };
 
-typedef struct GsPluginData    GsPluginData;
-
 /* helpers */
 #define        GS_PLUGIN_ERROR                                 gs_plugin_error_quark ()
 
 GQuark          gs_plugin_error_quark                  (void);
 
 /* public getters and setters */
-GsPluginData   *gs_plugin_alloc_data                   (GsPlugin       *plugin,
-                                                        gsize           sz);
-GsPluginData   *gs_plugin_get_data                     (GsPlugin       *plugin);
 const gchar    *gs_plugin_get_name                     (GsPlugin       *plugin);
 const gchar    *gs_plugin_get_appstream_id             (GsPlugin       *plugin);
 void            gs_plugin_set_appstream_id             (GsPlugin       *plugin,


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