[perl-Glib-Object-Introspection] Properly check for definedness throughout



commit 534063ecfffca3b47a9b8529f0002cb8fc0237ff
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sun Nov 13 17:18:30 2011 +0100

    Properly check for definedness throughout
    
    Use gperl_sv_is_defined instead of a direct comparison against &PL_sv_undef.

 gperl-i11n-callback.c          |    2 +-
 gperl-i11n-marshal-array.c     |    2 +-
 gperl-i11n-marshal-callback.c  |    2 +-
 gperl-i11n-marshal-hash.c      |    2 +-
 gperl-i11n-marshal-interface.c |    2 +-
 gperl-i11n-marshal-list.c      |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gperl-i11n-callback.c b/gperl-i11n-callback.c
index 99b4172..1f91dc9 100644
--- a/gperl-i11n-callback.c
+++ b/gperl-i11n-callback.c
@@ -6,7 +6,7 @@ create_perl_callback_closure (GITypeInfo *cb_type, SV *code)
 	GPerlI11nPerlCallbackInfo *info;
 
 	info = g_new0 (GPerlI11nPerlCallbackInfo, 1);
-	if (code == &PL_sv_undef)
+	if (!gperl_sv_is_defined (code))
 		return info;
 
 	info->interface =
diff --git a/gperl-i11n-marshal-array.c b/gperl-i11n-marshal-array.c
index 80d0fac..3607834 100644
--- a/gperl-i11n-marshal-array.c
+++ b/gperl-i11n-marshal-array.c
@@ -102,7 +102,7 @@ sv_to_array (GITransfer transfer,
 		iinfo->array_infos = g_slist_prepend (iinfo->array_infos, array_info);
 	}
 
-	if (sv == &PL_sv_undef)
+	if (!gperl_sv_is_defined (sv))
 		return NULL;
 
 	if (!gperl_sv_is_array_ref (sv))
diff --git a/gperl-i11n-marshal-callback.c b/gperl-i11n-marshal-callback.c
index e710c01..b8ec353 100644
--- a/gperl-i11n-marshal-callback.c
+++ b/gperl-i11n-marshal-callback.c
@@ -23,7 +23,7 @@ sv_to_callback (GIArgInfo * arg_info,
 	dwarn ("      Perl callback data at %d, destroy at %d\n",
 	       callback_info->data_pos, callback_info->destroy_pos);
 
-	scope = (sv == &PL_sv_undef)
+	scope = (!gperl_sv_is_defined (sv))
 		? GI_SCOPE_TYPE_CALL
 		: g_arg_info_get_scope (arg_info);
 	switch (scope) {
diff --git a/gperl-i11n-marshal-hash.c b/gperl-i11n-marshal-hash.c
index 9a93816..92cedf6 100644
--- a/gperl-i11n-marshal-hash.c
+++ b/gperl-i11n-marshal-hash.c
@@ -82,7 +82,7 @@ sv_to_ghash (GITransfer transfer,
 
 	dwarn ("%s: sv %p\n", G_STRFUNC, sv);
 
-	if (sv == &PL_sv_undef)
+	if (!gperl_sv_is_defined (sv))
 		return NULL;
 
 	if (!gperl_sv_is_hash_ref (sv))
diff --git a/gperl-i11n-marshal-interface.c b/gperl-i11n-marshal-interface.c
index 525bb42..927c910 100644
--- a/gperl-i11n-marshal-interface.c
+++ b/gperl-i11n-marshal-interface.c
@@ -119,7 +119,7 @@ sv_to_interface (GIArgInfo * arg_info,
 				gpointer mem = gperl_get_boxed_check (sv, type);
 				g_memmove (arg->v_pointer, mem, n_bytes);
 			} else {
-				if (may_be_null && sv == &PL_sv_undef) {
+				if (may_be_null && !gperl_sv_is_defined (sv)) {
 					arg->v_pointer = NULL;
 				} else {
 					/* FIXME: Check transfer setting. */
diff --git a/gperl-i11n-marshal-list.c b/gperl-i11n-marshal-list.c
index d8df8e3..4c3cd40 100644
--- a/gperl-i11n-marshal-list.c
+++ b/gperl-i11n-marshal-list.c
@@ -66,7 +66,7 @@ sv_to_glist (GITransfer transfer, GITypeInfo * type_info, SV * sv)
 
 	dwarn ("%s: sv %p\n", G_STRFUNC, sv);
 
-	if (sv == &PL_sv_undef)
+	if (!gperl_sv_is_defined (sv))
 		return NULL;
 
 	if (!gperl_sv_is_array_ref (sv))



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