Commit 534063ec authored by Torsten Schönfeld's avatar Torsten Schönfeld

Properly check for definedness throughout

Use gperl_sv_is_defined instead of a direct comparison against &PL_sv_undef.
parent cc3db669
......@@ -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 =
......
......@@ -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))
......
......@@ -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) {
......
......@@ -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))
......
......@@ -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. */
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment