perl-GStreamer r88 - in trunk: . xs
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-GStreamer r88 - in trunk: . xs
- Date: Wed, 26 Nov 2008 21:17:37 +0000 (UTC)
Author: tsch
Date: Wed Nov 26 21:17:36 2008
New Revision: 88
URL: http://svn.gnome.org/viewvc/perl-GStreamer?rev=88&view=rev
Log:
Use gperl_sv_is_defined, gperl_sv_is_array_ref, and gperl_sv_is_hash_ref where
appropriate.
Modified:
trunk/ChangeLog
trunk/xs/GstIndex.xs
trunk/xs/GstStructure.xs
trunk/xs/GstTag.xs
trunk/xs/GstValue.xs
Modified: trunk/xs/GstIndex.xs
==============================================================================
--- trunk/xs/GstIndex.xs (original)
+++ trunk/xs/GstIndex.xs Wed Nov 26 21:17:36 2008
@@ -109,7 +109,7 @@
croak ("resolver callback must return one value: the writer string");
string = POPs;
- if (SvOK (string)) {
+ if (gperl_sv_is_defined (string)) {
*writer_string = g_strdup (SvGChar (string));
retval = TRUE;
} else {
Modified: trunk/xs/GstStructure.xs
==============================================================================
--- trunk/xs/GstStructure.xs (original)
+++ trunk/xs/GstStructure.xs Wed Nov 26 21:17:36 2008
@@ -31,13 +31,13 @@
HV *hv;
SV **name, **fields;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVHV)
+ if (!gperl_sv_is_hash_ref (sv))
croak ("GstStructure must be a hash reference");
hv = (HV *) SvRV (sv);
name = hv_fetch (hv, "name", 4, 0);
- if (!name || !SvOK (*name))
+ if (!name || !gperl_sv_is_defined (*name))
croak ("GstStructure must contain a 'name' key");
/* This leaks the structure when we croak further down, but I think
@@ -45,7 +45,7 @@
structure = gst_structure_empty_new (SvPV_nolen (*name));
fields = hv_fetch (hv, "fields", 6, 0);
- if (fields && SvOK (*fields)) {
+ if (fields && gperl_sv_is_defined (*fields)) {
AV *fields_av;
int i;
@@ -60,7 +60,7 @@
field = av_fetch (fields_av, i, 0);
- if (!field || !SvOK (*field) || !SvRV (*field) || SvTYPE (SvRV (*field)) != SVt_PVAV)
+ if (!field || !gperl_sv_is_array_ref (*field))
croak ("The 'fields' array must contain array references");
field_av = (AV *) SvRV (*field);
@@ -72,9 +72,9 @@
field_type = av_fetch (field_av, 1, 0);
field_value = av_fetch (field_av, 2, 0);
- if (field_name && SvOK (*field_name) &&
- field_type && SvOK (*field_type) &&
- field_value && SvOK (*field_value)) {
+ if (field_name && gperl_sv_is_defined (*field_name) &&
+ field_type && gperl_sv_is_defined (*field_type) &&
+ field_value && gperl_sv_is_defined (*field_value)) {
GValue value = { 0, };
const char *package = SvPV_nolen (*field_type);
Modified: trunk/xs/GstTag.xs
==============================================================================
--- trunk/xs/GstTag.xs (original)
+++ trunk/xs/GstTag.xs Wed Nov 26 21:17:36 2008
@@ -85,7 +85,7 @@
continue;
ref = hv_iterval (hv, he);
- if (!(SvOK (ref) && SvROK (ref) && SvTYPE (SvRV (ref)) == SVt_PVAV))
+ if (!gperl_sv_is_array_ref (ref))
croak ("The values inside of GstTagList's have to be array references");
type = gst_tag_get_type (tag);
@@ -95,7 +95,7 @@
GValue value = { 0 };
SV **entry = av_fetch (av, i, 0);
- if (!(entry && SvOK (*entry)))
+ if (!(entry && gperl_sv_is_defined (*entry)))
continue; /* FIXME: Why not croak here, too? */
g_value_init (&value, type);
Modified: trunk/xs/GstValue.xs
==============================================================================
--- trunk/xs/GstValue.xs (original)
+++ trunk/xs/GstValue.xs Wed Nov 26 21:17:36 2008
@@ -74,7 +74,7 @@
AV *av;
SV **start, **end;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GStreamer::DoubleRange values must be array references");
av = (AV *) SvRV (sv);
@@ -85,7 +85,7 @@
start = av_fetch (av, 0, 0);
end = av_fetch (av, 1, 0);
- if (start && SvOK (*start) && end && SvOK (*end))
+ if (start && gperl_sv_is_defined (*start) && end && gperl_sv_is_defined (*end))
gst_value_set_double_range (value, SvNV (*start), SvNV (*end));
}
@@ -121,7 +121,7 @@
AV *av;
SV **start, **end;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GstIntRange must be an array reference");
av = (AV *) SvRV (sv);
@@ -132,7 +132,7 @@
start = av_fetch (av, 0, 0);
end = av_fetch (av, 1, 0);
- if (start && SvOK (*start) && end && SvOK (*end))
+ if (start && gperl_sv_is_defined (*start) && end && gperl_sv_is_defined (*end))
gst_value_set_int_range (value, SvIV (*start), SvIV (*end));
}
@@ -178,7 +178,7 @@
AV *av;
int i;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GstValueList must be an array reference");
av = (AV *) SvRV (sv);
@@ -188,7 +188,7 @@
list_value = av_fetch (av, i, 0);
- if (!list_value || !SvOK (*list_value) || !SvRV (*list_value) || SvTYPE (SvRV (*list_value)) != SVt_PVAV)
+ if (!list_value || !gperl_sv_is_array_ref (*list_value))
croak ("GstValueList must contain array references");
list_av = (AV *) SvRV (*list_value);
@@ -199,7 +199,7 @@
element = av_fetch (list_av, 0, 0);
type = av_fetch (list_av, 1, 0);
- if (element && SvOK (*element) && type && SvOK (*type)) {
+ if (element && gperl_sv_is_defined (*element) && type && gperl_sv_is_defined (*type)) {
GValue new_value = { 0, };
const char *package = SvPV_nolen (*type);
@@ -262,7 +262,7 @@
AV *av;
int i;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GstValueArray must be an array reference");
av = (AV *) SvRV (sv);
@@ -272,7 +272,7 @@
list_value = av_fetch (av, i, 0);
- if (!list_value || !SvOK (*list_value) || !SvRV (*list_value) || SvTYPE (SvRV (*list_value)) != SVt_PVAV)
+ if (!list_value || !gperl_sv_is_array_ref (*list_value))
croak ("GstValueArray must contain array references");
list_av = (AV *) SvRV (*list_value);
@@ -283,7 +283,7 @@
element = av_fetch (list_av, 0, 0);
type = av_fetch (list_av, 1, 0);
- if (element && SvOK (*element) && type && SvOK (*type)) {
+ if (element && gperl_sv_is_defined (*element) && type && gperl_sv_is_defined (*type)) {
GValue new_value = { 0, };
const char *package = SvPV_nolen (*type);
@@ -334,7 +334,7 @@
AV *av;
SV **numerator, **denominator;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GstFraction must be an array reference");
av = (AV *) SvRV (sv);
@@ -345,7 +345,7 @@
numerator = av_fetch (av, 0, 0);
denominator = av_fetch (av, 1, 0);
- if (numerator && SvOK (*numerator) && denominator && SvOK (*denominator))
+ if (numerator && gperl_sv_is_defined (*numerator) && denominator && gperl_sv_is_defined (*denominator))
gst_value_set_fraction (value, SvIV (*numerator), SvIV (*denominator));
}
@@ -381,7 +381,7 @@
AV *av;
SV **start, **end;
- if (!SvOK (sv) || !SvRV (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV)
+ if (!gperl_sv_is_array_ref (sv))
croak ("GstFractionRange must be an array reference");
av = (AV *) SvRV (sv);
@@ -392,7 +392,7 @@
start = av_fetch (av, 0, 0);
end = av_fetch (av, 1, 0);
- if (start && SvOK (*start) && end && SvOK (*end)) {
+ if (start && gperl_sv_is_defined (*start) && end && gperl_sv_is_defined (*end)) {
GValue start_value = { 0, }, end_value = { 0, };
g_value_init (&start_value, GST_TYPE_FRACTION);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]