[json-glib/ebassi/for-master: 4/6] Drop or mark unused parameters




commit f6a1279a8e00fa52bb82733cccc633bc09ef83c0
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 11 11:50:00 2022 +0100

    Drop or mark unused parameters
    
    Avoid compiler warnings when running with `-Wunused-parameter`.

 json-glib/json-generator.c       |  4 +---
 json-glib/json-gobject.c         | 16 ++++++++++------
 json-glib/json-gvariant.c        | 15 +++++++++------
 json-glib/json-parser.c          |  2 +-
 json-glib/json-path.c            |  2 +-
 json-glib/json-serializable.c    |  8 ++++----
 json-glib/tests/array.c          |  2 +-
 json-glib/tests/object.c         |  2 +-
 json-glib/tests/serialize-full.c |  2 +-
 9 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/json-glib/json-generator.c b/json-glib/json-generator.c
index fc8dcfc..40e9b02 100644
--- a/json-glib/json-generator.c
+++ b/json-glib/json-generator.c
@@ -61,7 +61,6 @@ enum
 };
 
 static void   dump_value  (GString       *buffer,
-                           gint           level,
                            JsonNode      *node);
 static void   dump_array  (JsonGenerator *generator,
                            GString       *buffer,
@@ -316,7 +315,7 @@ dump_node (JsonGenerator *generator,
       break;
 
     case JSON_NODE_VALUE:
-      dump_value (buffer, level, node);
+      dump_value (buffer, node);
       break;
 
     case JSON_NODE_ARRAY:
@@ -333,7 +332,6 @@ dump_node (JsonGenerator *generator,
 
 static void
 dump_value (GString  *buffer,
-            gint      level,
             JsonNode *node)
 {
   const JsonValue *value;
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index 5b7331c..f783209 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -406,7 +406,7 @@ json_gobject_dump (GObject *gobject)
 
 gboolean
 json_deserialize_pspec (GValue     *value,
-                        GParamSpec *pspec,
+                        GParamSpec *pspec G_GNUC_UNUSED,
                         JsonNode   *node)
 {
   GValue node_value = { 0, };
@@ -655,7 +655,7 @@ json_deserialize_pspec (GValue     *value,
 
 JsonNode *
 json_serialize_pspec (const GValue *real_value,
-                      GParamSpec   *pspec)
+                      GParamSpec   *pspec G_GNUC_UNUSED)
 {
   JsonNode *retval = NULL;
   JsonNodeType node_type;
@@ -838,11 +838,11 @@ json_gobject_serialize (GObject *gobject)
  * json_construct_gobject:
  * @gtype: the type of the object to construct
  * @data: a JSON data stream
- * @length: length of the data stream
+ * @length: length of the data stream (unused)
  * @error: return location for a #GError, or %NULL
  *
  * Deserializes a JSON data stream and creates an instance of the given
- * type
+ * type.
  *
  * If the given type implements the [iface@Json.Serializable] interface, it
  * will be asked to deserialize all the JSON members into their respective
@@ -851,7 +851,11 @@ json_gobject_serialize (GObject *gobject)
  *
  * **Note**: the JSON data stream must be an object.
  *
- * Return value: (transfer full) (nullable): a new object instance of the given type
+ * For historical reasons, the `length` argument is unused. The given `data`
+ * must be a `NUL`-terminated string.
+ *
+ * Returns: (transfer full) (nullable): a new object instance of the given
+ *   type
  *
  * Since: 0.4
  *
@@ -860,7 +864,7 @@ json_gobject_serialize (GObject *gobject)
 GObject *
 json_construct_gobject (GType         gtype,
                         const gchar  *data,
-                        gsize         length,
+                        gsize         length G_GNUC_UNUSED,
                         GError      **error)
 {
   return json_gobject_from_data (gtype, data, strlen (data), error);
diff --git a/json-glib/json-gvariant.c b/json-glib/json-gvariant.c
index 31c8e13..2af98e7 100644
--- a/json-glib/json-gvariant.c
+++ b/json-glib/json-gvariant.c
@@ -490,24 +490,27 @@ json_node_assert_type (JsonNode       *json_node,
 }
 
 static void
-json_to_gvariant_foreach_add (gpointer data, gpointer user_data)
+json_to_gvariant_foreach_add (gpointer data,
+                              gpointer user_data)
 {
-  GVariantBuilder *builder = (GVariantBuilder *) user_data;
-  GVariant *child = (GVariant *) data;
+  GVariantBuilder *builder = user_data;
+  GVariant *child = data;
 
   g_variant_builder_add_value (builder, child);
 }
 
 static void
-json_to_gvariant_foreach_free (gpointer data, gpointer user_data)
+json_to_gvariant_foreach_free (gpointer data,
+                               gpointer user_data G_GNUC_UNUSED)
 {
-  GVariant *child = (GVariant *) data;
+  GVariant *child = data;
 
   g_variant_unref (child);
 }
 
 static GVariant *
-json_to_gvariant_build_from_glist (GList *list, const gchar *signature)
+json_to_gvariant_build_from_glist (GList      *list,
+                                   const char *signature)
 {
   GVariantBuilder *builder;
   GVariant *result;
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 1162ac6..3024a25 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -1556,7 +1556,7 @@ json_parser_load_from_stream_finish (JsonParser    *parser,
 
 static void
 read_from_stream (GTask *task,
-                  gpointer source_obj,
+                  gpointer source_obj G_GNUC_UNUSED,
                   gpointer task_data,
                   GCancellable *cancellable)
 {
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index a41d9b8..5e4c0ef 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -258,7 +258,7 @@ json_path_class_init (JsonPathClass *klass)
 }
 
 static void
-json_path_init (JsonPath *self)
+json_path_init (JsonPath *self G_GNUC_UNUSED)
 {
 }
 
diff --git a/json-glib/json-serializable.c b/json-glib/json-serializable.c
index de6c1c4..e19670b 100644
--- a/json-glib/json-serializable.c
+++ b/json-glib/json-serializable.c
@@ -113,8 +113,8 @@ json_serializable_deserialize_property (JsonSerializable *serializable,
 }
 
 static gboolean
-json_serializable_real_deserialize (JsonSerializable *serializable,
-                                    const gchar      *name,
+json_serializable_real_deserialize (JsonSerializable *serializable G_GNUC_UNUSED,
+                                    const gchar      *name G_GNUC_UNUSED,
                                     GValue           *value,
                                     GParamSpec       *pspec,
                                     JsonNode         *node)
@@ -128,8 +128,8 @@ json_serializable_real_deserialize (JsonSerializable *serializable,
 }
 
 static JsonNode *
-json_serializable_real_serialize (JsonSerializable *serializable,
-                                  const gchar      *name,
+json_serializable_real_serialize (JsonSerializable *serializable G_GNUC_UNUSED,
+                                  const gchar      *name G_GNUC_UNUSED,
                                   const GValue     *value,
                                   GParamSpec       *pspec)
 {
diff --git a/json-glib/tests/array.c b/json-glib/tests/array.c
index 5406916..421d333 100644
--- a/json-glib/tests/array.c
+++ b/json-glib/tests/array.c
@@ -94,7 +94,7 @@ static const struct {
 };
 
 static void
-verify_foreach (JsonArray *array,
+verify_foreach (JsonArray *array G_GNUC_UNUSED,
                 guint      index_,
                 JsonNode  *element_node,
                 gpointer   user_data)
diff --git a/json-glib/tests/object.c b/json-glib/tests/object.c
index 90e8bca..bc30841 100644
--- a/json-glib/tests/object.c
+++ b/json-glib/tests/object.c
@@ -123,7 +123,7 @@ static const struct {
 };
 
 static void
-verify_foreach (JsonObject  *object,
+verify_foreach (JsonObject  *object G_GNUC_UNUSED,
                 const gchar *member_name,
                 JsonNode    *member_node,
                 gpointer     user_data)
diff --git a/json-glib/tests/serialize-full.c b/json-glib/tests/serialize-full.c
index 42f189d..9e8d512 100644
--- a/json-glib/tests/serialize-full.c
+++ b/json-glib/tests/serialize-full.c
@@ -158,7 +158,7 @@ G_DEFINE_TYPE_WITH_CODE (TestObject, test_object, G_TYPE_OBJECT,
                                                 json_serializable_iface_init));
 
 static JsonNode *
-test_object_serialize_property (JsonSerializable *serializable,
+test_object_serialize_property (JsonSerializable *serializable G_GNUC_UNUSED,
                                 const gchar      *name,
                                 const GValue     *value,
                                 GParamSpec       *pspec)


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