[perl-Glib-Object-Introspection] Avoid misusing PL_na
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Avoid misusing PL_na
- Date: Wed, 25 Sep 2013 17:51:20 +0000 (UTC)
commit b9bbcdb4fe66bb2da158b62567301875c52f0e2d
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Tue Sep 24 19:58:50 2013 +0200
Avoid misusing PL_na
We used to do "newSVpv (string, PL_na)" when we didn't know the string's
length. That's not correct, and breaks if other XS modules write to PL_na,
which is what PL_na is intended for. Simply use "newSVpv (string, 0)" instead.
GObjectIntrospection.xs | 10 +++++-----
NEWS | 8 ++++++++
gperl-i11n-croak.c | 4 ++--
gperl-i11n-field.c | 4 ++--
gperl-i11n-marshal-arg.c | 4 ++--
gperl-i11n-method.c | 2 +-
gperl-i11n-vfunc-object.c | 2 +-
7 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index 26341ee..69f60f1 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -358,15 +358,15 @@ _register_types (class, namespace, package)
dwarn ("setting up %s.%s\n", namespace, name);
if (info_type == GI_INFO_TYPE_CONSTANT) {
- av_push (constants, newSVpv (name, PL_na));
+ av_push (constants, newSVpv (name, 0));
}
if (info_type == GI_INFO_TYPE_FUNCTION) {
- av_push (global_functions, newSVpv (name, PL_na));
+ av_push (global_functions, newSVpv (name, 0));
}
if (info_type == GI_INFO_TYPE_INTERFACE) {
- av_push (interfaces, newSVpv (name, PL_na));
+ av_push (interfaces, newSVpv (name, 0));
}
if (info_type == GI_INFO_TYPE_OBJECT ||
@@ -747,7 +747,7 @@ _find_non_perl_parents (class, basename, object_name, target_package)
while ((gtype = g_type_parent (gtype))) {
if (!g_type_get_qdata (gtype, reg_quark)) {
const gchar *package = gperl_object_package_from_type (gtype);
- XPUSHs (sv_2mortal (newSVpv (package, PL_na)));
+ XPUSHs (sv_2mortal (newSVpv (package, 0)));
}
if (gtype == object_gtype) {
break;
@@ -785,7 +785,7 @@ _find_vfuncs_with_implementation (class, object_package, target_package)
/* FIXME: g_vfunc_info_get_offset does not seem to work here. */
field_offset = get_vfunc_offset (object_info, vfunc_name);
if (G_STRUCT_MEMBER (gpointer, target_klass, field_offset)) {
- XPUSHs (sv_2mortal (newSVpv (vfunc_name, PL_na)));
+ XPUSHs (sv_2mortal (newSVpv (vfunc_name, 0)));
}
g_base_info_unref (vfunc_info);
}
diff --git a/NEWS b/NEWS
index 40dd082..1aca2e4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Overview of changes in Glib::Object::Introspection <next>
+========================================================
+
+* Avoid misusing the macro PL_na, thus preventing issues when
+ Glib::Object::Introspection is used in conjunction with certain XS modules,
+ among them XML::Parser and String::Approx.
+* Fix build on MinGW with dmake.
+
Overview of changes in Glib::Object::Introspection 0.015
========================================================
diff --git a/gperl-i11n-croak.c b/gperl-i11n-croak.c
index 33b0ed8..6c41cac 100644
--- a/gperl-i11n-croak.c
+++ b/gperl-i11n-croak.c
@@ -12,7 +12,7 @@ call_carp_croak (const char *msg)
SAVETMPS;
PUSHMARK (SP);
- XPUSHs (sv_2mortal (newSVpv(msg, PL_na)));
+ XPUSHs (sv_2mortal (newSVpv(msg, 0)));
PUTBACK;
call_pv("Carp::croak", G_VOID | G_DISCARD);
@@ -31,7 +31,7 @@ call_carp_carp (const char *msg)
SAVETMPS;
PUSHMARK (SP);
- XPUSHs (sv_2mortal (newSVpv(msg, PL_na)));
+ XPUSHs (sv_2mortal (newSVpv(msg, 0)));
PUTBACK;
call_pv("Carp::carp", G_VOID | G_DISCARD);
diff --git a/gperl-i11n-field.c b/gperl-i11n-field.c
index 6c7c116..0d27537 100644
--- a/gperl-i11n-field.c
+++ b/gperl-i11n-field.c
@@ -21,7 +21,7 @@ store_fields (HV *fields, GIBaseInfo *info, GIInfoType info_type)
const gchar *field_name;
field_info = g_struct_info_get_field ((GIStructInfo *) info, i);
field_name = g_base_info_get_name ((GIBaseInfo *) field_info);
- av_push (av, newSVpv (field_name, PL_na));
+ av_push (av, newSVpv (field_name, 0));
g_base_info_unref ((GIBaseInfo *) field_info);
}
break;
@@ -35,7 +35,7 @@ store_fields (HV *fields, GIBaseInfo *info, GIInfoType info_type)
const gchar *field_name;
field_info = g_union_info_get_field ((GIUnionInfo *) info, i);
field_name = g_base_info_get_name ((GIBaseInfo *) field_info);
- av_push (av, newSVpv (field_name, PL_na));
+ av_push (av, newSVpv (field_name, 0));
g_base_info_unref ((GIBaseInfo *) field_info);
}
break;
diff --git a/gperl-i11n-marshal-arg.c b/gperl-i11n-marshal-arg.c
index 539b7e3..74cfa49 100644
--- a/gperl-i11n-marshal-arg.c
+++ b/gperl-i11n-marshal-arg.c
@@ -228,7 +228,7 @@ arg_to_sv (GIArgument * arg,
package = gperl_package_from_type (gtype);
if (!package)
package = g_type_name (gtype);
- return package ? newSVpv (package, PL_na) : &PL_sv_undef;
+ return package ? newSVpv (package, 0) : &PL_sv_undef;
}
case GI_TYPE_TAG_ARRAY:
@@ -258,7 +258,7 @@ arg_to_sv (GIArgument * arg,
case GI_TYPE_TAG_FILENAME:
{
- SV *sv = newSVpv (arg->v_string, PL_na);
+ SV *sv = newSVpv (arg->v_string, 0);
if (own)
g_free (arg->v_string);
return sv;
diff --git a/gperl-i11n-method.c b/gperl-i11n-method.c
index 1759721..9439e73 100644
--- a/gperl-i11n-method.c
+++ b/gperl-i11n-method.c
@@ -7,7 +7,7 @@
const gchar *function_name; \
function_info = g_ ## prefix ## _info_get_method (info, i); \
function_name = g_base_info_get_name (function_info); \
- av_push (av, newSVpv (function_name, PL_na)); \
+ av_push (av, newSVpv (function_name, 0)); \
g_base_info_unref (function_info); \
}
diff --git a/gperl-i11n-vfunc-object.c b/gperl-i11n-vfunc-object.c
index b2b5282..6e3f48f 100644
--- a/gperl-i11n-vfunc-object.c
+++ b/gperl-i11n-vfunc-object.c
@@ -6,7 +6,7 @@ store_objects_with_vfuncs (AV *objects_with_vfuncs, GIObjectInfo *info)
if (g_object_info_get_n_vfuncs (info) <= 0)
return;
av_push (objects_with_vfuncs,
- newSVpv (g_base_info_get_name (info), PL_na));
+ newSVpv (g_base_info_get_name (info), 0));
}
/* ------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]