[pygobject] Always pass along the callable cache to the arg cache constructors



commit 0d09234ea0399d756ee3fb0d358fab5b0a145657
Author: Garrett Regier <Garrett Regier riftio com>
Date:   Wed Aug 6 11:53:39 2014 -0400

    Always pass along the callable cache to the arg cache constructors
    
    This will be needed in a future patch which requires that the callable
    cache is always available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727004

 gi/pygi-array.c     |   20 ++++++++++++--------
 gi/pygi-array.h     |    9 +++++----
 gi/pygi-cache.c     |   34 ++++++++++++++++++++--------------
 gi/pygi-cache.h     |    7 ++++---
 gi/pygi-hashtable.c |   31 +++++++++++++++++--------------
 gi/pygi-hashtable.h |    9 +++++----
 gi/pygi-list.c      |   30 +++++++++++++++++++-----------
 gi/pygi-list.h      |    9 +++++----
 gi/pygi-object.c    |   25 ++++++++++++++-----------
 gi/pygi-object.h    |    3 ++-
 10 files changed, 103 insertions(+), 74 deletions(-)
---
diff --git a/gi/pygi-array.c b/gi/pygi-array.c
index 9dff53b..1db04ee 100644
--- a/gi/pygi-array.c
+++ b/gi/pygi-array.c
@@ -831,11 +831,12 @@ pygi_arg_garray_len_arg_setup (PyGIArgCache *arg_cache,
 }
 
 static gboolean
-pygi_arg_garray_setup (PyGIArgGArray      *sc,
-                       GITypeInfo         *type_info,
-                       GIArgInfo          *arg_info,    /* may be NULL for return arguments */
-                       GITransfer          transfer,
-                       PyGIDirection       direction)
+pygi_arg_garray_setup (PyGIArgGArray     *sc,
+                       GITypeInfo        *type_info,
+                       GIArgInfo         *arg_info,    /* may be NULL for return arguments */
+                       GITransfer         transfer,
+                       PyGIDirection      direction,
+                       PyGICallableCache *callable_cache)
 {
     GITypeInfo *item_type_info;
     PyGIArgCache *arg_cache = (PyGIArgCache *)sc;
@@ -844,7 +845,8 @@ pygi_arg_garray_setup (PyGIArgGArray      *sc,
                                   type_info,
                                   arg_info,
                                   transfer,
-                                  direction)) {
+                                  direction,
+                                  callable_cache)) {
         return FALSE;
     }
 
@@ -875,7 +877,8 @@ PyGIArgCache *
 pygi_arg_garray_new_from_info (GITypeInfo *type_info,
                                GIArgInfo *arg_info,
                                GITransfer transfer,
-                               PyGIDirection direction)
+                               PyGIDirection direction,
+                               PyGICallableCache *callable_cache)
 {
     PyGIArgGArray *array_cache = g_slice_new0 (PyGIArgGArray);
     if (array_cache == NULL)
@@ -885,7 +888,8 @@ pygi_arg_garray_new_from_info (GITypeInfo *type_info,
                                 type_info,
                                 arg_info,
                                 transfer,
-                                direction)) {
+                                direction,
+                                callable_cache)) {
         pygi_arg_cache_free ( (PyGIArgCache *)array_cache);
         return NULL;
     }
diff --git a/gi/pygi-array.h b/gi/pygi-array.h
index 4792ca1..718c7cd 100644
--- a/gi/pygi-array.h
+++ b/gi/pygi-array.h
@@ -25,10 +25,11 @@
 
 G_BEGIN_DECLS
 
-PyGIArgCache *pygi_arg_garray_new_from_info  (GITypeInfo    *type_info,
-                                              GIArgInfo     *arg_info,   /* may be null */
-                                              GITransfer     transfer,
-                                              PyGIDirection  direction);
+PyGIArgCache *pygi_arg_garray_new_from_info  (GITypeInfo        *type_info,
+                                              GIArgInfo         *arg_info,   /* may be null */
+                                              GITransfer         transfer,
+                                              PyGIDirection      direction,
+                                              PyGICallableCache *callable_cache);
 
 PyGIArgCache *pygi_arg_garray_len_arg_setup  (PyGIArgCache      *arg_cache,
                                               GITypeInfo        *type_info,
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 72bade6..8d1d712 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -228,7 +228,8 @@ pygi_arg_sequence_setup (PyGISequenceCache  *sc,
                          GITypeInfo         *type_info,
                          GIArgInfo          *arg_info,    /* may be NULL for return arguments */
                          GITransfer          transfer,
-                         PyGIDirection       direction)
+                         PyGIDirection       direction,
+                         PyGICallableCache  *callable_cache)
 {
     GITypeInfo *item_type_info;
     GITransfer item_transfer;
@@ -250,8 +251,8 @@ pygi_arg_sequence_setup (PyGISequenceCache  *sc,
                                          NULL,
                                          item_transfer,
                                          direction,
-                                         0, 0,
-                                         NULL);
+                                         callable_cache,
+                                         0, 0);
 
     g_base_info_unref ( (GIBaseInfo *)item_type_info);
 
@@ -294,7 +295,8 @@ _arg_cache_new_for_interface (GIInterfaceInfo   *iface_info,
                                                    arg_info,
                                                    transfer,
                                                    direction,
-                                                   iface_info);
+                                                   iface_info,
+                                                   callable_cache);
         case GI_INFO_TYPE_BOXED:
         case GI_INFO_TYPE_STRUCT:
         case GI_INFO_TYPE_UNION:
@@ -327,9 +329,9 @@ pygi_arg_cache_new (GITypeInfo *type_info,
                     GIArgInfo *arg_info,     /* may be null */
                     GITransfer transfer,
                     PyGIDirection direction,
+                    PyGICallableCache *callable_cache,
                     gssize c_arg_index,
-                    gssize py_arg_index,
-                    PyGICallableCache *callable_cache)
+                    gssize py_arg_index)
 {
     PyGIArgCache *arg_cache = NULL;
     GITypeTag type_tag;
@@ -364,7 +366,8 @@ pygi_arg_cache_new (GITypeInfo *type_info,
                arg_cache = pygi_arg_garray_new_from_info (type_info,
                                                           arg_info,
                                                           transfer,
-                                                          direction);
+                                                          direction,
+                                                          callable_cache);
                if (arg_cache == NULL)
                    return NULL;
 
@@ -381,21 +384,24 @@ pygi_arg_cache_new (GITypeInfo *type_info,
            arg_cache = pygi_arg_glist_new_from_info (type_info,
                                                      arg_info,
                                                      transfer,
-                                                     direction);
+                                                     direction,
+                                                     callable_cache);
            break;
 
        case GI_TYPE_TAG_GSLIST:
            arg_cache = pygi_arg_gslist_new_from_info (type_info,
                                                       arg_info,
                                                       transfer,
-                                                      direction);
+                                                      direction,
+                                                      callable_cache);
            break;
 
        case GI_TYPE_TAG_GHASH:
            arg_cache = pygi_arg_hash_table_new_from_info (type_info,
                                                           arg_info,
                                                           transfer,
-                                                          direction);
+                                                          direction,
+                                                          callable_cache);
            break;
 
        case GI_TYPE_TAG_INTERFACE:
@@ -473,9 +479,9 @@ _callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache,
                             NULL,
                             return_transfer,
                             return_direction,
+                            callable_cache,
                             -1,
-                            -1,
-                            callable_cache);
+                            -1);
     if (return_cache == NULL)
         return FALSE;
 
@@ -547,9 +553,9 @@ _callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache,
                                         arg_info,
                                         transfer,
                                         direction,
+                                        callable_cache,
                                         arg_index,
-                                        py_arg_index,
-                                        callable_cache);
+                                        py_arg_index);
 
                 if (arg_cache == NULL) {
                     g_base_info_unref( (GIBaseInfo *)type_info);
diff --git a/gi/pygi-cache.h b/gi/pygi-cache.h
index ca45e5a..093dde2 100644
--- a/gi/pygi-cache.h
+++ b/gi/pygi-cache.h
@@ -236,7 +236,8 @@ pygi_arg_sequence_setup  (PyGISequenceCache  *sc,
                           GITypeInfo         *type_info,
                           GIArgInfo          *arg_info,    /* may be NULL for return arguments */
                           GITransfer          transfer,
-                          PyGIDirection       direction);
+                          PyGIDirection       direction,
+                          PyGICallableCache  *callable_cache);
 
 PyGIArgCache *
 pygi_arg_interface_new_from_info (GITypeInfo         *type_info,
@@ -253,10 +254,10 @@ pygi_arg_cache_new       (GITypeInfo *type_info,
                           GIArgInfo *arg_info,
                           GITransfer transfer,
                           PyGIDirection direction,
+                          PyGICallableCache *callable_cache,
                           /* will be removed */
                           gssize c_arg_index,
-                          gssize py_arg_index,
-                          PyGICallableCache *callable_cache);
+                          gssize py_arg_index);
 
 void
 pygi_arg_cache_free      (PyGIArgCache *cache);
diff --git a/gi/pygi-hashtable.c b/gi/pygi-hashtable.c
index f7d5e74..4bf2b4f 100644
--- a/gi/pygi-hashtable.c
+++ b/gi/pygi-hashtable.c
@@ -330,11 +330,12 @@ _arg_cache_to_py_ghash_setup (PyGIArgCache *arg_cache)
 }
 
 static gboolean
-pygi_arg_hash_table_setup_from_info (PyGIHashCache *hc,
-                                     GITypeInfo    *type_info,
-                                     GIArgInfo     *arg_info,
-                                     GITransfer     transfer,
-                                     PyGIDirection  direction)
+pygi_arg_hash_table_setup_from_info (PyGIHashCache      *hc,
+                                     GITypeInfo         *type_info,
+                                     GIArgInfo          *arg_info,
+                                     GITransfer          transfer,
+                                     PyGIDirection       direction,
+                                     PyGICallableCache  *callable_cache)
 {
     GITypeInfo *key_type_info;
     GITypeInfo *value_type_info;
@@ -354,8 +355,8 @@ pygi_arg_hash_table_setup_from_info (PyGIHashCache *hc,
                                         NULL,
                                         item_transfer,
                                         direction,
-                                        0, 0,
-                                        NULL);
+                                        callable_cache,
+                                        0, 0);
 
     if (hc->key_cache == NULL) {
         return FALSE;
@@ -365,8 +366,8 @@ pygi_arg_hash_table_setup_from_info (PyGIHashCache *hc,
                                           NULL,
                                           item_transfer,
                                           direction,
-                                          0, 0,
-                                          NULL);
+                                          callable_cache,
+                                          0, 0);
 
     if (hc->value_cache == NULL) {
         return FALSE;
@@ -387,10 +388,11 @@ pygi_arg_hash_table_setup_from_info (PyGIHashCache *hc,
 }
 
 PyGIArgCache *
-pygi_arg_hash_table_new_from_info (GITypeInfo   *type_info,
-                                   GIArgInfo    *arg_info,
-                                   GITransfer    transfer,
-                                   PyGIDirection direction)
+pygi_arg_hash_table_new_from_info (GITypeInfo         *type_info,
+                                   GIArgInfo          *arg_info,
+                                   GITransfer          transfer,
+                                   PyGIDirection       direction,
+                                   PyGICallableCache  *callable_cache)
 {
     gboolean res = FALSE;
     PyGIHashCache *hc = NULL;
@@ -403,7 +405,8 @@ pygi_arg_hash_table_new_from_info (GITypeInfo   *type_info,
                                                type_info,
                                                arg_info,
                                                transfer,
-                                               direction);
+                                               direction,
+                                               callable_cache);
     if (res) {
         return (PyGIArgCache *)hc;
     } else {
diff --git a/gi/pygi-hashtable.h b/gi/pygi-hashtable.h
index a42aaf0..efd69f6 100644
--- a/gi/pygi-hashtable.h
+++ b/gi/pygi-hashtable.h
@@ -25,10 +25,11 @@
 
 G_BEGIN_DECLS
 
-PyGIArgCache *pygi_arg_hash_table_new_from_info (GITypeInfo    *type_info,
-                                                 GIArgInfo     *arg_info,   /* may be null */
-                                                 GITransfer     transfer,
-                                                 PyGIDirection  direction);
+PyGIArgCache *pygi_arg_hash_table_new_from_info (GITypeInfo         *type_info,
+                                                 GIArgInfo          *arg_info,   /* may be null */
+                                                 GITransfer          transfer,
+                                                 PyGIDirection       direction,
+                                                 PyGICallableCache  *callable_cache);
 
 G_END_DECLS
 
diff --git a/gi/pygi-list.c b/gi/pygi-list.c
index af2afd8..f6589c1 100644
--- a/gi/pygi-list.c
+++ b/gi/pygi-list.c
@@ -402,15 +402,21 @@ _arg_cache_to_py_gslist_setup (PyGIArgCache *arg_cache,
  */
 
 static gboolean
-pygi_arg_glist_setup_from_info (PyGIArgCache  *arg_cache,
-                                GITypeInfo    *type_info,
-                                GIArgInfo     *arg_info,
-                                GITransfer     transfer,
-                                PyGIDirection  direction)
+pygi_arg_glist_setup_from_info (PyGIArgCache      *arg_cache,
+                                GITypeInfo        *type_info,
+                                GIArgInfo         *arg_info,
+                                GITransfer         transfer,
+                                PyGIDirection      direction,
+                                PyGICallableCache *callable_cache)
 {
     GITypeTag type_tag = g_type_info_get_tag (type_info);
 
-    if (!pygi_arg_sequence_setup ((PyGISequenceCache *)arg_cache, type_info, arg_info, transfer, direction))
+    if (!pygi_arg_sequence_setup ((PyGISequenceCache *)arg_cache,
+                                  type_info,
+                                  arg_info,
+                                  transfer,
+                                  direction,
+                                  callable_cache))
         return FALSE;
 
     switch (type_tag) {
@@ -441,10 +447,11 @@ pygi_arg_glist_setup_from_info (PyGIArgCache  *arg_cache,
 }
 
 PyGIArgCache *
-pygi_arg_glist_new_from_info (GITypeInfo   *type_info,
-                              GIArgInfo    *arg_info,
-                              GITransfer    transfer,
-                              PyGIDirection direction)
+pygi_arg_glist_new_from_info (GITypeInfo        *type_info,
+                              GIArgInfo         *arg_info,
+                              GITransfer         transfer,
+                              PyGIDirection      direction,
+                              PyGICallableCache *callable_cache)
 {
     gboolean res = FALSE;
 
@@ -456,7 +463,8 @@ pygi_arg_glist_new_from_info (GITypeInfo   *type_info,
                                           type_info,
                                           arg_info,
                                           transfer,
-                                          direction);
+                                          direction,
+                                          callable_cache);
     if (res) {
         return arg_cache;
     } else {
diff --git a/gi/pygi-list.h b/gi/pygi-list.h
index 59f03b2..f22e024 100644
--- a/gi/pygi-list.h
+++ b/gi/pygi-list.h
@@ -25,10 +25,11 @@
 
 G_BEGIN_DECLS
 
-PyGIArgCache *pygi_arg_glist_new_from_info  (GITypeInfo    *type_info,
-                                             GIArgInfo     *arg_info,   /* may be null */
-                                             GITransfer     transfer,
-                                             PyGIDirection  direction);
+PyGIArgCache *pygi_arg_glist_new_from_info  (GITypeInfo        *type_info,
+                                             GIArgInfo         *arg_info,   /* may be null */
+                                             GITransfer         transfer,
+                                             PyGIDirection      direction,
+                                             PyGICallableCache *callable_cache);
 
 /* Internally dispatches GList and GSList */
 #define pygi_arg_gslist_new_from_info  pygi_arg_glist_new_from_info
diff --git a/gi/pygi-object.c b/gi/pygi-object.c
index 7a05fdf..8ed7ffc 100644
--- a/gi/pygi-object.c
+++ b/gi/pygi-object.c
@@ -223,11 +223,12 @@ _pygi_marshal_cleanup_to_py_interface_object (PyGIInvokeState *state,
 }
 
 static gboolean
-pygi_arg_gobject_setup_from_info (PyGIArgCache  *arg_cache,
-                                  GITypeInfo    *type_info,
-                                  GIArgInfo     *arg_info,
-                                  GITransfer     transfer,
-                                  PyGIDirection  direction)
+pygi_arg_gobject_setup_from_info (PyGIArgCache      *arg_cache,
+                                  GITypeInfo        *type_info,
+                                  GIArgInfo         *arg_info,
+                                  GITransfer         transfer,
+                                  PyGIDirection      direction,
+                                  PyGICallableCache *callable_cache)
 {
     /* NOTE: usage of pygi_arg_interface_new_from_info already calls
      * pygi_arg_interface_setup so no need to do it here.
@@ -247,11 +248,12 @@ pygi_arg_gobject_setup_from_info (PyGIArgCache  *arg_cache,
 }
 
 PyGIArgCache *
-pygi_arg_gobject_new_from_info (GITypeInfo      *type_info,
-                                GIArgInfo       *arg_info,
-                                GITransfer       transfer,
-                                PyGIDirection    direction,
-                                GIInterfaceInfo *iface_info)
+pygi_arg_gobject_new_from_info (GITypeInfo        *type_info,
+                                GIArgInfo         *arg_info,
+                                GITransfer         transfer,
+                                PyGIDirection      direction,
+                                GIInterfaceInfo   *iface_info,
+                                PyGICallableCache *callable_cache)
 {
     gboolean res = FALSE;
     PyGIArgCache *cache = NULL;
@@ -268,7 +270,8 @@ pygi_arg_gobject_new_from_info (GITypeInfo      *type_info,
                                             type_info,
                                             arg_info,
                                             transfer,
-                                            direction);
+                                            direction,
+                                            callable_cache);
     if (res) {
         return cache;
     } else {
diff --git a/gi/pygi-object.h b/gi/pygi-object.h
index 4a8800e..8a59acd 100644
--- a/gi/pygi-object.h
+++ b/gi/pygi-object.h
@@ -39,7 +39,8 @@ pygi_arg_gobject_new_from_info       (GITypeInfo        *type_info,
                                       GIArgInfo         *arg_info,   /* may be null */
                                       GITransfer         transfer,
                                       PyGIDirection      direction,
-                                      GIInterfaceInfo   *iface_info);
+                                      GIInterfaceInfo   *iface_info,
+                                      PyGICallableCache *callable_cache);
 
 G_END_DECLS
 


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