[perl-Glib] Use gperl_hv_take_sv throughout
- From: Torsten Schönfeld <tsch src gnome org>
- To: svn-commits-list gnome org
- Subject: [perl-Glib] Use gperl_hv_take_sv throughout
- Date: Thu, 18 Jun 2009 14:43:24 -0400 (EDT)
commit 75d05ff2a5e361c9ae71ef85ee8413558a13806b
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Thu Jun 18 20:41:36 2009 +0200
Use gperl_hv_take_sv throughout
This hushes compiler warnings and makes the code more correct.
GError.xs | 17 ++++++++---------
GParamSpec.xs | 12 ++++++------
GSignal.xs | 30 +++++++++++++++---------------
GType.xs | 12 ++++++------
4 files changed, 35 insertions(+), 36 deletions(-)
---
diff --git a/GError.xs b/GError.xs
index 814f185..dbc11fb 100644
--- a/GError.xs
+++ b/GError.xs
@@ -173,22 +173,21 @@ gperl_sv_from_gerror (GError * error)
info = error_info_from_domain (error->domain);
hv = newHV ();
- hv_store (hv, "domain", 6,
- newSVGChar (g_quark_to_string (error->domain)), 0);
- hv_store (hv, "code", 4, newSViv (error->code), 0);
+ gperl_hv_take_sv (hv, "domain",
+ newSVGChar (g_quark_to_string (error->domain)));
+ gperl_hv_take_sv (hv, "code", newSViv (error->code));
if (info)
- hv_store (hv, "value", 5,
- gperl_convert_back_enum (info->error_enum,
- error->code),
- 0);
- hv_store (hv, "message", 7, newSVGChar (error->message), 0);
+ gperl_hv_take_sv (hv, "value",
+ gperl_convert_back_enum (info->error_enum,
+ error->code));
+ gperl_hv_take_sv (hv, "message", newSVGChar (error->message));
/* WARNING: using evil undocumented voodoo. mess() is the function
* that die(), warn(), and croak() use to format messages, and it's
* what knows how to find the code location. don't want to do that
* ourselves, since that's blacker magic, so we'll call this and
* hope the perl API doesn't change. */
- hv_store (hv, "location", 8, newSVsv (mess ("")), 0);
+ gperl_hv_take_sv (hv, "location", newSVsv (mess ("")));
package = info ? info->package : "Glib::Error";
diff --git a/GParamSpec.xs b/GParamSpec.xs
index d018aa1..6c3782c 100644
--- a/GParamSpec.xs
+++ b/GParamSpec.xs
@@ -161,23 +161,23 @@ newSVGParamSpec (GParamSpec * pspec)
* paramspec list returned from Glib::Object::list_properties())
* we store a few select keys in the hash directly.
*/
- hv_store (property, "name", 4,
- newSVpv (g_param_spec_get_name (pspec), 0), 0);
+ gperl_hv_take_sv (property, "name",
+ newSVpv (g_param_spec_get_name (pspec), 0));
/* map type names to package names, if possible */
pv = gperl_package_from_type (pspec->value_type);
if (!pv) pv = g_type_name (pspec->value_type);
- hv_store (property, "type", 4, newSVpv (pv, 0), 0);
+ gperl_hv_take_sv (property, "type", newSVpv (pv, 0));
pv = gperl_package_from_type (pspec->owner_type);
if (!pv)
pv = g_type_name (pspec->owner_type);
if (pv)
- hv_store (property, "owner_type", 10, newSVpv (pv, 0), 0);
+ gperl_hv_take_sv (property, "owner_type", newSVpv (pv, 0));
pv = g_param_spec_get_blurb (pspec);
- if (pv) hv_store (property, "descr", 5, newSVpv (pv, 0), 0);
- hv_store (property, "flags", 5, newSVGParamFlags (pspec->flags), 0) ;
+ if (pv) gperl_hv_take_sv (property, "descr", newSVpv (pv, 0));
+ gperl_hv_take_sv (property, "flags", newSVGParamFlags (pspec->flags));
/* wrap it, bless it, ship it. */
sv = newRV_noinc ((SV*)property);
diff --git a/GSignal.xs b/GSignal.xs
index e821c26..9ebd795 100644
--- a/GSignal.xs
+++ b/GSignal.xs
@@ -89,12 +89,12 @@ SV *
newSVGSignalInvocationHint (GSignalInvocationHint * ihint)
{
HV * hv = newHV ();
- hv_store (hv, "signal_name", 11,
- newSVGChar (g_signal_name (ihint->signal_id)), 0);
- hv_store (hv, "detail", 6,
- newSVGChar (g_quark_to_string (ihint->detail)), 0);
- hv_store (hv, "run_type", 8,
- newSVGSignalFlags (ihint->run_type), 0);
+ gperl_hv_take_sv (hv, "signal_name",
+ newSVGChar (g_signal_name (ihint->signal_id)));
+ gperl_hv_take_sv (hv, "detail",
+ newSVGChar (g_quark_to_string (ihint->detail)));
+ gperl_hv_take_sv (hv, "run_type",
+ newSVGSignalFlags (ihint->run_type));
return newRV_noinc ((SV*)hv);
}
@@ -115,20 +115,20 @@ newSVGSignalQuery (GSignalQuery * query)
return &PL_sv_undef;
hv = newHV ();
- hv_store (hv, "signal_id", 9, newSViv (query->signal_id), 0);
- hv_store (hv, "signal_name", 11,
- newSVpv (query->signal_name, 0), 0);
+ gperl_hv_take_sv (hv, "signal_id", newSViv (query->signal_id));
+ gperl_hv_take_sv (hv, "signal_name",
+ newSVpv (query->signal_name, 0));
GET_NAME (pkgname, query->itype);
if (pkgname)
- hv_store (hv, "itype", 5, newSVpv (pkgname, 0), 0);
- hv_store (hv, "signal_flags", 12,
- newSVGSignalFlags (query->signal_flags), 0);
+ gperl_hv_take_sv (hv, "itype", newSVpv (pkgname, 0));
+ gperl_hv_take_sv (hv, "signal_flags",
+ newSVGSignalFlags (query->signal_flags));
if (query->return_type != G_TYPE_NONE) {
GType t = query->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
GET_NAME (pkgname, t);
if (pkgname)
- hv_store (hv, "return_type", 11,
- newSVpv (pkgname, 0), 0);
+ gperl_hv_take_sv (hv, "return_type",
+ newSVpv (pkgname, 0));
}
av = newAV ();
for (j = 0; j < query->n_params; j++) {
@@ -136,7 +136,7 @@ newSVGSignalQuery (GSignalQuery * query)
GET_NAME (pkgname, t);
av_push (av, newSVpv (pkgname, 0));
}
- hv_store (hv, "param_types", 11, newRV_noinc ((SV*)av), 0);
+ gperl_hv_take_sv (hv, "param_types", newRV_noinc ((SV*)av));
/* n_params is inferred by the length of the av in param_types */
return newRV_noinc ((SV*)hv);
diff --git a/GType.xs b/GType.xs
index c3fdc75..6fd7c30 100644
--- a/GType.xs
+++ b/GType.xs
@@ -2696,18 +2696,18 @@ list_values (class, const char * package)
GEnumValue * v = gperl_type_enum_get_values (type);
for ( ; v && v->value_nick && v->value_name ; v++) {
HV * hv = newHV ();
- hv_store (hv, "value",5, newSViv (v->value), 0);
- hv_store (hv, "nick", 4, newSVpv (v->value_nick, 0), 0);
- hv_store (hv, "name", 4, newSVpv (v->value_name, 0), 0);
+ gperl_hv_take_sv (hv, "value", newSViv (v->value));
+ gperl_hv_take_sv (hv, "nick", newSVpv (v->value_nick, 0));
+ gperl_hv_take_sv (hv, "name", newSVpv (v->value_name, 0));
XPUSHs (sv_2mortal (newRV_noinc ((SV*)hv)));
}
} else if (G_TYPE_IS_FLAGS (type)) {
GFlagsValue * v = gperl_type_flags_get_values (type);
for ( ; v && v->value_nick && v->value_name ; v++) {
HV * hv = newHV ();
- hv_store (hv, "value",5, newSVuv (v->value), 0);
- hv_store (hv, "nick", 4, newSVpv (v->value_nick, 0), 0);
- hv_store (hv, "name", 4, newSVpv (v->value_name, 0), 0);
+ gperl_hv_take_sv (hv, "value", newSVuv (v->value));
+ gperl_hv_take_sv (hv, "nick", newSVpv (v->value_nick, 0));
+ gperl_hv_take_sv (hv, "name", newSVpv (v->value_name, 0));
XPUSHs (sv_2mortal (newRV_noinc ((SV*)hv)));
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]