[folks/wip/ricotz/vala] folks-generics: Add missing generic type argument




commit c44d8e323affd7f1043f300f3325b358cd5b5f0b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Jan 30 19:42:32 2022 +0100

    folks-generics: Add missing generic type argument

 folks/folks-generics.vapi |  2 +-
 folks/small-set.c         | 15 ++++-----------
 folks/small-set.h         |  5 ++++-
 3 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/folks/folks-generics.vapi b/folks/folks-generics.vapi
index 389025b6..c8a06e96 100644
--- a/folks/folks-generics.vapi
+++ b/folks/folks-generics.vapi
@@ -37,7 +37,7 @@ namespace Folks
     internal SmallSet (owned Gee.HashDataFunc<G>? item_hash = null,
         owned Gee.EqualDataFunc<G>? item_equals = null);
 
-    internal static SmallSet<G> copy (Gee.Iterable<G> iterable,
+    internal static SmallSet<G> copy<G> (Gee.Iterable<G> iterable,
         owned Gee.HashDataFunc<G>? item_hash = null,
         owned Gee.EqualDataFunc<G>? item_equals = null);
 
diff --git a/folks/small-set.c b/folks/small-set.c
index b5a19683..39790755 100644
--- a/folks/small-set.c
+++ b/folks/small-set.c
@@ -337,7 +337,10 @@ _folks_small_set_new_take_array (GPtrArray *arr,
  * Returns: (transfer full):
  */
 FolksSmallSet *
-folks_small_set_copy (GeeIterable *iterable,
+folks_small_set_copy (GType item_type,
+    GBoxedCopyFunc item_dup,
+    GDestroyNotify item_free,
+    GeeIterable *iterable,
     GeeHashDataFunc item_hash,
     gpointer item_hash_data,
     GDestroyNotify item_hash_data_free,
@@ -347,10 +350,6 @@ folks_small_set_copy (GeeIterable *iterable,
 {
   FolksSmallSet *self;
   GeeIterator *iter;
-  GeeTraversableIface *traversable_iface;
-  GType item_type;
-  GBoxedCopyFunc item_dup;
-  GDestroyNotify item_free;
 
   /* Deliberately not allowing for subclasses here: this class is not
    * subclassable, and it's slower if we do check for subclasses. */
@@ -376,12 +375,6 @@ folks_small_set_copy (GeeIterable *iterable,
       return self;
     }
 
-  traversable_iface = GEE_TRAVERSABLE_GET_INTERFACE (iterable);
-  g_assert (traversable_iface != NULL);
-  item_type = traversable_iface->get_g_type ((GeeTraversable *) iterable);
-  item_dup = traversable_iface->get_g_dup_func ((GeeTraversable *) iterable);
-  item_free = traversable_iface->get_g_destroy_func ((GeeTraversable *) iterable);
-
   self = folks_small_set_new (item_type, item_dup, item_free,
       item_hash, item_hash_data, item_hash_data_free,
       item_equals, item_equals_data, item_equals_data_free);
diff --git a/folks/small-set.h b/folks/small-set.h
index e61f387e..5df54ce3 100644
--- a/folks/small-set.h
+++ b/folks/small-set.h
@@ -68,7 +68,10 @@ folks_small_set_empty (GType item_type,
     GBoxedCopyFunc item_dup,
     GDestroyNotify item_free);
 
-FolksSmallSet *folks_small_set_copy (GeeIterable *iterable,
+FolksSmallSet *folks_small_set_copy (GType item_type,
+    GBoxedCopyFunc item_dup,
+    GDestroyNotify item_free,
+    GeeIterable *iterable,
     GeeHashDataFunc item_hash,
     gpointer item_hash_data,
     GDestroyNotify item_hash_data_free,


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