[pygobject] Avoid calling g_slist_length() during invoke



commit 0acbf6ad543a928ce75fc6d6839d3e6aa2e9a3d3
Author: Garrett Regier <garrett regier riftio com>
Date:   Tue Jun 9 07:11:51 2015 -0700

    Avoid calling g_slist_length() during invoke
    
    We already know the number of Python args.

 gi/pygi-invoke.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index 0151650..1460280 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -84,7 +84,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
 {
     PyObject *combined_py_args = NULL;
     Py_ssize_t n_py_args, n_py_kwargs, i;
-    guint n_expected_args;
+    guint n_expected_args = cache->n_py_args;
     GSList *l;
 
     n_py_args = PyTuple_GET_SIZE (py_args);
@@ -94,7 +94,6 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
         n_py_kwargs = PyDict_Size (py_kwargs);
 
     /* Fast path, we already have the exact number of args and not kwargs. */
-    n_expected_args = g_slist_length (cache->arg_name_list);
     if (n_py_kwargs == 0 && n_py_args == n_expected_args && cache->user_data_varargs_index < 0) {
         Py_INCREF (py_args);
         return py_args;


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