[pygobject] Add underscore prefix and _cache_adapter suffix to marshaling functions



commit 627c5faaa54ed9a2b59ac1547833c171cd1a1e87
Author: Simon Feltman <sfeltman src gnome org>
Date:   Fri Jul 26 17:34:01 2013 -0700

    Add underscore prefix and _cache_adapter suffix to marshaling functions
    
    Add underscores to all _pygi_marshal_* functions. We don't currently
    export symbols, but we might need to for C unittesting. This will
    ensure we don't have a "public API".
    Add _cache_adapter suffix to marshaling functions which are light
    weight wrappers intended only for cached marshalers.

 gi/pygi-argument.c        |   40 ++++++++++----------
 gi/pygi-cache.c           |   10 +++---
 gi/pygi-marshal-from-py.c |   86 ++++++++++++++++++++++----------------------
 gi/pygi-marshal-from-py.h |   44 +++++++++++-----------
 gi/pygi-marshal-to-py.c   |   48 ++++++++++++------------
 gi/pygi-marshal-to-py.h   |   34 +++++++++---------
 6 files changed, 131 insertions(+), 131 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index cda0be7..27b9dfe 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -1027,16 +1027,16 @@ array_success:
                      * Further re-factoring is needed to fix this leak.
                      * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405
                      */
-                    pygi_marshal_from_py_interface_struct (object,
-                                                           &arg,
-                                                           NULL, /*arg_name*/
-                                                           info, /*interface_info*/
-                                                           type_info,
-                                                           g_type,
-                                                           py_type,
-                                                           transfer,
-                                                           FALSE, /*copy_reference*/
-                                                           g_struct_info_is_foreign (info));
+                    _pygi_marshal_from_py_interface_struct (object,
+                                                            &arg,
+                                                            NULL, /*arg_name*/
+                                                            info, /*interface_info*/
+                                                            type_info,
+                                                            g_type,
+                                                            py_type,
+                                                            transfer,
+                                                            FALSE, /*copy_reference*/
+                                                            g_struct_info_is_foreign (info));
 
                     Py_DECREF (py_type);
                     break;
@@ -1060,7 +1060,7 @@ array_success:
                 case GI_INFO_TYPE_INTERFACE:
                 case GI_INFO_TYPE_OBJECT:
                     /* An error within this call will result in a NULL arg */
-                    pygi_marshal_from_py_gobject (object, &arg, transfer);
+                    _pygi_marshal_from_py_gobject (object, &arg, transfer);
                     break;
 
                 default:
@@ -1370,13 +1370,13 @@ _pygi_argument_to_object (GIArgument  *arg,
                         py_type = _pygi_type_get_from_g_type (g_type);
                     }
 
-                    object = pygi_marshal_to_py_interface_struct (arg,
-                                                                  info, /*interface_info*/
-                                                                  g_type,
-                                                                  py_type,
-                                                                  transfer,
-                                                                  FALSE, /*is_allocated*/
-                                                                  g_struct_info_is_foreign (info));
+                    object = _pygi_marshal_to_py_interface_struct (arg,
+                                                                   info, /*interface_info*/
+                                                                   g_type,
+                                                                   py_type,
+                                                                   transfer,
+                                                                   FALSE, /*is_allocated*/
+                                                                   g_struct_info_is_foreign (info));
 
                     Py_XDECREF (py_type);
                     break;
@@ -1433,10 +1433,10 @@ _pygi_argument_to_object (GIArgument  *arg,
                             transfer == GI_TRANSFER_NOTHING &&
                             g_object_is_floating (arg->v_pointer)) {
                         g_object_ref (arg->v_pointer);
-                        object = pygi_marshal_to_py_object (arg, GI_TRANSFER_EVERYTHING);
+                        object = _pygi_marshal_to_py_object (arg, GI_TRANSFER_EVERYTHING);
                         g_object_force_floating (arg->v_pointer);
                     } else {
-                        object = pygi_marshal_to_py_object (arg, transfer);
+                        object = _pygi_marshal_to_py_object (arg, transfer);
                     }
 
                     break;
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 8604abb..2f807f8 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -446,14 +446,14 @@ static void
 _arg_cache_from_py_interface_union_setup (PyGIArgCache *arg_cache,
                                           GITransfer transfer)
 {
-    arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct;
+    arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter;
 }
 
 static void
 _arg_cache_to_py_interface_union_setup (PyGIArgCache *arg_cache,
                                         GITransfer transfer)
 {
-    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct;
+    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter;
 }
 
 static void
@@ -463,7 +463,7 @@ _arg_cache_from_py_interface_struct_setup (PyGIArgCache *arg_cache,
 {
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
     iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info);
-    arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct;
+    arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter;
 
     if (iface_cache->g_type == G_TYPE_VALUE)
         arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_struct_gvalue;
@@ -478,7 +478,7 @@ _arg_cache_to_py_interface_struct_setup (PyGIArgCache *arg_cache,
 {
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
     iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info);
-    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct;
+    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter;
 
     if (iface_cache->is_foreign)
         arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_struct_foreign;
@@ -496,7 +496,7 @@ static void
 _arg_cache_to_py_interface_object_setup (PyGIArgCache *arg_cache,
                                          GITransfer transfer)
 {
-    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object;
+    arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object_cache_adapter;
     arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_object;
 }
 
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index f12ad03..5d38baa 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -1473,24 +1473,24 @@ err:
 }
 
 gboolean
-_pygi_marshal_from_py_interface_struct (PyGIInvokeState   *state,
-                                        PyGICallableCache *callable_cache,
-                                        PyGIArgCache      *arg_cache,
-                                        PyObject          *py_arg,
-                                        GIArgument        *arg)
+_pygi_marshal_from_py_interface_struct_cache_adapter (PyGIInvokeState   *state,
+                                                      PyGICallableCache *callable_cache,
+                                                      PyGIArgCache      *arg_cache,
+                                                      PyObject          *py_arg,
+                                                      GIArgument        *arg)
 {
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
 
-    return pygi_marshal_from_py_interface_struct (py_arg,
-                                                  arg,
-                                                  arg_cache->arg_name,
-                                                  iface_cache->interface_info,
-                                                  arg_cache->type_info,
-                                                  iface_cache->g_type,
-                                                  iface_cache->py_type,
-                                                  arg_cache->transfer,
-                                                  TRUE, /*copy_reference*/
-                                                  iface_cache->is_foreign);
+    return _pygi_marshal_from_py_interface_struct (py_arg,
+                                                   arg,
+                                                   arg_cache->arg_name,
+                                                   iface_cache->interface_info,
+                                                   arg_cache->type_info,
+                                                   iface_cache->g_type,
+                                                   iface_cache->py_type,
+                                                   arg_cache->transfer,
+                                                   TRUE, /*copy_reference*/
+                                                   iface_cache->is_foreign);
 }
 
 gboolean
@@ -1531,7 +1531,7 @@ _pygi_marshal_from_py_interface_object (PyGIInvokeState   *state,
         return FALSE;
     }
 
-    return pygi_marshal_from_py_gobject (py_arg, arg, arg_cache->transfer);
+    return _pygi_marshal_from_py_gobject (py_arg, arg, arg_cache->transfer);
 }
 
 gboolean
@@ -1623,14 +1623,14 @@ gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState   *state,
    return TRUE;
 }
 
-/* pygi_marshal_from_py_gobject:
+/* _pygi_marshal_from_py_gobject:
  * py_arg: (in):
  * arg: (out):
  */
 gboolean
-pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
-                              GIArgument *arg,  /*out*/
-                              GITransfer transfer) {
+_pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
+                               GIArgument *arg,  /*out*/
+                               GITransfer transfer) {
     GObject *gobj;
 
     if (py_arg == Py_None) {
@@ -1690,7 +1690,7 @@ pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
     return TRUE;
 }
 
-/* pygi_marshal_from_py_gvalue:
+/* _pygi_marshal_from_py_gvalue:
  * py_arg: (in):
  * arg: (out):
  * transfer:
@@ -1698,10 +1698,10 @@ pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
  *                 when it is already holding a GValue vs. copying the value.
  */
 gboolean
-pygi_marshal_from_py_gvalue (PyObject *py_arg,
-                             GIArgument *arg,
-                             GITransfer transfer,
-                             gboolean copy_reference) {
+_pygi_marshal_from_py_gvalue (PyObject *py_arg,
+                              GIArgument *arg,
+                              GITransfer transfer,
+                              gboolean copy_reference) {
     GValue *value;
     GType object_type;
 
@@ -1735,13 +1735,13 @@ pygi_marshal_from_py_gvalue (PyObject *py_arg,
     return TRUE;
 }
 
-/* pygi_marshal_from_py_gclosure:
+/* _pygi_marshal_from_py_gclosure:
  * py_arg: (in):
  * arg: (out):
  */
 gboolean
-pygi_marshal_from_py_gclosure(PyObject *py_arg,
-                              GIArgument *arg)
+_pygi_marshal_from_py_gclosure(PyObject *py_arg,
+                               GIArgument *arg)
 {
     GClosure *closure;
     GType object_gtype = pyg_type_from_object_strict (py_arg, FALSE);
@@ -1768,16 +1768,16 @@ pygi_marshal_from_py_gclosure(PyObject *py_arg,
 }
 
 gboolean
-pygi_marshal_from_py_interface_struct (PyObject *py_arg,
-                                       GIArgument *arg,
-                                       const gchar *arg_name,
-                                       GIBaseInfo *interface_info,
-                                       GITypeInfo *type_info,
-                                       GType g_type,
-                                       PyObject *py_type,
-                                       GITransfer transfer,
-                                       gboolean copy_reference,
-                                       gboolean is_foreign)
+_pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+                                        GIArgument *arg,
+                                        const gchar *arg_name,
+                                        GIBaseInfo *interface_info,
+                                        GITypeInfo *type_info,
+                                        GType g_type,
+                                        PyObject *py_type,
+                                        GITransfer transfer,
+                                        gboolean copy_reference,
+                                        gboolean is_foreign)
 {
     if (py_arg == Py_None) {
         arg->v_pointer = NULL;
@@ -1789,12 +1789,12 @@ pygi_marshal_from_py_interface_struct (PyObject *py_arg,
      */
 
     if (g_type_is_a (g_type, G_TYPE_CLOSURE)) {
-        return pygi_marshal_from_py_gclosure (py_arg, arg);
+        return _pygi_marshal_from_py_gclosure (py_arg, arg);
     } else if (g_type_is_a (g_type, G_TYPE_VALUE)) {
-        return pygi_marshal_from_py_gvalue(py_arg,
-                                           arg,
-                                           transfer,
-                                           copy_reference);
+        return _pygi_marshal_from_py_gvalue(py_arg,
+                                            arg,
+                                            transfer,
+                                            copy_reference);
     } else if (is_foreign) {
         PyObject *success;
         success = pygi_struct_foreign_convert_to_g_argument (py_arg,
diff --git a/gi/pygi-marshal-from-py.h b/gi/pygi-marshal-from-py.h
index 0a60dd6..f9f0d0f 100644
--- a/gi/pygi-marshal-from-py.h
+++ b/gi/pygi-marshal-from-py.h
@@ -78,11 +78,11 @@ gboolean _pygi_marshal_from_py_interface_flags    (PyGIInvokeState   *state,
                                                    PyGIArgCache      *arg_cache,
                                                    PyObject          *py_arg,
                                                    GIArgument        *arg);
-gboolean _pygi_marshal_from_py_interface_struct   (PyGIInvokeState   *state,
-                                                   PyGICallableCache *callable_cache,
-                                                   PyGIArgCache      *arg_cache,
-                                                   PyObject          *py_arg,
-                                                   GIArgument        *arg);
+gboolean _pygi_marshal_from_py_interface_struct_cache_adapter   (PyGIInvokeState   *state,
+                                                                 PyGICallableCache *callable_cache,
+                                                                 PyGIArgCache      *arg_cache,
+                                                                 PyObject          *py_arg,
+                                                                 GIArgument        *arg);
 gboolean _pygi_marshal_from_py_interface_interface(PyGIInvokeState   *state,
                                                    PyGICallableCache *callable_cache,
                                                    PyGIArgCache      *arg_cache,
@@ -120,26 +120,26 @@ gboolean _pygi_marshal_from_py_basic_type_cache_adapter  (PyGIInvokeState   *sta
                                                           PyObject          *py_arg,
                                                           GIArgument        *arg);
 
-gboolean pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
-                                       GIArgument *arg,  /*out*/
-                                       GITransfer transfer);
+gboolean _pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
+                                        GIArgument *arg,  /*out*/
+                                        GITransfer transfer);
 
-gboolean pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/
-                                      GIArgument *arg,  /*out*/
-                                      GITransfer transfer,
-                                      gboolean is_allocated);
+gboolean _pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/
+                                       GIArgument *arg,  /*out*/
+                                       GITransfer transfer,
+                                       gboolean is_allocated);
 
-gboolean pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/
-                                       GIArgument *arg); /*out*/
+gboolean _pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/
+                                        GIArgument *arg); /*out*/
 
-gboolean pygi_marshal_from_py_interface_struct (PyObject *py_arg,
-                                                GIArgument *arg,
-                                                const gchar *arg_name,
-                                                GIBaseInfo *interface_info,
-                                                GITypeInfo *type_info,
-                                                GType g_type,
-                                                PyObject *py_type,
-                                                GITransfer transfer,
+gboolean _pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+                                                 GIArgument *arg,
+                                                 const gchar *arg_name,
+                                                 GIBaseInfo *interface_info,
+                                                 GITypeInfo *type_info,
+                                                 GType g_type,
+                                                 PyObject *py_type,
+                                                 GITransfer transfer,
                                                 gboolean is_allocated,
                                                 gboolean is_foreign);
 
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index af45db0..7c260f7 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -742,20 +742,20 @@ _pygi_marshal_to_py_interface_flags (PyGIInvokeState   *state,
 }
 
 PyObject *
-_pygi_marshal_to_py_interface_struct (PyGIInvokeState   *state,
-                                      PyGICallableCache *callable_cache,
-                                      PyGIArgCache      *arg_cache,
-                                      GIArgument        *arg)
+_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState   *state,
+                                                    PyGICallableCache *callable_cache,
+                                                    PyGIArgCache      *arg_cache,
+                                                    GIArgument        *arg)
 {
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
 
-    return pygi_marshal_to_py_interface_struct (arg,
-                                                iface_cache->interface_info,
-                                                iface_cache->g_type,
-                                                iface_cache->py_type,
-                                                arg_cache->transfer,
-                                                arg_cache->is_caller_allocates,
-                                                iface_cache->is_foreign);
+    return _pygi_marshal_to_py_interface_struct (arg,
+                                                 iface_cache->interface_info,
+                                                 iface_cache->g_type,
+                                                 iface_cache->py_type,
+                                                 arg_cache->transfer,
+                                                 arg_cache->is_caller_allocates,
+                                                 iface_cache->is_foreign);
 }
 
 PyObject *
@@ -785,12 +785,12 @@ _pygi_marshal_to_py_interface_boxed (PyGIInvokeState   *state,
 }
 
 PyObject *
-_pygi_marshal_to_py_interface_object (PyGIInvokeState   *state,
-                                      PyGICallableCache *callable_cache,
-                                      PyGIArgCache      *arg_cache,
-                                      GIArgument        *arg)
+_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState   *state,
+                                                    PyGICallableCache *callable_cache,
+                                                    PyGIArgCache      *arg_cache,
+                                                    GIArgument        *arg)
 {
-    return pygi_marshal_to_py_object(arg, arg_cache->transfer);
+    return _pygi_marshal_to_py_object(arg, arg_cache->transfer);
 }
 
 PyObject *
@@ -807,7 +807,7 @@ _pygi_marshal_to_py_interface_union  (PyGIInvokeState   *state,
 }
 
 PyObject *
-pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) {
+_pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) {
     PyObject *pyobj;
 
     if (arg->v_pointer == NULL) {
@@ -829,13 +829,13 @@ pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) {
 }
 
 PyObject *
-pygi_marshal_to_py_interface_struct (GIArgument *arg,
-                                     GIInterfaceInfo *interface_info,
-                                     GType g_type,
-                                     PyObject *py_type,
-                                     GITransfer transfer,
-                                     gboolean is_allocated,
-                                     gboolean is_foreign)
+_pygi_marshal_to_py_interface_struct (GIArgument *arg,
+                                      GIInterfaceInfo *interface_info,
+                                      GType g_type,
+                                      PyObject *py_type,
+                                      GITransfer transfer,
+                                      gboolean is_allocated,
+                                      gboolean is_foreign)
 {
     PyObject *py_obj = NULL;
 
diff --git a/gi/pygi-marshal-to-py.h b/gi/pygi-marshal-to-py.h
index fa8fb49..1378630 100644
--- a/gi/pygi-marshal-to-py.h
+++ b/gi/pygi-marshal-to-py.h
@@ -65,10 +65,10 @@ PyObject *_pygi_marshal_to_py_interface_flags  (PyGIInvokeState   *state,
                                                 PyGICallableCache *callable_cache,
                                                 PyGIArgCache      *arg_cache,
                                                 GIArgument        *arg);
-PyObject *_pygi_marshal_to_py_interface_struct (PyGIInvokeState   *state,
-                                                PyGICallableCache *callable_cache,
-                                                PyGIArgCache      *arg_cache,
-                                                GIArgument        *arg);
+PyObject *_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState   *state,
+                                                              PyGICallableCache *callable_cache,
+                                                              PyGIArgCache      *arg_cache,
+                                                              GIArgument        *arg);
 PyObject *_pygi_marshal_to_py_interface_interface(PyGIInvokeState   *state,
                                                   PyGICallableCache *callable_cache,
                                                   PyGIArgCache      *arg_cache,
@@ -77,10 +77,10 @@ PyObject *_pygi_marshal_to_py_interface_boxed  (PyGIInvokeState   *state,
                                                 PyGICallableCache *callable_cache,
                                                 PyGIArgCache      *arg_cache,
                                                 GIArgument        *arg);
-PyObject *_pygi_marshal_to_py_interface_object (PyGIInvokeState   *state,
-                                                PyGICallableCache *callable_cache,
-                                                PyGIArgCache      *arg_cache,
-                                                GIArgument        *arg);
+PyObject *_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState   *state,
+                                                              PyGICallableCache *callable_cache,
+                                                              PyGIArgCache      *arg_cache,
+                                                              GIArgument        *arg);
 PyObject *_pygi_marshal_to_py_interface_union  (PyGIInvokeState   *state,
                                                 PyGICallableCache *callable_cache,
                                                 PyGIArgCache      *arg_cache,
@@ -88,16 +88,16 @@ PyObject *_pygi_marshal_to_py_interface_union  (PyGIInvokeState   *state,
 
 /* Simplified marshalers shared between vfunc/closure and direct function calls. */
 
-PyObject *pygi_marshal_to_py_object (GIArgument *arg,
-                                     GITransfer transfer);
+PyObject *_pygi_marshal_to_py_object (GIArgument *arg,
+                                      GITransfer transfer);
 
-PyObject *pygi_marshal_to_py_interface_struct (GIArgument *arg,
-                                               GIInterfaceInfo *interface_info,
-                                               GType g_type,
-                                               PyObject *py_type,
-                                               GITransfer transfer,
-                                               gboolean is_allocated,
-                                               gboolean is_foreign);
+PyObject *_pygi_marshal_to_py_interface_struct (GIArgument *arg,
+                                                GIInterfaceInfo *interface_info,
+                                                GType g_type,
+                                                PyObject *py_type,
+                                                GITransfer transfer,
+                                                gboolean is_allocated,
+                                                gboolean is_foreign);
 
 G_END_DECLS
 


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