]> git.vpit.fr Git - perl/modules/Sub-Nary.git/commitdiff
scale() shouldn't fill {}
authorVincent Pit <vince@profvince.com>
Thu, 21 Aug 2008 10:52:25 +0000 (12:52 +0200)
committerVincent Pit <vince@profvince.com>
Thu, 21 Aug 2008 10:52:25 +0000 (12:52 +0200)
Nary.xs
t/15-misc-xs.t

diff --git a/Nary.xs b/Nary.xs
index 66eced60f0e7e930024e74e4a3a8d453af9799c3..a64d6196ec7bbc66bc7c2d53fc367617e197c8ac 100644 (file)
--- a/Nary.xs
+++ b/Nary.xs
@@ -147,7 +147,7 @@ CODE:
  } else {
   hv = (HV *) SvRV(sv);
   if (!hv_iterinit(hv)) {
-   sn_store(res, "0", 1, newSVnv(c), 0);
+   XSRETURN_UNDEF;
   } else {
    hv_iterinit(hv);
    while (key = hv_iternext(hv)) {
index 42847e6d49e79cb9383c3e88f932d745462735b9..5453dbf008375003a1c864144d1cf943ab3a8bc8 100644 (file)
@@ -23,8 +23,8 @@ is_deeply(normalize({ list => 1, 2 => 2, 3 => 1 }),
 
 *scale = *Sub::Nary::scale{CODE};
 
-is_deeply(scale(1,   {}),            { 0 => 1 },    'scale 1, empty-ref');
-is_deeply(scale(0.5, {}),            { 0 => 0.5 },  'scale 0.5, empty-ref');
+is_deeply(scale(1,   {}),            undef,         'scale 1, empty-ref');
+is_deeply(scale(0.5, {}),            undef,         'scale 0.5, empty-ref');
 is_deeply(scale(0.5, { list => 2 }), { list => 1 }, 'scale 0.5, list');
 is_deeply(scale(0.5, { list => 2, 1 => 2 }), { list => 1, 1 => 1 },
                      'scale 0.5, list/const');