[perl-Glib-Object-Introspection] Split out the GList conversion code into glist_to_sv
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Split out the GList conversion code into glist_to_sv
- Date: Sun, 25 Apr 2010 22:39:14 +0000 (UTC)
commit 4bb7ca99896d018f0e993288b966ac2be4b3f2a3
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Sun Apr 25 23:38:31 2010 +0200
Split out the GList conversion code into glist_to_sv
GObjectIntrospection.xs | 67 +++++++++++++++++++++++++++-------------------
1 files changed, 39 insertions(+), 28 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index 751e722..974a949 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -67,6 +67,9 @@ static void release_callback (gpointer data);
static SV * arg_to_sv (const GArgument * arg,
GITypeInfo * info,
GITransfer transfer);
+static SV * pointer_to_sv (GITypeInfo* info,
+ gpointer pointer,
+ gboolean own);
/* ------------------------------------------------------------------------- */
@@ -274,6 +277,41 @@ struct_to_sv (GIBaseInfo* info,
return newRV_noinc ((SV *) hv);
}
+
+static SV *
+glist_to_sv (GITypeInfo* info,
+ gpointer pointer,
+ GITransfer transfer)
+{
+ GITypeInfo *param_info;
+ GList *i;
+ AV *av;
+ SV *value;
+
+ param_info = g_type_info_get_param_type (info, 0);
+ av = newAV ();
+
+ dwarn (" GList: pointer %p, param_info %p with type tag %d\n",
+ pointer,
+ param_info,
+ g_type_info_get_tag (param_info));
+
+ for (i = pointer; i; i = i->next) {
+ dwarn (" converting pointer %p\n", i->data);
+ value = pointer_to_sv (param_info, i->data,
+ transfer == GI_TRANSFER_EVERYTHING);
+ if (value)
+ av_push (av, value);
+ }
+
+ if (transfer >= GI_TRANSFER_CONTAINER)
+ g_list_free (pointer);
+
+ g_base_info_unref ((GIBaseInfo *) param_info);
+
+ return newRV_noinc ((SV *) av);
+}
+
static gpointer
sv_to_pointer (GIArgInfo * arg_info,
GITypeInfo * type_info,
@@ -648,34 +686,7 @@ arg_to_sv (const GArgument * arg,
return pointer_to_sv (info, arg->v_pointer, own);
case GI_TYPE_TAG_GLIST:
- {
- GITypeInfo *param_info;
- GList *i;
- AV *av;
- SV *value;
-
- param_info = g_type_info_get_param_type (info, 0);
- av = newAV ();
-
- dwarn (" GList: pointer %p, param_info %p with type tag %d\n",
- arg->v_pointer,
- param_info,
- g_type_info_get_tag (param_info));
-
- for (i = arg->v_pointer; i; i = i->next) {
- dwarn (" converting pointer %p\n", i->data);
- value = pointer_to_sv (param_info, i->data, transfer);
- if (value)
- av_push (av, value);
- }
-
- if (transfer >= GI_TRANSFER_CONTAINER)
- g_list_free (arg->v_pointer);
-
- g_base_info_unref ((GIBaseInfo *) param_info);
-
- return newRV_noinc ((SV *) av);
- }
+ return glist_to_sv (info, arg->v_pointer, transfer);
case GI_TYPE_TAG_GSLIST:
croak ("FIXME - GI_TYPE_TAG_GSLIST");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]