Author: julianalbo
Date: Mon Dec 1 02:08:07 2008
New Revision: 33417
Modified:
trunk/src/pmc/null.pmc
trunk/src/pmc/string.pmc
Log:
fix is_same with pmc string and null and with null pmc, parrot-tickets#11
Modified: trunk/src/pmc/null.pmc
==============================================================================
--- trunk/src/pmc/null.pmc (original)
+++ trunk/src/pmc/null.pmc Mon Dec 1 02:08:07 2008
@@ -50,6 +50,19 @@
return 0;
}
+/*
+
+=item C<INTVAL is_same(PMC *value)>
+
+Returns true if value is also a null PMC, false otherwise.
+
+=cut
+
+*/
+ VTABLE INTVAL is_same(PMC *value) {
+ return PMC_IS_NULL(value);
+ }
+
}
/*
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc (original)
+++ trunk/src/pmc/string.pmc Mon Dec 1 02:08:07 2008
@@ -497,9 +497,14 @@
*/
VTABLE INTVAL is_same(PMC *value) {
- const STRING * const s = VTABLE_get_string(INTERP, SELF);
- const STRING * const v = VTABLE_get_string(INTERP, value);
- return (INTVAL)(value->vtable == SELF->vtable && s == v);
+ if (PMC_IS_NULL(value)) {
+ return 0;
+ }
+ else {
+ const STRING * const s = VTABLE_get_string(INTERP, SELF);
+ const STRING * const v = VTABLE_get_string(INTERP, value);
+ return (INTVAL)(value->vtable == SELF->vtable && s == v);
+ }
}
/*