r58056 - in /trunk/libscope-upper-perl: Changes META.yml Makefile.PL README Upper.xs debian/changelog lib/Scope/Upper.pm t/20-localize-target.t t/34-localize_elem-magic.t t/44-localize_delete-magic.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Wed May 19 10:52:31 UTC 2010


Author: ansgar-guest
Date: Wed May 19 10:52:16 2010
New Revision: 58056

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=58056
Log:
New upstream release.

Modified:
    trunk/libscope-upper-perl/Changes
    trunk/libscope-upper-perl/META.yml
    trunk/libscope-upper-perl/Makefile.PL
    trunk/libscope-upper-perl/README
    trunk/libscope-upper-perl/Upper.xs
    trunk/libscope-upper-perl/debian/changelog
    trunk/libscope-upper-perl/lib/Scope/Upper.pm
    trunk/libscope-upper-perl/t/20-localize-target.t
    trunk/libscope-upper-perl/t/34-localize_elem-magic.t
    trunk/libscope-upper-perl/t/44-localize_delete-magic.t

Modified: trunk/libscope-upper-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/Changes?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/Changes (original)
+++ trunk/libscope-upper-perl/Changes Wed May 19 10:52:16 2010
@@ -1,4 +1,10 @@
 Revision history for Scope-Upper
+
+0.12    2010-05-19 00:45 UTC
+        + Fix : Compatibility with perl 5.13.
+        + Fix : Test failures with perl 5.8.0.
+        + Fix : A minor leak of SVs when a non array/hash was passed to
+                localize_elem().
 
 0.11    2010-04-16 23:20 UTC
         + Chg : It's now forbiddent to pass a reference to a non-glob variable

Modified: trunk/libscope-upper-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/META.yml?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/META.yml (original)
+++ trunk/libscope-upper-perl/META.yml Wed May 19 10:52:16 2010
@@ -1,12 +1,13 @@
 --- #YAML:1.0
 name:               Scope-Upper
-version:            0.11
+version:            0.12
 abstract:           Act on upper scopes.
 author:
     - Vincent Pit <perl at profvince.com>
 license:            perl
 distribution_type:  module
 configure_requires:
+    Config:               0
     ExtUtils::MakeMaker:  0
 build_requires:
     base:                 0

Modified: trunk/libscope-upper-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/Makefile.PL?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/Makefile.PL (original)
+++ trunk/libscope-upper-perl/Makefile.PL Wed May 19 10:52:16 2010
@@ -4,7 +4,21 @@
 use warnings;
 use ExtUtils::MakeMaker;
 
+use Config;
+
+my $pl   = $Config{perl_patchlevel};
+my $desc = $Config{git_describe};
+for ($pl, $desc) {
+ $_ = undef unless defined and length;
+}
+
 my @DEFINES;
+
+print "Checking if this is an official release of perl... ";
+my $is_release = ($] < 5.011) ? (defined($pl) || defined($desc) ? 0 : 1)
+                              : (defined($desc)                 ? 0 : 1);
+push @DEFINES, "-DSU_RELEASE=$is_release";
+print $is_release  ? "yes\n" : "no\n";
 
 # Threads, Windows and 5.8.x don't seem to be best friends
 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
@@ -28,6 +42,7 @@
 
 my %META = (
  configure_requires => {
+  'Config'              => 0,
   'ExtUtils::MakeMaker' => 0,
  },
  build_requires => {

Modified: trunk/libscope-upper-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/README?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/README (original)
+++ trunk/libscope-upper-perl/README Wed May 19 10:52:16 2010
@@ -2,7 +2,7 @@
     Scope::Upper - Act on upper scopes.
 
 VERSION
-    Version 0.11
+    Version 0.12
 
 SYNOPSIS
     "reap", "localize", "localize_elem", "localize_delete" and "WORDS" :

Modified: trunk/libscope-upper-perl/Upper.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/Upper.xs?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/Upper.xs (original)
+++ trunk/libscope-upper-perl/Upper.xs Wed May 19 10:52:16 2010
@@ -69,6 +69,7 @@
 #endif
 
 #define SU_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
+#define SU_HAS_PERL_EXACT(R, V, S) ((PERL_REVISION == (R)) && (PERL_VERSION == (V)) && (PERL_SUBVERSION == (S)))
 
 /* --- Threads and multiplicity -------------------------------------------- */
 
@@ -119,19 +120,55 @@
 #define MY_CXT_KEY __PACKAGE__ "::_guts" XS_VERSION
 
 typedef struct {
- int stack_placeholder;
- I32 cxix;
- I32 items;
+ char *stack_placeholder;
+ I32   cxix;
+ I32   items;
  SV  **savesp;
- OP  fakeop;
+ OP    fakeop;
 } my_cxt_t;
 
 START_MY_CXT
 
 /* --- Stack manipulations ------------------------------------------------- */
 
-#define SU_SAVE_DESTRUCTOR_SIZE 3
-#define SU_SAVE_INT_SIZE        3
+#define SU_SAVE_PLACEHOLDER() save_pptr(&MY_CXT.stack_placeholder)
+
+#define SU_SAVE_DESTRUCTOR_SIZE  3
+#define SU_SAVE_PLACEHOLDER_SIZE 3
+
+#define SU_SAVE_SCALAR_SIZE 3
+
+#define SU_SAVE_ARY_SIZE      3
+#define SU_SAVE_AELEM_SIZE    4
+#ifdef SAVEADELETE
+# define SU_SAVE_ADELETE_SIZE 3
+#else
+# define SU_SAVE_ADELETE_SIZE SU_SAVE_DESTRUCTOR_SIZE
+#endif
+#if SU_SAVE_AELEM_SIZE < SU_SAVE_ADELETE_SIZE
+# define SU_SAVE_AELEM_OR_ADELETE_SIZE SU_SAVE_ADELETE_SIZE
+#else
+# define SU_SAVE_AELEM_OR_ADELETE_SIZE SU_SAVE_AELEM_SIZE
+#endif
+
+#define SU_SAVE_HASH_SIZE    3
+#define SU_SAVE_HELEM_SIZE   4
+#define SU_SAVE_HDELETE_SIZE 4
+#if SU_SAVE_HELEM_SIZE < SU_SAVE_HDELETE_SIZE
+# define SU_SAVE_HELEM_OR_HDELETE_SIZE SU_SAVE_HDELETE_SIZE
+#else
+# define SU_SAVE_HELEM_OR_HDELETE_SIZE SU_SAVE_HELEM_SIZE
+#endif
+
+#define SU_SAVE_SPTR_SIZE 3
+
+#if !SU_HAS_PERL(5, 8, 9)
+# define SU_SAVE_GP_SIZE 6
+#elif !SU_HAS_PERL(5, 13, 0) || (SU_RELEASE && SU_HAS_PERL_EXACT(5, 13, 0))
+# define SU_SAVE_GP_SIZE 3
+#else
+# define SU_SAVE_GP_SIZE 4
+#endif
 
 #ifndef SvCANEXISTDELETE
 # define SvCANEXISTDELETE(sv) \
@@ -366,10 +403,18 @@
  svtype type;
 } su_ud_localize;
 
-STATIC void su_ud_localize_init(pTHX_ su_ud_localize *ud, SV *sv, SV *val, SV *elem) {
+#define SU_UD_LOCALIZE_FREE(U) STMT_START { \
+ SvREFCNT_dec((U)->elem); \
+ SvREFCNT_dec((U)->val);  \
+ SvREFCNT_dec((U)->sv);   \
+ SU_UD_FREE(U);           \
+} STMT_END
+
+STATIC I32 su_ud_localize_init(pTHX_ su_ud_localize *ud, SV *sv, SV *val, SV *elem) {
 #define su_ud_localize_init(UD, S, V, E) su_ud_localize_init(aTHX_ (UD), (S), (V), (E))
  UV deref = 0;
  svtype t = SVt_NULL;
+ I32 size;
 
  SvREFCNT_inc_simple_void(sv);
 
@@ -415,11 +460,25 @@
 
  switch (t) {
   case SVt_PVAV:
+   size  = elem ? SU_SAVE_AELEM_OR_ADELETE_SIZE
+                : SU_SAVE_ARY_SIZE;
+   deref = 0;
+   break;
   case SVt_PVHV:
+   size  = elem ? SU_SAVE_HELEM_OR_HDELETE_SIZE
+                : SU_SAVE_HASH_SIZE;
+   deref = 0;
+   break;
+  case SVt_PVGV:
+   size  = SU_SAVE_GP_SIZE;
+   deref = 0;
+   break;
   case SVt_PVCV:
-  case SVt_PVGV:
+   size  = SU_SAVE_SPTR_SIZE;
    deref = 0;
+   break;
   default:
+   size = SU_SAVE_SCALAR_SIZE;
    break;
  }
  /* When deref is set, val isn't NULL */
@@ -428,6 +487,8 @@
  ud->val  = val ? newSVsv(deref ? SvRV(val) : val) : NULL;
  ud->elem = SvREFCNT_inc(elem);
  ud->type = t;
+
+ return size;
 }
 
 STATIC void su_localize(pTHX_ void *ud_) {
@@ -493,10 +554,7 @@
   SvSetMagicSV((SV *) gv, val);
 
 done:
- SvREFCNT_dec(ud->elem);
- SvREFCNT_dec(ud->val);
- SvREFCNT_dec(ud->sv);
- SU_UD_FREE(ud);
+ SU_UD_LOCALIZE_FREE(ud);
 }
 
 /* --- Pop a context back -------------------------------------------------- */
@@ -548,7 +606,7 @@
     SU_D(PerlIO_printf(Perl_debug_log,
           "%p: push a pad slot at depth=%2d scope_ix=%2d save_ix=%2d\n",
            ud,                       depth, PL_scopestack_ix, PL_savestack_ix));
-    save_int(&MY_CXT.stack_placeholder);
+    SU_SAVE_PLACEHOLDER();
    } while (--pad);
   }
 
@@ -567,8 +625,8 @@
 
 /* --- Initialize the stack and the action userdata ------------------------ */
 
-STATIC I32 su_init(pTHX_ I32 cxix, void *ud, I32 size) {
-#define su_init(L, U, S) su_init(aTHX_ (L), (U), (S))
+STATIC I32 su_init(pTHX_ void *ud, I32 cxix, I32 size) {
+#define su_init(U, C, S) su_init(aTHX_ (U), (C), (S))
  I32 i, depth = 1, pad, offset, *origin;
 
  SU_D(PerlIO_printf(Perl_debug_log, "%p: ### init for cx %d\n", ud, cxix));
@@ -577,9 +635,11 @@
   pad = 0;
  else {
   I32 extra = size - SU_SAVE_DESTRUCTOR_SIZE;
-  pad = extra / SU_SAVE_INT_SIZE + ((extra % SU_SAVE_INT_SIZE) ? 1 : 0);
- }
- offset = SU_SAVE_DESTRUCTOR_SIZE + SU_SAVE_INT_SIZE * pad;
+  pad = extra / SU_SAVE_PLACEHOLDER_SIZE;
+  if (extra % SU_SAVE_PLACEHOLDER_SIZE)
+   ++pad;
+ }
+ offset = SU_SAVE_DESTRUCTOR_SIZE + SU_SAVE_PLACEHOLDER_SIZE * pad;
 
  SU_D(PerlIO_printf(Perl_debug_log, "%p: size=%d pad=%d offset=%d\n",
                                      ud,    size,   pad,   offset));
@@ -642,7 +702,7 @@
    SU_D(PerlIO_printf(Perl_debug_log,
                   "%p: push a fake slot      at scope_ix=%2d  save_ix=%2d\n",
                    ud,                      PL_scopestack_ix, PL_savestack_ix));
-   save_int(&MY_CXT.stack_placeholder);
+   SU_SAVE_PLACEHOLDER();
   } while (PL_savestack_ix + SU_SAVE_DESTRUCTOR_SIZE
                                         <= PL_scopestack[PL_scopestack_ix - 1]);
  }
@@ -818,7 +878,7 @@
  HV *stash;
 
  MY_CXT_INIT;
- MY_CXT.stack_placeholder = 0;
+ MY_CXT.stack_placeholder = NULL;
 
  stash = gv_stashpv(__PACKAGE__, 1);
  newCONSTSUB(stash, "TOP",           newSViv(0));
@@ -832,11 +892,11 @@
 void
 CLONE(...)
 PROTOTYPE: DISABLE
-CODE:
- PERL_UNUSED_VAR(items);
+PPCODE:
  {
   MY_CXT_CLONE;
  }
+ XSRETURN(0);
 
 #endif /* SU_THREADSAFE */
 
@@ -992,32 +1052,29 @@
  SU_UD_ORIGIN(ud)  = NULL;
  SU_UD_HANDLER(ud) = su_reap;
  ud->cb = newSVsv(hook);
- su_init(cxix, ud, 3);
+ su_init(ud, cxix, SU_SAVE_DESTRUCTOR_SIZE);
 
 void
 localize(SV *sv, SV *val, ...)
 PROTOTYPE: $$;$
 PREINIT:
  I32 cxix;
- I32 size = 3;
+ I32 size;
  su_ud_localize *ud;
 CODE:
  SU_GET_CONTEXT(2, 2);
  Newx(ud, 1, su_ud_localize);
  SU_UD_ORIGIN(ud)  = NULL;
  SU_UD_HANDLER(ud) = su_localize;
- su_ud_localize_init(ud, sv, val, NULL);
-#if !SU_HAS_PERL(5, 8, 9)
- if (ud->type >= SVt_PVGV)
-  size = 6;
-#endif
- su_init(cxix, ud, size);
+ size = su_ud_localize_init(ud, sv, val, NULL);
+ su_init(ud, cxix, size);
 
 void
 localize_elem(SV *sv, SV *elem, SV *val, ...)
 PROTOTYPE: $$$;$
 PREINIT:
  I32 cxix;
+ I32 size;
  su_ud_localize *ud;
 CODE:
  if (SvTYPE(sv) >= SVt_PVGV)
@@ -1026,28 +1083,24 @@
  Newx(ud, 1, su_ud_localize);
  SU_UD_ORIGIN(ud)  = NULL;
  SU_UD_HANDLER(ud) = su_localize;
- su_ud_localize_init(ud, sv, val, elem);
+ size = su_ud_localize_init(ud, sv, val, elem);
  if (ud->type != SVt_PVAV && ud->type != SVt_PVHV) {
-  Safefree(ud);
+  SU_UD_LOCALIZE_FREE(ud);
   croak("Can't localize an element of something that isn't an array or a hash");
  }
- su_init(cxix, ud, 4);
+ su_init(ud, cxix, size);
 
 void
 localize_delete(SV *sv, SV *elem, ...)
 PROTOTYPE: $$;$
 PREINIT:
  I32 cxix;
- I32 size = 4;
+ I32 size;
  su_ud_localize *ud;
 CODE:
  SU_GET_CONTEXT(2, 2);
  Newx(ud, 1, su_ud_localize);
  SU_UD_ORIGIN(ud)  = NULL;
  SU_UD_HANDLER(ud) = su_localize;
- su_ud_localize_init(ud, sv, NULL, elem);
-#if !SU_HAS_PERL(5, 8, 9)
- if (ud->type >= SVt_PVGV)
-  size = 6;
-#endif
- su_init(cxix, ud, size);
+ size = su_ud_localize_init(ud, sv, NULL, elem);
+ su_init(ud, cxix, size);

Modified: trunk/libscope-upper-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/debian/changelog?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/debian/changelog (original)
+++ trunk/libscope-upper-perl/debian/changelog Wed May 19 10:52:16 2010
@@ -1,3 +1,9 @@
+libscope-upper-perl (0.12-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Wed, 19 May 2010 19:52:03 +0900
+
 libscope-upper-perl (0.11-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libscope-upper-perl/lib/Scope/Upper.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/lib/Scope/Upper.pm?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/lib/Scope/Upper.pm (original)
+++ trunk/libscope-upper-perl/lib/Scope/Upper.pm Wed May 19 10:52:16 2010
@@ -9,13 +9,13 @@
 
 =head1 VERSION
 
-Version 0.11
+Version 0.12
 
 =cut
 
 our $VERSION;
 BEGIN {
- $VERSION = '0.11';
+ $VERSION = '0.12';
 }
 
 =head1 SYNOPSIS

Modified: trunk/libscope-upper-perl/t/20-localize-target.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/t/20-localize-target.t?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/t/20-localize-target.t (original)
+++ trunk/libscope-upper-perl/t/20-localize-target.t Wed May 19 10:52:16 2010
@@ -66,7 +66,7 @@
 
 SKIP:
 {
- skip 'Can\'t localize through a reference in 5.6' => 2 if $] < 5.008;
+ skip 'Can\'t localize through a reference before 5.8.1' => 2 if $] < 5.008001;
  eval q{
   no strict 'refs';
   local ${''} = 9;
@@ -80,7 +80,7 @@
 
 SKIP:
 {
- skip 'Can\'t localize through a reference in 5.6' => 2 if $] < 5.008;
+ skip 'Can\'t localize through a reference before 5.8.1' => 2 if $] < 5.008001;
  eval q{
   no strict 'refs';
   local ${''} = 10;

Modified: trunk/libscope-upper-perl/t/34-localize_elem-magic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/t/34-localize_elem-magic.t?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/t/34-localize_elem-magic.t (original)
+++ trunk/libscope-upper-perl/t/34-localize_elem-magic.t Wed May 19 10:52:16 2010
@@ -20,9 +20,10 @@
 
 our @a;
 
-tie @a, 'Scope::Upper::Test::TiedArray';
 {
- local @a = (5 .. 7);
+ local @a;
+ tie @a, 'Scope::Upper::Test::TiedArray';
+ @a = (5 .. 7);
  {
   localize_elem '@a', 4 => 12 => HERE;
   is_deeply \@a, [ 5 .. 7, undef, 12 ], 'localize_elem @incomplete_tied_array, $nonexistent, 12 => HERE [ok]';

Modified: trunk/libscope-upper-perl/t/44-localize_delete-magic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-upper-perl/t/44-localize_delete-magic.t?rev=58056&op=diff
==============================================================================
--- trunk/libscope-upper-perl/t/44-localize_delete-magic.t (original)
+++ trunk/libscope-upper-perl/t/44-localize_delete-magic.t Wed May 19 10:52:16 2010
@@ -25,9 +25,10 @@
 
 our @a;
 
-tie @a, 'Scope::Upper::Test::TiedArray';
 {
- local @a = (5 .. 7);
+ local @a;
+ tie @a, 'Scope::Upper::Test::TiedArray';
+ @a = (5 .. 7);
  local $a[4] = 9;
  is $deleted, undef, 'localize_delete @tied_array, $existent => HERE [not deleted]';
  {
@@ -40,7 +41,9 @@
 }
 
 {
- local @a = (4 .. 6);
+ local @a;
+ tie @a, 'Scope::Upper::Test::TiedArray';
+ @a = (4 .. 6);
  local $a[4] = 7;
  {
   localize_delete '@main::a', -1 => HERE;
@@ -53,7 +56,9 @@
 {
  skip '$NEGATIVE_INDICES has no special meaning on 5.8.0 and older' => 2 if $] < 5.008_001;
  local $Scope::Upper::Test::TiedArray::NEGATIVE_INDICES = 1;
- local @a = (4 .. 6);
+ local @a;
+ tie @a, 'Scope::Upper::Test::TiedArray';
+ @a = (4 .. 6);
  local $a[4] = 7;
  {
   localize_delete '@main::a', -1 => HERE;




More information about the Pkg-perl-cvs-commits mailing list