summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-08-03 00:26:11 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-09-26 00:24:53 -0700
commitc9d8639401ae82977e960de44d80b94a501a2184 (patch)
tree3b3e91825b2afb0937c00f451c5459dd2549b9e8
parentdbc2cf5f1fa0f9cc046170efa6afb086b90253cb (diff)
downloadpygobject-c9d8639401ae82977e960de44d80b94a501a2184.tar.gz
cache refactoring: Move variable declarations to blocks where they are used
https://bugzilla.gnome.org/show_bug.cgi?id=640812
-rw-r--r--gi/pygi-cache.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index c66e72a4..5b160fec 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -1023,12 +1023,7 @@ _args_cache_generate (GICallableInfo *callable_info,
for (i=0; arg_index < _pygi_callable_cache_args_len (callable_cache); arg_index++, i++) {
PyGIArgCache *arg_cache = NULL;
GIArgInfo *arg_info;
- GITypeInfo *type_info;
PyGIDirection direction;
- GITransfer transfer;
- GITypeTag type_tag;
- gboolean is_caller_allocates = FALSE;
- gssize py_arg_index = -1;
arg_info = g_callable_info_get_arg (callable_info, i);
@@ -1037,23 +1032,20 @@ _args_cache_generate (GICallableInfo *callable_info,
arg_cache = _arg_cache_alloc ();
_pygi_callable_cache_set_arg (callable_cache, arg_index, arg_cache);
+ direction = PYGI_DIRECTION_FROM_PYTHON;
arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info);
- arg_cache->direction = PYGI_DIRECTION_FROM_PYTHON;
+ arg_cache->direction = direction;
arg_cache->meta_type = PYGI_META_ARG_TYPE_CLOSURE;
arg_cache->c_arg_index = i;
callable_cache->n_from_py_args++;
} else {
+ GITypeInfo *type_info;
direction = _pygi_get_direction (callable_cache,
g_arg_info_get_direction (arg_info));
- transfer = g_arg_info_get_ownership_transfer (arg_info);
type_info = g_arg_info_get_type (arg_info);
- type_tag = g_type_info_get_tag (type_info);
-
- if (type_tag == GI_TYPE_TAG_INTERFACE || type_tag == GI_TYPE_TAG_ARRAY)
- is_caller_allocates = g_arg_info_is_caller_allocates (arg_info);
/* must be an child arg filled in by its owner
* and continue
@@ -1079,6 +1071,17 @@ _args_cache_generate (GICallableInfo *callable_info,
arg_cache->type_tag = g_type_info_get_tag (type_info);
} else {
+ GITypeTag type_tag;
+ GITransfer transfer;
+ gssize py_arg_index = -1;
+ gboolean is_caller_allocates = FALSE;
+
+ type_tag = g_type_info_get_tag (type_info);
+ transfer = g_arg_info_get_ownership_transfer (arg_info);
+
+ if (type_tag == GI_TYPE_TAG_INTERFACE || type_tag == GI_TYPE_TAG_ARRAY)
+ is_caller_allocates = g_arg_info_is_caller_allocates (arg_info);
+
if (direction & PYGI_DIRECTION_FROM_PYTHON) {
py_arg_index = callable_cache->n_py_args;