r65234 - in /branches/upstream/libvariable-magic-perl/current: Changes META.yml Magic.xs README lib/Variable/Magic.pm ptable.h t/16-huf.t t/17-ctl.t t/25-copy.t t/28-uvar.t t/30-scalar.t t/34-glob.t t/40-threads.t t/41-clone.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Wed Nov 24 09:25:50 UTC 2010
Author: angelabad-guest
Date: Wed Nov 24 09:25:38 2010
New Revision: 65234
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65234
Log:
[svn-upgrade] new version libvariable-magic-perl (0.45)
Modified:
branches/upstream/libvariable-magic-perl/current/Changes
branches/upstream/libvariable-magic-perl/current/META.yml
branches/upstream/libvariable-magic-perl/current/Magic.xs
branches/upstream/libvariable-magic-perl/current/README
branches/upstream/libvariable-magic-perl/current/lib/Variable/Magic.pm
branches/upstream/libvariable-magic-perl/current/ptable.h
branches/upstream/libvariable-magic-perl/current/t/16-huf.t
branches/upstream/libvariable-magic-perl/current/t/17-ctl.t
branches/upstream/libvariable-magic-perl/current/t/25-copy.t
branches/upstream/libvariable-magic-perl/current/t/28-uvar.t
branches/upstream/libvariable-magic-perl/current/t/30-scalar.t
branches/upstream/libvariable-magic-perl/current/t/34-glob.t
branches/upstream/libvariable-magic-perl/current/t/40-threads.t
branches/upstream/libvariable-magic-perl/current/t/41-clone.t
Modified: branches/upstream/libvariable-magic-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/Changes?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/Changes (original)
+++ branches/upstream/libvariable-magic-perl/current/Changes Wed Nov 24 09:25:38 2010
@@ -1,4 +1,16 @@
Revision history for Variable-Magic
+
+0.45 2010-11-21 23:15 UTC
+ This is a maintenance release. The code contains no functional change.
+ Users of 0.44 can skip this update.
+ + Doc : C++ compilers are officially NOT supported.
+ + Doc : The minimum perl 5.10.0 requirement for uvar magic has been
+ made more explicit.
+ Thanks Peter Rabbitson for pointing this out and contributing a
+ patch.
+ + Tst : Tune for perl 5.13.7.
+ + Tst : Capture::Tiny will be used in t/17-ctl.t if and only if it can
+ capture a simple run.
0.44 2010-09-24 19:10 UTC
+ Fix : Broken linkage on Windows with gcc 3.4, which appears in
Modified: branches/upstream/libvariable-magic-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/META.yml?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/META.yml (original)
+++ branches/upstream/libvariable-magic-perl/current/META.yml Wed Nov 24 09:25:38 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Variable-Magic
-version: 0.44
+version: 0.45
abstract: Associate user-defined magic to variables from Perl.
author:
- Vincent Pit <perl at profvince.com>
Modified: branches/upstream/libvariable-magic-perl/current/Magic.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/Magic.xs?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/Magic.xs (original)
+++ branches/upstream/libvariable-magic-perl/current/Magic.xs Wed Nov 24 09:25:38 2010
@@ -11,6 +11,13 @@
#include "XSUB.h"
#define __PACKAGE__ "Variable::Magic"
+
+#undef VOID2
+#ifdef __cplusplus
+# define VOID2(T, P) static_cast<T>(P)
+#else
+# define VOID2(T, P) (P)
+#endif
#ifndef VMG_PERL_PATCHLEVEL
# ifdef PERL_PATCHNUM
@@ -543,7 +550,7 @@
#if VMG_THREADSAFE
#define PTABLE_NAME ptable
-#define PTABLE_VAL_FREE(V) vmg_mgwiz_free(V)
+#define PTABLE_VAL_FREE(V) vmg_mgwiz_free(VOID2(MGWIZ *, (V)))
#define pPTBL pTHX
#define pPTBL_ pTHX_
@@ -573,13 +580,13 @@
#if VMG_THREADSAFE
STATIC void vmg_ptable_clone(pTHX_ ptable_ent *ent, void *ud_) {
- my_cxt_t *ud = ud_;
+ my_cxt_t *ud = VOID2(my_cxt_t *, ud_);
MGWIZ *w;
if (ud->owner == aTHX)
return;
- w = vmg_mgwiz_clone(ent->val);
+ w = vmg_mgwiz_clone(VOID2(MGWIZ *, ent->val));
if (w)
ptable_store(ud->wizards, ent->key, w);
}
@@ -672,7 +679,7 @@
{
dMY_CXT;
- return ptable_fetch(MY_CXT.wizards, w);
+ return VOID2(const MGWIZ *, ptable_fetch(MY_CXT.wizards, w));
}
}
@@ -966,7 +973,7 @@
case VMG_OP_INFO_OBJECT: {
dMY_CXT;
if (!MY_CXT.b__op_stashes[0]) {
- opclass c;
+ int c;
require_pv("B.pm");
for (c = OPc_NULL; c < OPc_MAX; ++c)
MY_CXT.b__op_stashes[c] = gv_stashpv(vmg_opclassnames[c], 1);
@@ -1087,7 +1094,7 @@
if (t < SVt_PVAV) {
STRLEN l;
#if VMG_HAS_PERL(5, 9, 3)
- const U8 *s = SvPV_const(sv, l);
+ const U8 *s = VOID2(const U8 *, VOID2(const void *, SvPV_const(sv, l)));
#else
U8 *s = SvPV(sv, l);
#endif
@@ -1390,7 +1397,7 @@
PREINIT:
ptable *t;
U32 had_b__op_stash = 0;
- opclass c;
+ int c;
PPCODE:
{
my_cxt_t ud;
Modified: branches/upstream/libvariable-magic-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/README?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/README (original)
+++ branches/upstream/libvariable-magic-perl/current/README Wed Nov 24 09:25:38 2010
@@ -2,7 +2,7 @@
Variable::Magic - Associate user-defined magic to variables from Perl.
VERSION
- Version 0.44
+ Version 0.45
SYNOPSIS
use Variable::Magic qw/wizard cast VMG_OP_INFO_NAME/;
@@ -307,7 +307,8 @@
"VMG_UVAR"
When this constant is true, you can use the "fetch,store,exists,delete"
- callbacks on hashes.
+ callbacks on hashes. Initial VMG_UVAR capability was introduced in perl
+ 5.9.5, with a fully functional implementation shipped with perl 5.10.0.
"VMG_COMPAT_ARRAY_PUSH_NOLEN"
True for perls that don't call 'len' magic when you push an element in a
@@ -495,8 +496,14 @@
this destructor won't be called because the wizard will be destroyed
first.
+ In order to define magic on hash members, you need at least perl 5.10.0
+ (see "VMG_UVAR")
+
DEPENDENCIES
perl 5.8.
+
+ A C compiler. This module may happen to build with a C++ compiler as
+ well, but don't rely on it, as no guarantee is made in this regard.
Carp (standard since perl 5), XSLoader (standard since perl 5.006).
Modified: branches/upstream/libvariable-magic-perl/current/lib/Variable/Magic.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/lib/Variable/Magic.pm?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/lib/Variable/Magic.pm (original)
+++ branches/upstream/libvariable-magic-perl/current/lib/Variable/Magic.pm Wed Nov 24 09:25:38 2010
@@ -11,13 +11,13 @@
=head1 VERSION
-Version 0.44
+Version 0.45
=cut
our $VERSION;
BEGIN {
- $VERSION = '0.44';
+ $VERSION = '0.45';
}
=head1 SYNOPSIS
@@ -159,7 +159,7 @@
=back
-The following actions only apply to hashes and are available iff C<VMG_UVAR> is true.
+The following actions only apply to hashes and are available iff L</VMG_UVAR> is true.
They are referred to as C<uvar> magics.
=over 4
@@ -381,6 +381,8 @@
=head2 C<VMG_UVAR>
When this constant is true, you can use the C<fetch,store,exists,delete> callbacks on hashes.
+Initial VMG_UVAR capability was introduced in perl 5.9.5, with a fully functional implementation
+shipped with perl 5.10.0.
=head2 C<VMG_COMPAT_ARRAY_PUSH_NOLEN>
@@ -600,9 +602,14 @@
If you define a wizard with a C<free> callback and cast it on itself, this destructor won't be called because the wizard will be destroyed first.
+In order to define magic on hash members, you need at least L<perl> 5.10.0 (see L</VMG_UVAR>)
+
=head1 DEPENDENCIES
L<perl> 5.8.
+
+A C compiler.
+This module may happen to build with a C++ compiler as well, but don't rely on it, as no guarantee is made in this regard.
L<Carp> (standard since perl 5), L<XSLoader> (standard since perl 5.006).
Modified: branches/upstream/libvariable-magic-perl/current/ptable.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/ptable.h?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/ptable.h (original)
+++ branches/upstream/libvariable-magic-perl/current/ptable.h Wed Nov 24 09:25:38 2010
@@ -8,6 +8,13 @@
/* This header is designed to be included several times with different
* definitions for PTABLE_NAME and PTABLE_VAL_FREE(). */
+
+#undef VOID2
+#ifdef __cplusplus
+# define VOID2(T, P) static_cast<T>(P)
+#else
+# define VOID2(T, P) (P)
+#endif
#undef pPTBLMS
#undef pPTBLMS_
@@ -22,7 +29,7 @@
# define aPTBLMS aTHX
# define aPTBLMS_ aTHX_
#else
-# define pPTBLMS
+# define pPTBLMS void
# define pPTBLMS_
# define aPTBLMS
# define aPTBLMS_
@@ -79,10 +86,11 @@
#ifndef ptable_new
STATIC ptable *ptable_new(pPTBLMS) {
#define ptable_new() ptable_new(aPTBLMS)
- ptable *t = PerlMemShared_malloc(sizeof *t);
- t->max = 15;
- t->items = 0;
- t->ary = PerlMemShared_calloc(t->max + 1, sizeof *t->ary);
+ ptable *t = VOID2(ptable *, PerlMemShared_malloc(sizeof *t));
+ t->max = 15;
+ t->items = 0;
+ t->ary = VOID2(ptable_ent **,
+ PerlMemShared_calloc(t->max + 1, sizeof *t->ary));
return t;
}
#endif /* !ptable_new */
@@ -125,7 +133,7 @@
size_t newsize = oldsize * 2;
size_t i;
- ary = PerlMemShared_realloc(ary, newsize * sizeof(*ary));
+ ary = VOID2(ptable_ent **, PerlMemShared_realloc(ary, newsize * sizeof(*ary)));
Zero(&ary[oldsize], newsize - oldsize, sizeof(*ary));
t->max = --newsize;
t->ary = ary;
@@ -157,7 +165,7 @@
ent->val = val;
} else if (val) {
const size_t i = PTABLE_HASH(key) & t->max;
- ent = PerlMemShared_malloc(sizeof *ent);
+ ent = VOID2(ptable_ent *, PerlMemShared_malloc(sizeof *ent));
ent->key = key;
ent->val = val;
ent->next = t->ary[i];
@@ -165,6 +173,27 @@
t->items++;
if (ent->next && t->items > t->max)
ptable_split(t);
+ }
+}
+
+STATIC void PTABLE_PREFIX(_delete)(pPTBL_ ptable * const t, const void * const key) {
+ ptable_ent *prev, *ent;
+ const size_t i = PTABLE_HASH(key) & t->max;
+
+ prev = NULL;
+ ent = t->ary[i];
+ for (; ent; prev = ent, ent = ent->next) {
+ if (ent->key == key)
+ break;
+ }
+
+ if (ent) {
+ if (prev)
+ prev->next = ent->next;
+ else
+ t->ary[i] = ent->next;
+ PTABLE_VAL_FREE(ent->val);
+ PerlMemShared_free(ent);
}
}
@@ -177,7 +206,8 @@
do {
ptable_ent *entry;
for (entry = array[i]; entry; entry = entry->next)
- cb(aTHX_ entry, userdata);
+ if (entry->val)
+ cb(aTHX_ entry, userdata);
} while (i--);
}
}
Modified: branches/upstream/libvariable-magic-perl/current/t/16-huf.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/16-huf.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/16-huf.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/16-huf.t Wed Nov 24 09:25:38 2010
@@ -16,8 +16,8 @@
plan skip_all => 'Hash::Util::FieldHash required for testing uvar interaction';
} else {
plan tests => 2 * 5 + 7 + 1;
- my $v = $Hash::Util::FieldHash::VERSION;
- diag "Using Hash::Util::FieldHash $v" if defined $v;
+ defined and diag "Using Hash::Util::FieldHash $_"
+ for $Hash::Util::FieldHash::VERSION;
}
use lib 't/lib';
Modified: branches/upstream/libvariable-magic-perl/current/t/17-ctl.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/17-ctl.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/17-ctl.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/17-ctl.t Wed Nov 24 09:25:38 2010
@@ -223,18 +223,33 @@
system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
}
-my $has_capture_tiny = do { local $@; eval 'use Capture::Tiny 0.08 (); 1' };
+my $has_capture_tiny = do {
+ local $@;
+ eval 'use Capture::Tiny 0.08 (); 1'
+};
+if ($has_capture_tiny) {
+ my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
+print STDOUT "pants\n";
+print STDERR "trousers\n";
+ CODE
+ unless (defined $output and $output =~ /pants/ and $output =~ /trousers/) {
+ $has_capture_tiny = 0;
+ }
+}
+if ($has_capture_tiny) {
+ defined and diag "Using Capture::Tiny $_" for $Capture::Tiny::VERSION;
+}
SKIP:
{
my $count = 1;
- skip 'Capture::Tiny 0.08 is not installed' => $count unless $has_capture_tiny;
+ skip 'No working Capture::Tiny is installed'=> $count unless $has_capture_tiny;
my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
use Variable::Magic qw/wizard cast/; { BEGIN { $^H |= 0x020000; cast %^H, wizard free => sub { die q[cucumber] } } }
CODE
- skip 'Test code didn\'t run properly' => 1 unless defined $output;
+ skip 'Test code didn\'t run properly' => $count unless defined $output;
like $output, expect('cucumber', '-e', "\nExecution(?s:.*)"),
'die in free callback at compile time and not in eval string';
--$count;
@@ -246,8 +261,8 @@
{
my $count = 1;
- skip 'No nice uvar magic for this perl' => $count unless VMG_UVAR;
- skip 'Capture::Tiny 0.08 is not installed' => $count unless $has_capture_tiny;
+ skip 'No nice uvar magic for this perl' => $count unless VMG_UVAR;
+ skip 'No working Capture::Tiny is installed'=> $count unless $has_capture_tiny;
my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
use Variable::Magic qw/wizard cast/; BEGIN { cast %::, wizard fetch => sub { die q[salsify] } } hlagh()
Modified: branches/upstream/libvariable-magic-perl/current/t/25-copy.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/25-copy.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/25-copy.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/25-copy.t Wed Nov 24 09:25:38 2010
@@ -23,7 +23,7 @@
eval "use Tie::Array";
skip 'Tie::Array required to test copy magic on arrays'
=> (2 * 5 + 3) + (2 * 2 + 1) if $@;
- diag "Using Tie::Array $Tie::Array::VERSION" if defined $Tie::Array::VERSION;
+ defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
tie my @a, 'Tie::StdArray';
@a = (1 .. 10);
@@ -57,7 +57,7 @@
SKIP: {
eval "use Tie::Hash";
skip 'Tie::Hash required to test copy magic on hashes' => 2 * 9 + 6 if $@;
- diag "Using Tie::Hash $Tie::Hash::VERSION" if defined $Tie::Hash::VERSION;
+ defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION;
tie my %h, 'Tie::StdHash';
%h = (a => 1, b => 2, c => 3);
Modified: branches/upstream/libvariable-magic-perl/current/t/28-uvar.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/28-uvar.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/28-uvar.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/28-uvar.t Wed Nov 24 09:25:38 2010
@@ -53,7 +53,7 @@
SKIP: {
eval "use Tie::Hash";
skip 'Tie::Hash required to test uvar magic on tied hashes' => 2 * 5 + 4 if $@;
- diag "Using Tie::Hash $Tie::Hash::VERSION" if defined $Tie::Hash::VERSION;
+ defined and diag "Using Tie::Hash $_" for $Tie::Hash::VERSION;
tie my %h, 'Tie::StdHash';
%h = (x => 7, y => 8);
Modified: branches/upstream/libvariable-magic-perl/current/t/30-scalar.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/30-scalar.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/30-scalar.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/30-scalar.t Wed Nov 24 09:25:38 2010
@@ -112,7 +112,7 @@
}
skip $SKIP => 3 if $SKIP;
- diag "Using Tie::Array $Tie::Array::VERSION" if defined $Tie::Array::VERSION;
+ defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
tie my @a, 'Tie::StdArray';
$a[0] = $$;
Modified: branches/upstream/libvariable-magic-perl/current/t/34-glob.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/34-glob.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/34-glob.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/34-glob.t Wed Nov 24 09:25:38 2010
@@ -9,8 +9,8 @@
if ($@) {
plan skip_all => "Symbol::gensym required for testing magic for globs";
} else {
- plan tests => 2 * 8 + 1;
- diag "Using Symbol $Symbol::VERSION" if defined $Symbol::VERSION;
+ plan tests => 2 * 12 + 1;
+ defined and diag "Using Symbol $_" for $Symbol::VERSION;
}
use Variable::Magic qw/cast dispell VMG_COMPAT_GLOB_GET/;
@@ -30,13 +30,20 @@
watch { local *b = *a } +{ %get }, 'assign to';
-watch { *a = gensym() } +{ %get, set => 1 }, 'assign';
+watch { *a = \1 } +{ %get, set => 1 }, 'assign scalar slot';
+watch { *a = [ qw/x y/ ] } +{ %get, set => 1 }, 'assign array slot';
+watch { *a = { u => 1 } } +{ %get, set => 1 }, 'assign hash slot';
+watch { *a = sub { } } +{ %get, set => 1 }, 'assign code slot';
+
+watch { *a = gensym() } +{ %get, set => 1 }, 'assign glob';
watch {
local *b = gensym();
watch { cast *b, $wiz } +{ }, 'cast 2';
} +{ }, 'scope end';
+%get = () if $] >= 5.013007;
+
watch { undef *a } +{ %get }, 'undef';
watch { dispell *a, $wiz } +{ %get }, 'dispell';
Modified: branches/upstream/libvariable-magic-perl/current/t/40-threads.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/40-threads.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/40-threads.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/40-threads.t Wed Nov 24 09:25:38 2010
@@ -32,10 +32,8 @@
BEGIN {
skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE;
plan tests => (4 * 18 + 1) + (4 * 13 + 1);
- my $v = $threads::VERSION;
- diag "Using threads $v" if defined $v;
- $v = $threads::shared::VERSION;
- diag "Using threads::shared $v" if defined $v;
+ defined and diag "Using threads $_" for $threads::VERSION;
+ defined and diag "Using threads::shared $_" for $threads::shared::VERSION;
}
my $destroyed : shared = 0;
Modified: branches/upstream/libvariable-magic-perl/current/t/41-clone.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libvariable-magic-perl/current/t/41-clone.t?rev=65234&op=diff
==============================================================================
--- branches/upstream/libvariable-magic-perl/current/t/41-clone.t (original)
+++ branches/upstream/libvariable-magic-perl/current/t/41-clone.t Wed Nov 24 09:25:38 2010
@@ -32,10 +32,8 @@
BEGIN {
skipall 'This Variable::Magic isn\'t thread safe' unless VMG_THREADSAFE;
plan tests => 2 * 3 + 2 * (2 * 10 + 2) + 2 * (2 * 7 + 2);
- my $v = $threads::VERSION;
- diag "Using threads $v" if defined $v;
- $v = $threads::shared::VERSION;
- diag "Using threads::shared $v" if defined $v;
+ defined and diag "Using threads $_" for $threads::VERSION;
+ defined and diag "Using threads::shared $_" for $threads::shared::VERSION;
}
my $destroyed : shared = 0;
More information about the Pkg-perl-cvs-commits
mailing list