|
|
1c0695 |
From 21ca1aa78dfe7569a97d588860239ebdc39c4bfe Mon Sep 17 00:00:00 2001
|
|
|
1c0695 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
1c0695 |
Date: Thu, 11 May 2017 12:41:12 +0200
|
|
|
1c0695 |
Subject: [PATCH] Upgrade to 2.62
|
|
|
1c0695 |
MIME-Version: 1.0
|
|
|
1c0695 |
Content-Type: text/plain; charset=UTF-8
|
|
|
1c0695 |
Content-Transfer-Encoding: 8bit
|
|
|
1c0695 |
|
|
|
1c0695 |
Unbundled from perl-5.25.12.
|
|
|
1c0695 |
|
|
|
1c0695 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
1c0695 |
---
|
|
|
1c0695 |
Storable.pm | 18 ++--
|
|
|
1c0695 |
Storable.xs | 312 +++++++++++++++++++++++++++++++++------------------------
|
|
|
1c0695 |
t/code.t | 4 +-
|
|
|
1c0695 |
t/compat01.t | 2 +-
|
|
|
1c0695 |
t/dclone.t | 2 +-
|
|
|
1c0695 |
t/destroy.t | 2 +-
|
|
|
1c0695 |
t/file_magic.t | 2 +-
|
|
|
1c0695 |
t/forgive.t | 2 +-
|
|
|
1c0695 |
t/recurse.t | 2 +-
|
|
|
1c0695 |
t/store.t | 28 +++++-
|
|
|
1c0695 |
t/testlib.pl | 6 +-
|
|
|
1c0695 |
11 files changed, 231 insertions(+), 149 deletions(-)
|
|
|
1c0695 |
|
|
|
1c0695 |
diff --git a/Storable.pm b/Storable.pm
|
|
|
1c0695 |
index c8f6db1..d8fd740 100644
|
|
|
1c0695 |
--- a/Storable.pm
|
|
|
1c0695 |
+++ b/Storable.pm
|
|
|
1c0695 |
@@ -22,10 +22,16 @@ package Storable; @ISA = qw(Exporter);
|
|
|
1c0695 |
|
|
|
1c0695 |
use vars qw($canonical $forgive_me $VERSION);
|
|
|
1c0695 |
|
|
|
1c0695 |
-$VERSION = '2.56';
|
|
|
1c0695 |
+$VERSION = '2.62';
|
|
|
1c0695 |
|
|
|
1c0695 |
BEGIN {
|
|
|
1c0695 |
- if (eval { local $SIG{__DIE__}; require Log::Agent; 1 }) {
|
|
|
1c0695 |
+ if (eval {
|
|
|
1c0695 |
+ local $SIG{__DIE__};
|
|
|
1c0695 |
+ local @INC = @INC;
|
|
|
1c0695 |
+ pop @INC if $INC[-1] eq '.';
|
|
|
1c0695 |
+ require Log::Agent;
|
|
|
1c0695 |
+ 1;
|
|
|
1c0695 |
+ }) {
|
|
|
1c0695 |
Log::Agent->import;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
#
|
|
|
1c0695 |
@@ -113,7 +119,7 @@ sub file_magic {
|
|
|
1c0695 |
|
|
|
1c0695 |
my $file = shift;
|
|
|
1c0695 |
my $fh = IO::File->new;
|
|
|
1c0695 |
- open($fh, "<". $file) || die "Can't open '$file': $!";
|
|
|
1c0695 |
+ open($fh, "<", $file) || die "Can't open '$file': $!";
|
|
|
1c0695 |
binmode($fh);
|
|
|
1c0695 |
defined(sysread($fh, my $buf, 32)) || die "Can't read from '$file': $!";
|
|
|
1c0695 |
close($fh);
|
|
|
1c0695 |
@@ -239,7 +245,7 @@ sub _store {
|
|
|
1c0695 |
logcroak "wrong argument number" unless @_ == 2; # No @foo in arglist
|
|
|
1c0695 |
local *FILE;
|
|
|
1c0695 |
if ($use_locking) {
|
|
|
1c0695 |
- open(FILE, ">>$file") || logcroak "can't write into $file: $!";
|
|
|
1c0695 |
+ open(FILE, '>>', $file) || logcroak "can't write into $file: $!";
|
|
|
1c0695 |
unless (&CAN_FLOCK) {
|
|
|
1c0695 |
logcarp
|
|
|
1c0695 |
"Storable::lock_store: fcntl/flock emulation broken on $^O";
|
|
|
1c0695 |
@@ -250,7 +256,7 @@ sub _store {
|
|
|
1c0695 |
truncate FILE, 0;
|
|
|
1c0695 |
# Unlocking will happen when FILE is closed
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
- open(FILE, ">$file") || logcroak "can't create $file: $!";
|
|
|
1c0695 |
+ open(FILE, '>', $file) || logcroak "can't create $file: $!";
|
|
|
1c0695 |
}
|
|
|
1c0695 |
binmode FILE; # Archaic systems...
|
|
|
1c0695 |
my $da = $@; # Don't mess if called from exception handler
|
|
|
1c0695 |
@@ -367,7 +373,7 @@ sub lock_retrieve {
|
|
|
1c0695 |
sub _retrieve {
|
|
|
1c0695 |
my ($file, $use_locking) = @_;
|
|
|
1c0695 |
local *FILE;
|
|
|
1c0695 |
- open(FILE, $file) || logcroak "can't open $file: $!";
|
|
|
1c0695 |
+ open(FILE, '<', $file) || logcroak "can't open $file: $!";
|
|
|
1c0695 |
binmode FILE; # Archaic systems...
|
|
|
1c0695 |
my $self;
|
|
|
1c0695 |
my $da = $@; # Could be from exception handler
|
|
|
1c0695 |
diff --git a/Storable.xs b/Storable.xs
|
|
|
1c0695 |
index 707f530..9ba48be 100644
|
|
|
1c0695 |
--- a/Storable.xs
|
|
|
1c0695 |
+++ b/Storable.xs
|
|
|
1c0695 |
@@ -417,6 +417,7 @@ static MAGIC *THX_sv_magicext(pTHX_ SV *sv, SV *obj, int type,
|
|
|
1c0695 |
#define INIT_STCXT \
|
|
|
1c0695 |
dSTCXT; \
|
|
|
1c0695 |
NEW_STORABLE_CXT_OBJ(cxt); \
|
|
|
1c0695 |
+ assert(perinterp_sv); \
|
|
|
1c0695 |
sv_setiv(perinterp_sv, PTR2IV(cxt->my_sv))
|
|
|
1c0695 |
|
|
|
1c0695 |
#define SET_STCXT(x) \
|
|
|
1c0695 |
@@ -1038,24 +1039,38 @@ static const char byteorderstr_56[] = {BYTEORDER_BYTES_56, 0};
|
|
|
1c0695 |
* i should be true iff sv is immortal (ie PL_sv_yes, PL_sv_no or PL_sv_undef)
|
|
|
1c0695 |
*
|
|
|
1c0695 |
* SEEN0() is a short-cut where stash is always NULL.
|
|
|
1c0695 |
+ *
|
|
|
1c0695 |
+ * The _NN variants dont check for y being null
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
-#define SEEN0(y,i) \
|
|
|
1c0695 |
+#define SEEN0_NN(y,i) \
|
|
|
1c0695 |
STMT_START { \
|
|
|
1c0695 |
- if (!y) \
|
|
|
1c0695 |
- return (SV *) 0; \
|
|
|
1c0695 |
if (av_store(cxt->aseen, cxt->tagnum++, i ? (SV*)(y) : SvREFCNT_inc(y)) == 0) \
|
|
|
1c0695 |
return (SV *) 0; \
|
|
|
1c0695 |
- TRACEME(("aseen(#%d) = 0x%"UVxf" (refcnt=%d)", cxt->tagnum-1, \
|
|
|
1c0695 |
+ TRACEME(("aseen(#%d) = 0x%" UVxf " (refcnt=%d)", cxt->tagnum-1, \
|
|
|
1c0695 |
PTR2UV(y), SvREFCNT(y)-1)); \
|
|
|
1c0695 |
} STMT_END
|
|
|
1c0695 |
|
|
|
1c0695 |
-#define SEEN(y,stash,i) \
|
|
|
1c0695 |
+#define SEEN0(y,i) \
|
|
|
1c0695 |
STMT_START { \
|
|
|
1c0695 |
- SEEN0(y,i); \
|
|
|
1c0695 |
+ if (!y) \
|
|
|
1c0695 |
+ return (SV *) 0; \
|
|
|
1c0695 |
+ SEEN0_NN(y,i) \
|
|
|
1c0695 |
+ } STMT_END
|
|
|
1c0695 |
+
|
|
|
1c0695 |
+#define SEEN_NN(y,stash,i) \
|
|
|
1c0695 |
+ STMT_START { \
|
|
|
1c0695 |
+ SEEN0_NN(y,i); \
|
|
|
1c0695 |
if (stash) \
|
|
|
1c0695 |
BLESS((SV *) (y), (HV *)(stash)); \
|
|
|
1c0695 |
} STMT_END
|
|
|
1c0695 |
|
|
|
1c0695 |
+#define SEEN(y,stash,i) \
|
|
|
1c0695 |
+ STMT_START { \
|
|
|
1c0695 |
+ if (!y) \
|
|
|
1c0695 |
+ return (SV *) 0; \
|
|
|
1c0695 |
+ SEEN_NN(y,stash, i); \
|
|
|
1c0695 |
+ } STMT_END
|
|
|
1c0695 |
+
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Bless 's' in 'p', via a temporary reference, required by sv_bless().
|
|
|
1c0695 |
* "A" magic is added before the sv_bless for overloaded classes, this avoids
|
|
|
1c0695 |
@@ -1064,7 +1079,7 @@ static const char byteorderstr_56[] = {BYTEORDER_BYTES_56, 0};
|
|
|
1c0695 |
#define BLESS(s,stash) \
|
|
|
1c0695 |
STMT_START { \
|
|
|
1c0695 |
SV *ref; \
|
|
|
1c0695 |
- TRACEME(("blessing 0x%"UVxf" in %s", PTR2UV(s), (HvNAME_get(stash)))); \
|
|
|
1c0695 |
+ TRACEME(("blessing 0x%" UVxf " in %s", PTR2UV(s), (HvNAME_get(stash))));\
|
|
|
1c0695 |
ref = newRV_noinc(s); \
|
|
|
1c0695 |
if (cxt->in_retrieve_overloaded && Gv_AMG(stash)) \
|
|
|
1c0695 |
{ \
|
|
|
1c0695 |
@@ -1703,6 +1718,7 @@ static int last_op_in_netorder(pTHX)
|
|
|
1c0695 |
{
|
|
|
1c0695 |
dSTCXT;
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
return cxt->netorder;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -1737,7 +1753,7 @@ static SV *pkg_fetchmeth(
|
|
|
1c0695 |
gv = gv_fetchmethod_autoload(pkg, method, FALSE);
|
|
|
1c0695 |
if (gv && isGV(gv)) {
|
|
|
1c0695 |
sv = newRV((SV*) GvCV(gv));
|
|
|
1c0695 |
- TRACEME(("%s->%s: 0x%"UVxf, hvname, method, PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("%s->%s: 0x%" UVxf, hvname, method, PTR2UV(sv)));
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
sv = newSVsv(&PL_sv_undef);
|
|
|
1c0695 |
TRACEME(("%s->%s: not found", hvname, method));
|
|
|
1c0695 |
@@ -1821,7 +1837,7 @@ static SV *pkg_can(
|
|
|
1c0695 |
TRACEME(("cached %s->%s: not found", hvname, method));
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
- TRACEME(("cached %s->%s: 0x%"UVxf,
|
|
|
1c0695 |
+ TRACEME(("cached %s->%s: 0x%" UVxf,
|
|
|
1c0695 |
hvname, method, PTR2UV(sv)));
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -1863,7 +1879,7 @@ static SV *scalar_call(
|
|
|
1c0695 |
int i;
|
|
|
1c0695 |
XPUSHs(ary[0]); /* Frozen string */
|
|
|
1c0695 |
for (i = 1; i < cnt; i++) {
|
|
|
1c0695 |
- TRACEME(("pushing arg #%d (0x%"UVxf")...",
|
|
|
1c0695 |
+ TRACEME(("pushing arg #%d (0x%" UVxf ")...",
|
|
|
1c0695 |
i, PTR2UV(ary[i])));
|
|
|
1c0695 |
XPUSHs(sv_2mortal(newRV(ary[i])));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -1988,7 +2004,7 @@ static int known_class(
|
|
|
1c0695 |
static int store_ref(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
{
|
|
|
1c0695 |
int is_weak = 0;
|
|
|
1c0695 |
- TRACEME(("store_ref (0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("store_ref (0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Follow reference, and check if target is overloaded.
|
|
|
1c0695 |
@@ -1997,14 +2013,16 @@ static int store_ref(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
#ifdef SvWEAKREF
|
|
|
1c0695 |
if (SvWEAKREF(sv))
|
|
|
1c0695 |
is_weak = 1;
|
|
|
1c0695 |
- TRACEME(("ref (0x%"UVxf") is%s weak", PTR2UV(sv), is_weak ? "" : "n't"));
|
|
|
1c0695 |
+ TRACEME(("ref (0x%" UVxf ") is%s weak", PTR2UV(sv), is_weak
|
|
|
1c0695 |
+ ? ""
|
|
|
1c0695 |
+ : "n't"));
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
sv = SvRV(sv);
|
|
|
1c0695 |
|
|
|
1c0695 |
if (SvOBJECT(sv)) {
|
|
|
1c0695 |
HV *stash = (HV *) SvSTASH(sv);
|
|
|
1c0695 |
if (stash && Gv_AMG(stash)) {
|
|
|
1c0695 |
- TRACEME(("ref (0x%"UVxf") is overloaded", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ref (0x%" UVxf ") is overloaded", PTR2UV(sv)));
|
|
|
1c0695 |
PUTMARK(is_weak ? SX_WEAKOVERLOAD : SX_OVERLOAD);
|
|
|
1c0695 |
} else
|
|
|
1c0695 |
PUTMARK(is_weak ? SX_WEAKREF : SX_REF);
|
|
|
1c0695 |
@@ -2037,7 +2055,7 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
STRLEN len;
|
|
|
1c0695 |
U32 flags = SvFLAGS(sv); /* "cc -O" may put it in register */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_scalar (0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("store_scalar (0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* For efficiency, break the SV encapsulation by peaking at the flags
|
|
|
1c0695 |
@@ -2050,7 +2068,7 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
TRACEME(("immortal undef"));
|
|
|
1c0695 |
PUTMARK(SX_SV_UNDEF);
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
- TRACEME(("undef at 0x%"UVxf, PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("undef at 0x%" UVxf, PTR2UV(sv)));
|
|
|
1c0695 |
PUTMARK(SX_UNDEF);
|
|
|
1c0695 |
}
|
|
|
1c0695 |
return 0;
|
|
|
1c0695 |
@@ -2125,7 +2143,8 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
* case.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
if ((flags & SVf_IVisUV) && SvUV(sv) > IV_MAX) {
|
|
|
1c0695 |
- TRACEME(("large unsigned integer as string, value = %"UVuf, SvUV(sv)));
|
|
|
1c0695 |
+ TRACEME(("large unsigned integer as string, value = %" UVuf,
|
|
|
1c0695 |
+ SvUV(sv)));
|
|
|
1c0695 |
goto string_readlen;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
@@ -2155,7 +2174,8 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
(iv > (IV)0x7FFFFFFF) || (iv < -(IV)0x80000000)) {
|
|
|
1c0695 |
/* Bigger than 32 bits. */
|
|
|
1c0695 |
- TRACEME(("large network order integer as string, value = %"IVdf, iv));
|
|
|
1c0695 |
+ TRACEME(("large network order integer as string, value = %"
|
|
|
1c0695 |
+ IVdf, iv));
|
|
|
1c0695 |
goto string_readlen;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
@@ -2170,7 +2190,8 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
WRITE(&iv, sizeof(iv));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (integer 0x%"UVxf", value = %"IVdf")", PTR2UV(sv), iv));
|
|
|
1c0695 |
+ TRACEME(("ok (integer 0x%" UVxf ", value = %" IVdf ")",
|
|
|
1c0695 |
+ PTR2UV(sv), iv));
|
|
|
1c0695 |
} else if (flags & SVf_NOK) {
|
|
|
1c0695 |
NV nv;
|
|
|
1c0695 |
#if (PATCHLEVEL <= 6)
|
|
|
1c0695 |
@@ -2179,7 +2200,7 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
* Watch for number being an integer in disguise.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
if (nv == (NV) (iv = I_V(nv))) {
|
|
|
1c0695 |
- TRACEME(("double %"NVff" is actually integer %"IVdf, nv, iv));
|
|
|
1c0695 |
+ TRACEME(("double %" NVff " is actually integer %" IVdf, nv, iv));
|
|
|
1c0695 |
goto integer; /* Share code above */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
#else
|
|
|
1c0695 |
@@ -2193,14 +2214,15 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
|
|
|
1c0695 |
if (cxt->netorder) {
|
|
|
1c0695 |
- TRACEME(("double %"NVff" stored as string", nv));
|
|
|
1c0695 |
+ TRACEME(("double %" NVff " stored as string", nv));
|
|
|
1c0695 |
goto string_readlen; /* Share code below */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
PUTMARK(SX_DOUBLE);
|
|
|
1c0695 |
WRITE(&nv, sizeof(nv));
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (double 0x%"UVxf", value = %"NVff")", PTR2UV(sv), nv));
|
|
|
1c0695 |
+ TRACEME(("ok (double 0x%" UVxf ", value = %" NVff ")",
|
|
|
1c0695 |
+ PTR2UV(sv), nv));
|
|
|
1c0695 |
|
|
|
1c0695 |
} else if (flags & (SVp_POK | SVp_NOK | SVp_IOK)) {
|
|
|
1c0695 |
#ifdef SvVOK
|
|
|
1c0695 |
@@ -2232,10 +2254,10 @@ static int store_scalar(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
STORE_UTF8STR(pv, wlen);
|
|
|
1c0695 |
else
|
|
|
1c0695 |
STORE_SCALAR(pv, wlen);
|
|
|
1c0695 |
- TRACEME(("ok (scalar 0x%"UVxf" '%s', length = %"IVdf")",
|
|
|
1c0695 |
+ TRACEME(("ok (scalar 0x%" UVxf " '%s', length = %" IVdf ")",
|
|
|
1c0695 |
PTR2UV(sv), SvPVX(sv), (IV)len));
|
|
|
1c0695 |
} else
|
|
|
1c0695 |
- CROAK(("Can't determine type of %s(0x%"UVxf")",
|
|
|
1c0695 |
+ CROAK(("Can't determine type of %s(0x%" UVxf ")",
|
|
|
1c0695 |
sv_reftype(sv, FALSE),
|
|
|
1c0695 |
PTR2UV(sv)));
|
|
|
1c0695 |
return 0; /* Ok, no recursion on scalars */
|
|
|
1c0695 |
@@ -2256,7 +2278,7 @@ static int store_array(pTHX_ stcxt_t *cxt, AV *av)
|
|
|
1c0695 |
I32 i;
|
|
|
1c0695 |
int ret;
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_array (0x%"UVxf")", PTR2UV(av)));
|
|
|
1c0695 |
+ TRACEME(("store_array (0x%" UVxf ")", PTR2UV(av)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Signal array by emitting SX_ARRAY, followed by the array length.
|
|
|
1c0695 |
@@ -2359,10 +2381,10 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
|
|
|
1c0695 |
|
|
|
1c0695 |
if (flagged_hash) {
|
|
|
1c0695 |
/* needs int cast for C++ compilers, doesn't it? */
|
|
|
1c0695 |
- TRACEME(("store_hash (0x%"UVxf") (flags %x)", PTR2UV(hv),
|
|
|
1c0695 |
+ TRACEME(("store_hash (0x%" UVxf ") (flags %x)", PTR2UV(hv),
|
|
|
1c0695 |
(int) hash_flags));
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
- TRACEME(("store_hash (0x%"UVxf")", PTR2UV(hv)));
|
|
|
1c0695 |
+ TRACEME(("store_hash (0x%" UVxf ")", PTR2UV(hv)));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
@@ -2475,7 +2497,7 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
|
|
|
1c0695 |
* Store value first.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("(#%d) value 0x%"UVxf, i, PTR2UV(val)));
|
|
|
1c0695 |
+ TRACEME(("(#%d) value 0x%" UVxf, i, PTR2UV(val)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if ((ret = store(aTHX_ cxt, val))) /* Extra () for -Wall, grr... */
|
|
|
1c0695 |
goto out;
|
|
|
1c0695 |
@@ -2595,7 +2617,7 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
|
|
|
1c0695 |
* Store value first.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("(#%d) value 0x%"UVxf, i, PTR2UV(val)));
|
|
|
1c0695 |
+ TRACEME(("(#%d) value 0x%" UVxf, i, PTR2UV(val)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if ((ret = store(aTHX_ cxt, val))) /* Extra () for -Wall, grr... */
|
|
|
1c0695 |
goto out;
|
|
|
1c0695 |
@@ -2644,7 +2666,9 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
|
|
|
1c0695 |
TRACEME(("(#%d) key '%s'", i, key));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
if (flags & SHV_K_ISSV) {
|
|
|
1c0695 |
- store(aTHX_ cxt, key_sv);
|
|
|
1c0695 |
+ int ret;
|
|
|
1c0695 |
+ if ((ret = store(aTHX_ cxt, key_sv)))
|
|
|
1c0695 |
+ goto out;
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
WLEN(len);
|
|
|
1c0695 |
if (len)
|
|
|
1c0695 |
@@ -2653,7 +2677,7 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
|
|
|
1c0695 |
}
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (hash 0x%"UVxf")", PTR2UV(hv)));
|
|
|
1c0695 |
+ TRACEME(("ok (hash 0x%" UVxf ")", PTR2UV(hv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
out:
|
|
|
1c0695 |
HvRITER_set(hv, riter); /* Restore hash iterator state */
|
|
|
1c0695 |
@@ -2683,7 +2707,7 @@ static int store_code(pTHX_ stcxt_t *cxt, CV *cv)
|
|
|
1c0695 |
int count, reallen;
|
|
|
1c0695 |
SV *text, *bdeparse;
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_code (0x%"UVxf")", PTR2UV(cv)));
|
|
|
1c0695 |
+ TRACEME(("store_code (0x%" UVxf ")", PTR2UV(cv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if (
|
|
|
1c0695 |
cxt->deparse == 0 ||
|
|
|
1c0695 |
@@ -2786,7 +2810,7 @@ static int store_tied(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
int svt = SvTYPE(sv);
|
|
|
1c0695 |
char mtype = 'P';
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_tied (0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("store_tied (0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* We have a small run-time penalty here because we chose to factorise
|
|
|
1c0695 |
@@ -2854,7 +2878,7 @@ static int store_tied_item(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
MAGIC *mg;
|
|
|
1c0695 |
int ret;
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_tied_item (0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("store_tied_item (0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if (!(mg = mg_find(sv, 'p')))
|
|
|
1c0695 |
CROAK(("No magic 'p' found while storing reference to tied item"));
|
|
|
1c0695 |
@@ -2866,12 +2890,14 @@ static int store_tied_item(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
if (mg->mg_ptr) {
|
|
|
1c0695 |
TRACEME(("store_tied_item: storing a ref to a tied hash item"));
|
|
|
1c0695 |
PUTMARK(SX_TIED_KEY);
|
|
|
1c0695 |
- TRACEME(("store_tied_item: storing OBJ 0x%"UVxf, PTR2UV(mg->mg_obj)));
|
|
|
1c0695 |
+ TRACEME(("store_tied_item: storing OBJ 0x%" UVxf,
|
|
|
1c0695 |
+ PTR2UV(mg->mg_obj)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if ((ret = store(aTHX_ cxt, mg->mg_obj))) /* Extra () for -Wall, grr... */
|
|
|
1c0695 |
return ret;
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store_tied_item: storing PTR 0x%"UVxf, PTR2UV(mg->mg_ptr)));
|
|
|
1c0695 |
+ TRACEME(("store_tied_item: storing PTR 0x%" UVxf,
|
|
|
1c0695 |
+ PTR2UV(mg->mg_ptr)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if ((ret = store(aTHX_ cxt, (SV *) mg->mg_ptr))) /* Idem, for -Wall */
|
|
|
1c0695 |
return ret;
|
|
|
1c0695 |
@@ -2880,7 +2906,8 @@ static int store_tied_item(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
|
|
|
1c0695 |
TRACEME(("store_tied_item: storing a ref to a tied array item "));
|
|
|
1c0695 |
PUTMARK(SX_TIED_IDX);
|
|
|
1c0695 |
- TRACEME(("store_tied_item: storing OBJ 0x%"UVxf, PTR2UV(mg->mg_obj)));
|
|
|
1c0695 |
+ TRACEME(("store_tied_item: storing OBJ 0x%" UVxf,
|
|
|
1c0695 |
+ PTR2UV(mg->mg_obj)));
|
|
|
1c0695 |
|
|
|
1c0695 |
if ((ret = store(aTHX_ cxt, mg->mg_obj))) /* Idem, for -Wall */
|
|
|
1c0695 |
return ret;
|
|
|
1c0695 |
@@ -3136,7 +3163,8 @@ static int store_hook(
|
|
|
1c0695 |
goto sv_seen; /* Avoid moving code too far to the right */
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("listed object %d at 0x%"UVxf" is unknown", i-1, PTR2UV(xsv)));
|
|
|
1c0695 |
+ TRACEME(("listed object %d at 0x%" UVxf " is unknown",
|
|
|
1c0695 |
+ i-1, PTR2UV(xsv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* We need to recurse to store that object and get it to be known
|
|
|
1c0695 |
@@ -3205,7 +3233,7 @@ static int store_hook(
|
|
|
1c0695 |
tag = *svh;
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
ary[i] = tag;
|
|
|
1c0695 |
- TRACEME(("listed object %d at 0x%"UVxf" is tag #%"UVuf,
|
|
|
1c0695 |
+ TRACEME(("listed object %d at 0x%" UVxf " is tag #%" UVuf,
|
|
|
1c0695 |
i-1, PTR2UV(xsv), PTR2UV(tag)));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -3252,7 +3280,7 @@ check_done:
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
TRACEME(("SX_HOOK (recursed=%d) flags=0x%x "
|
|
|
1c0695 |
- "class=%"IVdf" len=%"IVdf" len2=%"IVdf" len3=%d",
|
|
|
1c0695 |
+ "class=%" IVdf " len=%" IVdf " len2=%" IVdf " len3=%d",
|
|
|
1c0695 |
recursed, flags, (IV)classnum, (IV)len, (IV)len2, count-1));
|
|
|
1c0695 |
|
|
|
1c0695 |
/* SX_HOOK <flags> [<extra>] */
|
|
|
1c0695 |
@@ -3339,8 +3367,8 @@ check_done:
|
|
|
1c0695 |
(svt == SVt_PVAV) ? "array" : "scalar"));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("handling the magic object 0x%"UVxf" part of 0x%"UVxf,
|
|
|
1c0695 |
- PTR2UV(mg->mg_obj), PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("handling the magic object 0x%" UVxf " part of 0x%"
|
|
|
1c0695 |
+ UVxf, PTR2UV(mg->mg_obj), PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* [<magic object>]
|
|
|
1c0695 |
@@ -3407,7 +3435,7 @@ static int store_blessed(
|
|
|
1c0695 |
classname = HvNAME_get(pkg);
|
|
|
1c0695 |
len = strlen(classname);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("blessed 0x%"UVxf" in %s, no hook: tagged #%d",
|
|
|
1c0695 |
+ TRACEME(("blessed 0x%" UVxf " in %s, no hook: tagged #%d",
|
|
|
1c0695 |
PTR2UV(sv), classname, cxt->tagnum));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
@@ -3477,19 +3505,19 @@ static int store_other(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
)
|
|
|
1c0695 |
CROAK(("Can't store %s items", sv_reftype(sv, FALSE)));
|
|
|
1c0695 |
|
|
|
1c0695 |
- warn("Can't store item %s(0x%"UVxf")",
|
|
|
1c0695 |
+ warn("Can't store item %s(0x%" UVxf ")",
|
|
|
1c0695 |
sv_reftype(sv, FALSE), PTR2UV(sv));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Store placeholder string as a scalar instead...
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
- (void) sprintf(buf, "You lost %s(0x%"UVxf")%c", sv_reftype(sv, FALSE),
|
|
|
1c0695 |
+ (void) sprintf(buf, "You lost %s(0x%" UVxf ")%c", sv_reftype(sv, FALSE),
|
|
|
1c0695 |
PTR2UV(sv), (char) 0);
|
|
|
1c0695 |
|
|
|
1c0695 |
len = strlen(buf);
|
|
|
1c0695 |
STORE_SCALAR(buf, len);
|
|
|
1c0695 |
- TRACEME(("ok (dummy \"%s\", length = %"IVdf")", buf, (IV) len));
|
|
|
1c0695 |
+ TRACEME(("ok (dummy \"%s\", length = %" IVdf ")", buf, (IV) len));
|
|
|
1c0695 |
|
|
|
1c0695 |
return 0;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -3592,7 +3620,7 @@ static int store(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
HV *hseen = cxt->hseen;
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("store (0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("store (0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* If object has already been stored, do not duplicate data.
|
|
|
1c0695 |
@@ -3650,7 +3678,8 @@ static int store(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
tagval = htonl(LOW_32BITS(*svh));
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("object 0x%"UVxf" seen as #%d", PTR2UV(sv), ntohl(tagval)));
|
|
|
1c0695 |
+ TRACEME(("object 0x%" UVxf " seen as #%d",
|
|
|
1c0695 |
+ PTR2UV(sv), ntohl(tagval)));
|
|
|
1c0695 |
|
|
|
1c0695 |
PUTMARK(SX_OBJECT);
|
|
|
1c0695 |
WRITE_I32(tagval);
|
|
|
1c0695 |
@@ -3685,7 +3714,7 @@ static int store(pTHX_ stcxt_t *cxt, SV *sv)
|
|
|
1c0695 |
type = sv_type(aTHX_ sv);
|
|
|
1c0695 |
|
|
|
1c0695 |
undef_special_case:
|
|
|
1c0695 |
- TRACEME(("storing 0x%"UVxf" tag #%d, type %d...",
|
|
|
1c0695 |
+ TRACEME(("storing 0x%" UVxf " tag #%d, type %d...",
|
|
|
1c0695 |
PTR2UV(sv), cxt->tagnum, type));
|
|
|
1c0695 |
|
|
|
1c0695 |
if (SvOBJECT(sv)) {
|
|
|
1c0695 |
@@ -3694,7 +3723,7 @@ undef_special_case:
|
|
|
1c0695 |
} else
|
|
|
1c0695 |
ret = SV_STORE(type)(aTHX_ cxt, sv);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("%s (stored 0x%"UVxf", refcnt=%d, %s)",
|
|
|
1c0695 |
+ TRACEME(("%s (stored 0x%" UVxf ", refcnt=%d, %s)",
|
|
|
1c0695 |
ret ? "FAILED" : "ok", PTR2UV(sv),
|
|
|
1c0695 |
SvREFCNT(sv), sv_reftype(sv, FALSE)));
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -3707,7 +3736,7 @@ undef_special_case:
|
|
|
1c0695 |
* Write magic number and system information into the file.
|
|
|
1c0695 |
* Layout is <magic> <network> [<len> <byteorder> <sizeof int> <sizeof long>
|
|
|
1c0695 |
* <sizeof ptr>] where <len> is the length of the byteorder hexa string.
|
|
|
1c0695 |
- * All size and lenghts are written as single characters here.
|
|
|
1c0695 |
+ * All size and lengths are written as single characters here.
|
|
|
1c0695 |
*
|
|
|
1c0695 |
* Note that no byte ordering info is emitted when <network> is true, since
|
|
|
1c0695 |
* integers will be emitted in network order in that case.
|
|
|
1c0695 |
@@ -3832,6 +3861,7 @@ static int do_store(
|
|
|
1c0695 |
* free up memory for them now.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
if (cxt->s_dirty)
|
|
|
1c0695 |
clean_context(aTHX_ cxt);
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -3933,6 +3963,7 @@ static SV *mbuf2sv(pTHX)
|
|
|
1c0695 |
{
|
|
|
1c0695 |
dSTCXT;
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
return newSVpv(mbase, MBUF_SIZE());
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -3993,7 +4024,8 @@ static SV *retrieve_idx_blessed(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
sva = av_fetch(cxt->aclass, idx, FALSE);
|
|
|
1c0695 |
if (!sva)
|
|
|
1c0695 |
- CROAK(("Class name #%"IVdf" should have been seen already", (IV) idx));
|
|
|
1c0695 |
+ CROAK(("Class name #%" IVdf " should have been seen already",
|
|
|
1c0695 |
+ (IV) idx));
|
|
|
1c0695 |
|
|
|
1c0695 |
classname = SvPVX(*sva); /* We know it's a PV, by construction */
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -4016,7 +4048,7 @@ static SV *retrieve_idx_blessed(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
static SV *retrieve_blessed(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
{
|
|
|
1c0695 |
- I32 len;
|
|
|
1c0695 |
+ U32 len;
|
|
|
1c0695 |
SV *sv;
|
|
|
1c0695 |
char buf[LG_BLESS + 1]; /* Avoid malloc() if possible */
|
|
|
1c0695 |
char *classname = buf;
|
|
|
1c0695 |
@@ -4037,6 +4069,9 @@ static SV *retrieve_blessed(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (len & 0x80) {
|
|
|
1c0695 |
RLEN(len);
|
|
|
1c0695 |
TRACEME(("** allocating %d bytes for class name", len+1));
|
|
|
1c0695 |
+ if (len > I32_MAX) {
|
|
|
1c0695 |
+ CROAK(("Corrupted classname length"));
|
|
|
1c0695 |
+ }
|
|
|
1c0695 |
New(10003, classname, len+1, char);
|
|
|
1c0695 |
malloced_classname = classname;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4087,7 +4122,7 @@ static SV *retrieve_blessed(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
{
|
|
|
1c0695 |
- I32 len;
|
|
|
1c0695 |
+ U32 len;
|
|
|
1c0695 |
char buf[LG_BLESS + 1]; /* Avoid malloc() if possible */
|
|
|
1c0695 |
char *classname = buf;
|
|
|
1c0695 |
unsigned int flags;
|
|
|
1c0695 |
@@ -4160,7 +4195,7 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
default:
|
|
|
1c0695 |
return retrieve_other(aTHX_ cxt, 0); /* Let it croak */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
- SEEN0(sv, 0); /* Don't bless yet */
|
|
|
1c0695 |
+ SEEN0_NN(sv, 0); /* Don't bless yet */
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Whilst flags tell us to recurse, do so.
|
|
|
1c0695 |
@@ -4180,7 +4215,7 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (!rv)
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
SvREFCNT_dec(rv);
|
|
|
1c0695 |
- TRACEME(("retrieve_hook back with rv=0x%"UVxf,
|
|
|
1c0695 |
+ TRACEME(("retrieve_hook back with rv=0x%" UVxf,
|
|
|
1c0695 |
PTR2UV(rv)));
|
|
|
1c0695 |
GETMARK(flags);
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4200,8 +4235,8 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
sva = av_fetch(cxt->aclass, idx, FALSE);
|
|
|
1c0695 |
if (!sva)
|
|
|
1c0695 |
- CROAK(("Class name #%"IVdf" should have been seen already",
|
|
|
1c0695 |
- (IV) idx));
|
|
|
1c0695 |
+ CROAK(("Class name #%" IVdf
|
|
|
1c0695 |
+ " should have been seen already", (IV) idx));
|
|
|
1c0695 |
|
|
|
1c0695 |
classname = SvPVX(*sva); /* We know it's a PV, by construction */
|
|
|
1c0695 |
TRACEME(("class ID %d => %s", idx, classname));
|
|
|
1c0695 |
@@ -4221,6 +4256,10 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
else
|
|
|
1c0695 |
GETMARK(len);
|
|
|
1c0695 |
|
|
|
1c0695 |
+ if (len > I32_MAX) {
|
|
|
1c0695 |
+ CROAK(("Corrupted classname length"));
|
|
|
1c0695 |
+ }
|
|
|
1c0695 |
+
|
|
|
1c0695 |
if (len > LG_BLESS) {
|
|
|
1c0695 |
TRACEME(("** allocating %d bytes for class name", len+1));
|
|
|
1c0695 |
New(10003, classname, len+1, char);
|
|
|
1c0695 |
@@ -4242,6 +4281,11 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
TRACEME(("class name: %s", classname));
|
|
|
1c0695 |
|
|
|
1c0695 |
+ if (!(flags & SHF_IDX_CLASSNAME) && classname != buf) {
|
|
|
1c0695 |
+ /* some execution paths can throw an exception */
|
|
|
1c0695 |
+ SAVEFREEPV(classname);
|
|
|
1c0695 |
+ }
|
|
|
1c0695 |
+
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Decode user-frozen string length and read it in an SV.
|
|
|
1c0695 |
*
|
|
|
1c0695 |
@@ -4312,8 +4356,9 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
xsv = &PL_sv_undef;
|
|
|
1c0695 |
svh = &xsv;
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
- CROAK(("Object #%"IVdf" should have been retrieved already",
|
|
|
1c0695 |
- (IV) tag));
|
|
|
1c0695 |
+ CROAK(("Object #%" IVdf
|
|
|
1c0695 |
+ " should have been retrieved already",
|
|
|
1c0695 |
+ (IV) tag));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
}
|
|
|
1c0695 |
xsv = *svh;
|
|
|
1c0695 |
@@ -4357,11 +4402,9 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SvREFCNT_dec(sv);
|
|
|
1c0695 |
/* we need to free RV but preserve value that RV point to */
|
|
|
1c0695 |
sv = SvRV(attached);
|
|
|
1c0695 |
- SEEN0(sv, 0);
|
|
|
1c0695 |
+ SEEN0_NN(sv, 0);
|
|
|
1c0695 |
SvRV_set(attached, NULL);
|
|
|
1c0695 |
SvREFCNT_dec(attached);
|
|
|
1c0695 |
- if (!(flags & SHF_IDX_CLASSNAME) && classname != buf)
|
|
|
1c0695 |
- Safefree(classname);
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
CROAK(("STORABLE_attach did not return a %s object", classname));
|
|
|
1c0695 |
@@ -4428,7 +4471,7 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
* the object itself being already created by the runtime.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("calling STORABLE_thaw on %s at 0x%"UVxf" (%"IVdf" args)",
|
|
|
1c0695 |
+ TRACEME(("calling STORABLE_thaw on %s at 0x%" UVxf " (%" IVdf " args)",
|
|
|
1c0695 |
classname, PTR2UV(sv), (IV) AvFILLp(av) + 1));
|
|
|
1c0695 |
|
|
|
1c0695 |
rv = newRV(sv);
|
|
|
1c0695 |
@@ -4442,8 +4485,6 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SvREFCNT_dec(frozen);
|
|
|
1c0695 |
av_undef(av);
|
|
|
1c0695 |
sv_free((SV *) av);
|
|
|
1c0695 |
- if (!(flags & SHF_IDX_CLASSNAME) && classname != buf)
|
|
|
1c0695 |
- Safefree(classname);
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* If we had an <extra> type, then the object was not as simple, and
|
|
|
1c0695 |
@@ -4453,11 +4494,11 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (!extra_type)
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("retrieving magic object for 0x%"UVxf"...", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("retrieving magic object for 0x%" UVxf "...", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
rv = retrieve(aTHX_ cxt, 0); /* Retrieve <magic object> */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("restoring the magic object 0x%"UVxf" part of 0x%"UVxf,
|
|
|
1c0695 |
+ TRACEME(("restoring the magic object 0x%" UVxf " part of 0x%" UVxf,
|
|
|
1c0695 |
PTR2UV(rv), PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
switch (extra_type) {
|
|
|
1c0695 |
@@ -4532,7 +4573,7 @@ static SV *retrieve_ref(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
stash = gv_stashpv(cname, GV_ADD);
|
|
|
1c0695 |
else
|
|
|
1c0695 |
stash = 0;
|
|
|
1c0695 |
- SEEN(rv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
+ SEEN_NN(rv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4564,7 +4605,7 @@ static SV *retrieve_ref(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SvRV_set(rv, sv); /* $rv = \$sv */
|
|
|
1c0695 |
SvROK_on(rv);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_ref at 0x%"UVxf")", PTR2UV(rv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_ref at 0x%" UVxf ")", PTR2UV(rv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return rv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4612,7 +4653,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
rv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(rv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
+ SEEN_NN(rv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
cxt->in_retrieve_overloaded = 1; /* so sv_bless doesn't call S_reset_amagic */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
cxt->in_retrieve_overloaded = 0;
|
|
|
1c0695 |
@@ -4633,7 +4674,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
stash = SvTYPE(sv) ? (HV *) SvSTASH (sv) : 0;
|
|
|
1c0695 |
if (!stash) {
|
|
|
1c0695 |
- CROAK(("Cannot restore overloading on %s(0x%"UVxf
|
|
|
1c0695 |
+ CROAK(("Cannot restore overloading on %s(0x%" UVxf
|
|
|
1c0695 |
") (package <unknown>)",
|
|
|
1c0695 |
sv_reftype(sv, FALSE),
|
|
|
1c0695 |
PTR2UV(sv)));
|
|
|
1c0695 |
@@ -4644,7 +4685,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("Going to load module '%s'", package));
|
|
|
1c0695 |
load_module(PERL_LOADMOD_NOIMPORT, newSVpv(package, 0), Nullsv);
|
|
|
1c0695 |
if (!Gv_AMG(stash)) {
|
|
|
1c0695 |
- CROAK(("Cannot restore overloading on %s(0x%"UVxf
|
|
|
1c0695 |
+ CROAK(("Cannot restore overloading on %s(0x%" UVxf
|
|
|
1c0695 |
") (package %s) (even after a \"require %s;\")",
|
|
|
1c0695 |
sv_reftype(sv, FALSE),
|
|
|
1c0695 |
PTR2UV(sv),
|
|
|
1c0695 |
@@ -4654,7 +4695,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
SvAMAGIC_on(rv);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_overloaded at 0x%"UVxf")", PTR2UV(rv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_overloaded at 0x%" UVxf ")", PTR2UV(rv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return rv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4698,7 +4739,7 @@ static SV *retrieve_tied_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
tv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
+ SEEN_NN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4708,7 +4749,7 @@ static SV *retrieve_tied_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
sv_magic(tv, sv, 'P', (char *)NULL, 0);
|
|
|
1c0695 |
SvREFCNT_dec(sv); /* Undo refcnt inc from sv_magic() */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_tied_array at 0x%"UVxf")", PTR2UV(tv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_tied_array at 0x%" UVxf ")", PTR2UV(tv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return tv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4729,7 +4770,7 @@ static SV *retrieve_tied_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
tv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
+ SEEN_NN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4738,7 +4779,7 @@ static SV *retrieve_tied_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
sv_magic(tv, sv, 'P', (char *)NULL, 0);
|
|
|
1c0695 |
SvREFCNT_dec(sv); /* Undo refcnt inc from sv_magic() */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_tied_hash at 0x%"UVxf")", PTR2UV(tv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_tied_hash at 0x%" UVxf ")", PTR2UV(tv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return tv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4759,7 +4800,7 @@ static SV *retrieve_tied_scalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
tv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(tv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
+ SEEN_NN(tv, stash, 0); /* Will return if rv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv) {
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4776,7 +4817,7 @@ static SV *retrieve_tied_scalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SvREFCNT_dec(obj);
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_tied_scalar at 0x%"UVxf")", PTR2UV(tv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_tied_scalar at 0x%" UVxf ")", PTR2UV(tv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return tv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4798,7 +4839,7 @@ static SV *retrieve_tied_key(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
tv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
+ SEEN_NN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4832,7 +4873,7 @@ static SV *retrieve_tied_idx(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
tv = NEWSV(10002, 0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
+ SEEN_NN(tv, stash, 0); /* Will return if tv is null */
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve <object> */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0; /* Failed */
|
|
|
1c0695 |
@@ -4863,7 +4904,7 @@ static SV *retrieve_lscalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
HV *stash;
|
|
|
1c0695 |
|
|
|
1c0695 |
RLEN(len);
|
|
|
1c0695 |
- TRACEME(("retrieve_lscalar (#%d), len = %"IVdf, cxt->tagnum, (IV) len));
|
|
|
1c0695 |
+ TRACEME(("retrieve_lscalar (#%d), len = %" IVdf, cxt->tagnum, (IV) len));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Allocate an empty scalar of the suitable length.
|
|
|
1c0695 |
@@ -4871,10 +4912,10 @@ static SV *retrieve_lscalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
sv = NEWSV(10002, len);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
if (len == 0) {
|
|
|
1c0695 |
- sv_setpvn(sv, "", 0);
|
|
|
1c0695 |
+ SvPVCLEAR(sv);
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -4894,8 +4935,8 @@ static SV *retrieve_lscalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (cxt->s_tainted) /* Is input source tainted? */
|
|
|
1c0695 |
SvTAINT(sv); /* External data cannot be trusted */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("large scalar len %"IVdf" '%s'", (IV) len, SvPVX(sv)));
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_lscalar at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("large scalar len %" IVdf " '%s'", (IV) len, SvPVX(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_lscalar at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -4924,7 +4965,7 @@ static SV *retrieve_scalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
sv = NEWSV(10002, len);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* WARNING: duplicates parts of sv_setpv and breaks SV data encapsulation.
|
|
|
1c0695 |
@@ -4942,7 +4983,7 @@ static SV *retrieve_scalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
}
|
|
|
1c0695 |
SvGROW(sv, 1);
|
|
|
1c0695 |
*SvEND(sv) = '\0'; /* Ensure it's null terminated anyway */
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_scalar empty at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_scalar empty at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Now, for efficiency reasons, read data directly inside the SV buffer,
|
|
|
1c0695 |
@@ -4960,7 +5001,7 @@ static SV *retrieve_scalar(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (cxt->s_tainted) /* Is input source tainted? */
|
|
|
1c0695 |
SvTAINT(sv); /* External data cannot be trusted */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_scalar at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_scalar at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -5049,7 +5090,7 @@ static SV *retrieve_vstring(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
/* 5.10.0 and earlier seem to need this */
|
|
|
1c0695 |
SvRMAGICAL_on(sv);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_vstring at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_vstring at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
#else
|
|
|
1c0695 |
VSTRING_CROAK();
|
|
|
1c0695 |
@@ -5070,7 +5111,7 @@ static SV *retrieve_lvstring(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SV *sv;
|
|
|
1c0695 |
|
|
|
1c0695 |
RLEN(len);
|
|
|
1c0695 |
- TRACEME(("retrieve_lvstring (#%d), len = %"IVdf,
|
|
|
1c0695 |
+ TRACEME(("retrieve_lvstring (#%d), len = %" IVdf,
|
|
|
1c0695 |
cxt->tagnum, (IV)len));
|
|
|
1c0695 |
|
|
|
1c0695 |
New(10003, s, len+1, char);
|
|
|
1c0695 |
@@ -5084,7 +5125,7 @@ static SV *retrieve_lvstring(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
Safefree(s);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_lvstring at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_lvstring at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
#else
|
|
|
1c0695 |
VSTRING_CROAK();
|
|
|
1c0695 |
@@ -5109,10 +5150,10 @@ static SV *retrieve_integer(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
READ(&iv, sizeof(iv));
|
|
|
1c0695 |
sv = newSViv(iv);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("integer %"IVdf, iv));
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_integer at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("integer %" IVdf, iv));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_integer at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5140,9 +5181,9 @@ static SV *retrieve_netint(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("network integer (as-is) %d", iv));
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_netint at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_netint at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5164,10 +5205,10 @@ static SV *retrieve_double(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
READ(&nv, sizeof(nv));
|
|
|
1c0695 |
sv = newSVnv(nv);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("double %"NVff, nv));
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_double at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("double %" NVff, nv));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_double at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5192,10 +5233,10 @@ static SV *retrieve_byte(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
tmp = (unsigned char) siv - 128;
|
|
|
1c0695 |
sv = newSViv(tmp);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0); /* Associate this new scalar with tag "tagnum" */
|
|
|
1c0695 |
|
|
|
1c0695 |
TRACEME(("byte %d", tmp));
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_byte at 0x%"UVxf")", PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_byte at 0x%" UVxf ")", PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5214,7 +5255,7 @@ static SV *retrieve_undef(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
sv = newSV(0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0);
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0);
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5238,7 +5279,7 @@ static SV *retrieve_sv_undef(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
cxt->where_is_undef = cxt->tagnum;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 1);
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 1);
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -5255,7 +5296,7 @@ static SV *retrieve_sv_yes(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("retrieve_sv_yes"));
|
|
|
1c0695 |
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 1);
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 1);
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -5272,7 +5313,7 @@ static SV *retrieve_sv_no(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("retrieve_sv_no"));
|
|
|
1c0695 |
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 1);
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 1);
|
|
|
1c0695 |
return sv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -5289,7 +5330,7 @@ static SV *retrieve_svundef_elem(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
/* SEEN reads the contents of its SV argument, which we are not
|
|
|
1c0695 |
supposed to do with &PL_sv_placeholder. */
|
|
|
1c0695 |
- SEEN(&PL_sv_undef, cname, 1);
|
|
|
1c0695 |
+ SEEN_NN(&PL_sv_undef, cname, 1);
|
|
|
1c0695 |
|
|
|
1c0695 |
return &PL_sv_placeholder;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5322,7 +5363,7 @@ static SV *retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("size = %d", len));
|
|
|
1c0695 |
av = newAV();
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(av, stash, 0); /* Will return if array not allocated nicely */
|
|
|
1c0695 |
+ SEEN_NN(av, stash, 0); /* Will return if array not allocated nicely */
|
|
|
1c0695 |
if (len)
|
|
|
1c0695 |
av_extend(av, len);
|
|
|
1c0695 |
else
|
|
|
1c0695 |
@@ -5348,7 +5389,7 @@ static SV *retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
}
|
|
|
1c0695 |
if (seen_null) av_fill(av, len-1);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_array at 0x%"UVxf")", PTR2UV(av)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_array at 0x%" UVxf ")", PTR2UV(av)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return (SV *) av;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5383,7 +5424,7 @@ static SV *retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("size = %d", len));
|
|
|
1c0695 |
hv = newHV();
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(hv, stash, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
+ SEEN_NN(hv, stash, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
if (len == 0)
|
|
|
1c0695 |
return (SV *) hv; /* No data follow if table empty */
|
|
|
1c0695 |
hv_ksplit(hv, len + 1); /* pre-extend hash to save multiple splits */
|
|
|
1c0695 |
@@ -5424,7 +5465,7 @@ static SV *retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_hash at 0x%"UVxf")", PTR2UV(hv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_hash at 0x%" UVxf ")", PTR2UV(hv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return (SV *) hv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5472,7 +5513,7 @@ static SV *retrieve_flag_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
TRACEME(("size = %d, flags = %d", len, hash_flags));
|
|
|
1c0695 |
hv = newHV();
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(hv, stash, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
+ SEEN_NN(hv, stash, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
if (len == 0)
|
|
|
1c0695 |
return (SV *) hv; /* No data follow if table empty */
|
|
|
1c0695 |
hv_ksplit(hv, len + 1); /* pre-extend hash to save multiple splits */
|
|
|
1c0695 |
@@ -5569,7 +5610,7 @@ static SV *retrieve_flag_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SvREADONLY_on(hv);
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_hash at 0x%"UVxf")", PTR2UV(hv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_hash at 0x%" UVxf ")", PTR2UV(hv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return (SV *) hv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5602,7 +5643,7 @@ static SV *retrieve_code(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
tagnum = cxt->tagnum;
|
|
|
1c0695 |
sv = newSViv(0);
|
|
|
1c0695 |
stash = cname ? gv_stashpv(cname, GV_ADD) : 0;
|
|
|
1c0695 |
- SEEN(sv, stash, 0);
|
|
|
1c0695 |
+ SEEN_NN(sv, stash, 0);
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Retrieve the source of the code reference
|
|
|
1c0695 |
@@ -5627,6 +5668,10 @@ static SV *retrieve_code(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
CROAK(("Unexpected type %d in retrieve_code\n", type));
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
+ if (!text) {
|
|
|
1c0695 |
+ CROAK(("Unable to retrieve code\n"));
|
|
|
1c0695 |
+ }
|
|
|
1c0695 |
+
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* prepend "sub " to the source
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
@@ -5664,7 +5709,7 @@ static SV *retrieve_code(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
SAVETMPS;
|
|
|
1c0695 |
|
|
|
1c0695 |
errsv = get_sv("@", GV_ADD);
|
|
|
1c0695 |
- sv_setpvn(errsv, "", 0); /* clear $@ */
|
|
|
1c0695 |
+ SvPVCLEAR(errsv); /* clear $@ */
|
|
|
1c0695 |
if (SvROK(cxt->eval) && SvTYPE(SvRV(cxt->eval)) == SVt_PVCV) {
|
|
|
1c0695 |
PUSHMARK(sp);
|
|
|
1c0695 |
XPUSHs(sv_2mortal(newSVsv(sub)));
|
|
|
1c0695 |
@@ -5730,7 +5775,7 @@ static SV *old_retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
RLEN(len);
|
|
|
1c0695 |
TRACEME(("size = %d", len));
|
|
|
1c0695 |
av = newAV();
|
|
|
1c0695 |
- SEEN0(av, 0); /* Will return if array not allocated nicely */
|
|
|
1c0695 |
+ SEEN0_NN(av, 0); /* Will return if array not allocated nicely */
|
|
|
1c0695 |
if (len)
|
|
|
1c0695 |
av_extend(av, len);
|
|
|
1c0695 |
else
|
|
|
1c0695 |
@@ -5747,7 +5792,7 @@ static SV *old_retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
continue; /* av_extend() already filled us with undef */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
if (c != SX_ITEM)
|
|
|
1c0695 |
- (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0); /* Will croak out */
|
|
|
1c0695 |
+ (void) retrieve_other(aTHX_ cxt, 0); /* Will croak out */
|
|
|
1c0695 |
TRACEME(("(#%d) item", i));
|
|
|
1c0695 |
sv = retrieve(aTHX_ cxt, 0); /* Retrieve item */
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
@@ -5756,7 +5801,7 @@ static SV *old_retrieve_array(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (old_retrieve_array at 0x%"UVxf")", PTR2UV(av)));
|
|
|
1c0695 |
+ TRACEME(("ok (old_retrieve_array at 0x%" UVxf ")", PTR2UV(av)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return (SV *) av;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -5793,7 +5838,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
RLEN(len);
|
|
|
1c0695 |
TRACEME(("size = %d", len));
|
|
|
1c0695 |
hv = newHV();
|
|
|
1c0695 |
- SEEN0(hv, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
+ SEEN0_NN(hv, 0); /* Will return if table not allocated properly */
|
|
|
1c0695 |
if (len == 0)
|
|
|
1c0695 |
return (SV *) hv; /* No data follow if table empty */
|
|
|
1c0695 |
hv_ksplit(hv, len + 1); /* pre-extend hash to save multiple splits */
|
|
|
1c0695 |
@@ -5824,7 +5869,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
if (!sv)
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
} else
|
|
|
1c0695 |
- (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0); /* Will croak out */
|
|
|
1c0695 |
+ (void) retrieve_other(aTHX_ cxt, 0); /* Will croak out */
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
* Get key.
|
|
|
1c0695 |
@@ -5835,7 +5880,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
GETMARK(c);
|
|
|
1c0695 |
if (c != SX_KEY)
|
|
|
1c0695 |
- (void) retrieve_other(aTHX_ (stcxt_t *) 0, 0); /* Will croak out */
|
|
|
1c0695 |
+ (void) retrieve_other(aTHX_ cxt, 0); /* Will croak out */
|
|
|
1c0695 |
RLEN(size); /* Get key size */
|
|
|
1c0695 |
KBUFCHK((STRLEN)size); /* Grow hash key read pool if needed */
|
|
|
1c0695 |
if (size)
|
|
|
1c0695 |
@@ -5851,7 +5896,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
return (SV *) 0;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieve_hash at 0x%"UVxf")", PTR2UV(hv)));
|
|
|
1c0695 |
+ TRACEME(("ok (retrieve_hash at 0x%" UVxf ")", PTR2UV(hv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return (SV *) hv;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -6090,7 +6135,7 @@ static SV *retrieve(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
I32 tagn;
|
|
|
1c0695 |
svh = hv_fetch(cxt->hseen, (char *) &tag, sizeof(tag), FALSE);
|
|
|
1c0695 |
if (!svh)
|
|
|
1c0695 |
- CROAK(("Old tag 0x%"UVxf" should have been mapped already",
|
|
|
1c0695 |
+ CROAK(("Old tag 0x%" UVxf " should have been mapped already",
|
|
|
1c0695 |
(UV) tag));
|
|
|
1c0695 |
tagn = SvIV(*svh); /* Mapped tag number computed earlier below */
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -6100,10 +6145,12 @@ static SV *retrieve(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
|
|
|
1c0695 |
svh = av_fetch(cxt->aseen, tagn, FALSE);
|
|
|
1c0695 |
if (!svh)
|
|
|
1c0695 |
- CROAK(("Object #%"IVdf" should have been retrieved already",
|
|
|
1c0695 |
+ CROAK(("Object #%" IVdf
|
|
|
1c0695 |
+ " should have been retrieved already",
|
|
|
1c0695 |
(IV) tagn));
|
|
|
1c0695 |
sv = *svh;
|
|
|
1c0695 |
- TRACEME(("has retrieved #%d at 0x%"UVxf, tagn, PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("has retrieved #%d at 0x%" UVxf, tagn,
|
|
|
1c0695 |
+ PTR2UV(sv)));
|
|
|
1c0695 |
SvREFCNT_inc(sv); /* One more reference to this same sv */
|
|
|
1c0695 |
return sv; /* The SV pointer where object was retrieved */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -6141,10 +6188,11 @@ static SV *retrieve(pTHX_ stcxt_t *cxt, const char *cname)
|
|
|
1c0695 |
tag = ntohl(tag);
|
|
|
1c0695 |
svh = av_fetch(cxt->aseen, tag, FALSE);
|
|
|
1c0695 |
if (!svh)
|
|
|
1c0695 |
- CROAK(("Object #%"IVdf" should have been retrieved already",
|
|
|
1c0695 |
+ CROAK(("Object #%" IVdf
|
|
|
1c0695 |
+ " should have been retrieved already",
|
|
|
1c0695 |
(IV) tag));
|
|
|
1c0695 |
sv = *svh;
|
|
|
1c0695 |
- TRACEME(("had retrieved #%d at 0x%"UVxf, tag, PTR2UV(sv)));
|
|
|
1c0695 |
+ TRACEME(("had retrieved #%d at 0x%" UVxf, tag, PTR2UV(sv)));
|
|
|
1c0695 |
SvREFCNT_inc(sv); /* One more reference to this same sv */
|
|
|
1c0695 |
return sv; /* The SV pointer where object was retrieved */
|
|
|
1c0695 |
} else if (type >= SX_ERROR && cxt->ver_minor > STORABLE_BIN_MINOR) {
|
|
|
1c0695 |
@@ -6207,7 +6255,7 @@ first_time: /* Will disappear when support for old format is dropped */
|
|
|
1c0695 |
}
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("ok (retrieved 0x%"UVxf", refcnt=%d, %s)", PTR2UV(sv),
|
|
|
1c0695 |
+ TRACEME(("ok (retrieved 0x%" UVxf ", refcnt=%d, %s)", PTR2UV(sv),
|
|
|
1c0695 |
SvREFCNT(sv) - 1, sv_reftype(sv, FALSE)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return sv; /* Ok */
|
|
|
1c0695 |
@@ -6250,6 +6298,7 @@ static SV *do_retrieve(
|
|
|
1c0695 |
* free up memory for them now.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
if (cxt->s_dirty)
|
|
|
1c0695 |
clean_context(aTHX_ cxt);
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -6393,7 +6442,7 @@ static SV *do_retrieve(
|
|
|
1c0695 |
#endif
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("retrieve got %s(0x%"UVxf")",
|
|
|
1c0695 |
+ TRACEME(("retrieve got %s(0x%" UVxf ")",
|
|
|
1c0695 |
sv_reftype(sv, FALSE), PTR2UV(sv)));
|
|
|
1c0695 |
|
|
|
1c0695 |
/*
|
|
|
1c0695 |
@@ -6496,6 +6545,7 @@ static SV *dclone(pTHX_ SV *sv)
|
|
|
1c0695 |
* free up memory for them now.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
if (cxt->s_dirty)
|
|
|
1c0695 |
clean_context(aTHX_ cxt);
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -6533,6 +6583,7 @@ static SV *dclone(pTHX_ SV *sv)
|
|
|
1c0695 |
* Now, 'cxt' may refer to a new context.
|
|
|
1c0695 |
*/
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
ASSERT(!cxt->s_dirty, ("clean context"));
|
|
|
1c0695 |
ASSERT(!cxt->entry, ("entry will not cause new context allocation"));
|
|
|
1c0695 |
|
|
|
1c0695 |
@@ -6551,7 +6602,7 @@ static SV *dclone(pTHX_ SV *sv)
|
|
|
1c0695 |
cxt->s_tainted = SvTAINTED(sv);
|
|
|
1c0695 |
out = do_retrieve(aTHX_ (PerlIO*) 0, Nullsv, ST_CLONE);
|
|
|
1c0695 |
|
|
|
1c0695 |
- TRACEME(("dclone returns 0x%"UVxf, PTR2UV(out)));
|
|
|
1c0695 |
+ TRACEME(("dclone returns 0x%" UVxf, PTR2UV(out)));
|
|
|
1c0695 |
|
|
|
1c0695 |
return out;
|
|
|
1c0695 |
}
|
|
|
1c0695 |
@@ -6696,6 +6747,7 @@ last_op_in_netorder()
|
|
|
1c0695 |
if (ix) {
|
|
|
1c0695 |
dSTCXT;
|
|
|
1c0695 |
|
|
|
1c0695 |
+ assert(cxt);
|
|
|
1c0695 |
result = cxt->entry && (cxt->optype & ix) ? TRUE : FALSE;
|
|
|
1c0695 |
} else {
|
|
|
1c0695 |
result = !!last_op_in_netorder(aTHX);
|
|
|
1c0695 |
diff --git a/t/code.t b/t/code.t
|
|
|
1c0695 |
index 7fc40ba..d31e231 100644
|
|
|
1c0695 |
--- a/t/code.t
|
|
|
1c0695 |
+++ b/t/code.t
|
|
|
1c0695 |
@@ -71,7 +71,7 @@ local *FOO;
|
|
|
1c0695 |
|
|
|
1c0695 |
\&dclone, # XS function
|
|
|
1c0695 |
|
|
|
1c0695 |
- sub { open FOO, "/" },
|
|
|
1c0695 |
+ sub { open FOO, '<', "/" },
|
|
|
1c0695 |
);
|
|
|
1c0695 |
|
|
|
1c0695 |
$Storable::Deparse = 1;
|
|
|
1c0695 |
@@ -191,7 +191,7 @@ is(prototype($thawed->[4]), prototype($obj[0]->[4]));
|
|
|
1c0695 |
my $devnull = File::Spec->devnull;
|
|
|
1c0695 |
|
|
|
1c0695 |
open(SAVEERR, ">&STDERR");
|
|
|
1c0695 |
- open(STDERR, ">$devnull") or
|
|
|
1c0695 |
+ open(STDERR, '>', $devnull) or
|
|
|
1c0695 |
( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
|
|
|
1c0695 |
|
|
|
1c0695 |
eval { $freezed = freeze $obj[0]->[0] };
|
|
|
1c0695 |
diff --git a/t/compat01.t b/t/compat01.t
|
|
|
1c0695 |
index 2827676..56d7df6 100644
|
|
|
1c0695 |
--- a/t/compat01.t
|
|
|
1c0695 |
+++ b/t/compat01.t
|
|
|
1c0695 |
@@ -33,7 +33,7 @@ my $testno;
|
|
|
1c0695 |
for my $dump (@dumps) {
|
|
|
1c0695 |
$testno++;
|
|
|
1c0695 |
|
|
|
1c0695 |
- open(FH, ">$file") || die "Can't create $file: $!";
|
|
|
1c0695 |
+ open(FH, '>', $file) || die "Can't create $file: $!";
|
|
|
1c0695 |
binmode(FH);
|
|
|
1c0695 |
print FH $dump;
|
|
|
1c0695 |
close(FH) || die "Can't write $file: $!";
|
|
|
1c0695 |
diff --git a/t/dclone.t b/t/dclone.t
|
|
|
1c0695 |
index 1e852a3..af3d7f6 100644
|
|
|
1c0695 |
--- a/t/dclone.t
|
|
|
1c0695 |
+++ b/t/dclone.t
|
|
|
1c0695 |
@@ -68,7 +68,7 @@ is($$cloned{''}[0], \$$cloned{a});
|
|
|
1c0695 |
$$cloned{a} = "blah";
|
|
|
1c0695 |
is($$cloned{''}[0], \$$cloned{a});
|
|
|
1c0695 |
|
|
|
1c0695 |
-# [ID 20020221.007] SEGV in Storable with empty string scalar object
|
|
|
1c0695 |
+# [ID 20020221.007 (#8624)] SEGV in Storable with empty string scalar object
|
|
|
1c0695 |
package TestString;
|
|
|
1c0695 |
sub new {
|
|
|
1c0695 |
my ($type, $string) = @_;
|
|
|
1c0695 |
diff --git a/t/destroy.t b/t/destroy.t
|
|
|
1c0695 |
index e9464fb..dcc3600 100644
|
|
|
1c0695 |
--- a/t/destroy.t
|
|
|
1c0695 |
+++ b/t/destroy.t
|
|
|
1c0695 |
@@ -7,7 +7,7 @@ BEGIN {
|
|
|
1c0695 |
package foo;
|
|
|
1c0695 |
sub new { return bless {} }
|
|
|
1c0695 |
DESTROY {
|
|
|
1c0695 |
- open FH, "
|
|
|
1c0695 |
+ open FH, '<', "foo" or die $!;
|
|
|
1c0695 |
eval { Storable::pretrieve(*FH); };
|
|
|
1c0695 |
close FH or die $!;
|
|
|
1c0695 |
unlink "foo";
|
|
|
1c0695 |
diff --git a/t/file_magic.t b/t/file_magic.t
|
|
|
1c0695 |
index 5dc032d..a68665d 100644
|
|
|
1c0695 |
--- a/t/file_magic.t
|
|
|
1c0695 |
+++ b/t/file_magic.t
|
|
|
1c0695 |
@@ -441,7 +441,7 @@ nstore({}, $file);
|
|
|
1c0695 |
|
|
|
1c0695 |
for my $test (@tests) {
|
|
|
1c0695 |
my($data, $expected) = @$test;
|
|
|
1c0695 |
- open(FH, ">$file") || die "Can't create $file: $!";
|
|
|
1c0695 |
+ open(FH, '>', $file) || die "Can't create $file: $!";
|
|
|
1c0695 |
binmode(FH);
|
|
|
1c0695 |
print FH $data;
|
|
|
1c0695 |
close(FH) || die "Can't write $file: $!";
|
|
|
1c0695 |
diff --git a/t/forgive.t b/t/forgive.t
|
|
|
1c0695 |
index c994211..af7aa1d 100644
|
|
|
1c0695 |
--- a/t/forgive.t
|
|
|
1c0695 |
+++ b/t/forgive.t
|
|
|
1c0695 |
@@ -45,7 +45,7 @@ $Storable::forgive_me=1;
|
|
|
1c0695 |
my $devnull = File::Spec->devnull;
|
|
|
1c0695 |
|
|
|
1c0695 |
open(SAVEERR, ">&STDERR");
|
|
|
1c0695 |
-open(STDERR, ">$devnull") or
|
|
|
1c0695 |
+open(STDERR, '>', $devnull) or
|
|
|
1c0695 |
( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
|
|
|
1c0695 |
|
|
|
1c0695 |
eval {$result = store ($bad , 'store')};
|
|
|
1c0695 |
diff --git a/t/recurse.t b/t/recurse.t
|
|
|
1c0695 |
index 930a224..399101c 100644
|
|
|
1c0695 |
--- a/t/recurse.t
|
|
|
1c0695 |
+++ b/t/recurse.t
|
|
|
1c0695 |
@@ -272,7 +272,7 @@ sub set_c2 { $_[0]->{c2} = $_[1] }
|
|
|
1c0695 |
|
|
|
1c0695 |
#
|
|
|
1c0695 |
# Is the reference count of the extra references returned from a
|
|
|
1c0695 |
-# STORABLE_freeze hook correct? [ID 20020601.005]
|
|
|
1c0695 |
+# STORABLE_freeze hook correct? [ID 20020601.005 (#9436)]
|
|
|
1c0695 |
#
|
|
|
1c0695 |
package Foo2;
|
|
|
1c0695 |
|
|
|
1c0695 |
diff --git a/t/store.t b/t/store.t
|
|
|
1c0695 |
index be43299..b25dbd2 100644
|
|
|
1c0695 |
--- a/t/store.t
|
|
|
1c0695 |
+++ b/t/store.t
|
|
|
1c0695 |
@@ -1,7 +1,7 @@
|
|
|
1c0695 |
#!./perl
|
|
|
1c0695 |
#
|
|
|
1c0695 |
# Copyright (c) 1995-2000, Raphael Manfredi
|
|
|
1c0695 |
-#
|
|
|
1c0695 |
+#
|
|
|
1c0695 |
# You may redistribute only under the same terms as Perl 5, as specified
|
|
|
1c0695 |
# in the README file that comes with the distribution.
|
|
|
1c0695 |
#
|
|
|
1c0695 |
@@ -19,7 +19,7 @@ sub BEGIN {
|
|
|
1c0695 |
|
|
|
1c0695 |
use Storable qw(store retrieve store_fd nstore_fd fd_retrieve);
|
|
|
1c0695 |
|
|
|
1c0695 |
-use Test::More tests => 21;
|
|
|
1c0695 |
+use Test::More tests => 25;
|
|
|
1c0695 |
|
|
|
1c0695 |
$a = 'toto';
|
|
|
1c0695 |
$b = \$a;
|
|
|
1c0695 |
@@ -87,5 +87,29 @@ is(&dump($r), &dump(\%a));
|
|
|
1c0695 |
eval { $r = fd_retrieve(::OUT); };
|
|
|
1c0695 |
isnt($@, '');
|
|
|
1c0695 |
|
|
|
1c0695 |
+{
|
|
|
1c0695 |
+ my %test = (
|
|
|
1c0695 |
+ old_retrieve_array => "\x70\x73\x74\x30\x01\x0a\x02\x02\x02\x02\x00\x3d\x08\x84\x08\x85\x08\x06\x04\x00\x00\x01\x1b",
|
|
|
1c0695 |
+ old_retrieve_hash => "\x70\x73\x74\x30\x01\x0a\x03\x00\xe8\x03\x00\x00\x81\x00\x00\x00\x01\x61",
|
|
|
1c0695 |
+ retrieve_code => "\x70\x73\x74\x30\x05\x0a\x19\xf0\x00\xff\xe8\x03\x1a\x0a\x0e\x01",
|
|
|
1c0695 |
+ );
|
|
|
1c0695 |
+
|
|
|
1c0695 |
+ for my $k (sort keys %test) {
|
|
|
1c0695 |
+ open my $fh, '<', \$test{$k};
|
|
|
1c0695 |
+ eval { Storable::fd_retrieve($fh); };
|
|
|
1c0695 |
+ is($?, 0, 'RT 130098: no segfault in Storable::fd_retrieve()');
|
|
|
1c0695 |
+ }
|
|
|
1c0695 |
+}
|
|
|
1c0695 |
+
|
|
|
1c0695 |
+{
|
|
|
1c0695 |
+
|
|
|
1c0695 |
+ my $frozen =
|
|
|
1c0695 |
+ "\x70\x73\x74\x30\x04\x0a\x08\x31\x32\x33\x34\x35\x36\x37\x38\x04\x08\x08\x08\x03\xff\x00\x00\x00\x19\x08\xff\x00\x00\x00\x08\x08\xf9\x16\x16\x13\x16\x10\x10\x10\xff\x15\x16\x16\x16\x1e\x16\x16\x16\x16\x16\x16\x16\x16\x16\x16\x13\xf0\x16\x16\x16\xfe\x16\x41\x41\x41\x41\xe8\x03\x41\x41\x41\x41\x41\x41\x41\x41\x51\x41\xa9\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xb8\xac\xac\xac\xac\xac\xac\xac\xac\x9a\xac\xac\xac\xac\xac\xac\xac\xac\xac\x93\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\x00\x64\xac\xa8\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\x2c\xac\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00\x80\x41\x80\x41\x41\x41\x41\x41\x41\x51\x41\xac\xac\xac";
|
|
|
1c0695 |
+ open my $fh, '<', \$frozen;
|
|
|
1c0695 |
+ eval { Storable::fd_retrieve($fh); };
|
|
|
1c0695 |
+ pass('RT 130635: no stack smashing error when retrieving hook');
|
|
|
1c0695 |
+
|
|
|
1c0695 |
+}
|
|
|
1c0695 |
+
|
|
|
1c0695 |
close OUT or die "Could not close: $!";
|
|
|
1c0695 |
END { 1 while unlink 'store' }
|
|
|
1c0695 |
diff --git a/t/testlib.pl b/t/testlib.pl
|
|
|
1c0695 |
index 6d885d7..9b07dd4 100644
|
|
|
1c0695 |
--- a/t/testlib.pl
|
|
|
1c0695 |
+++ b/t/testlib.pl
|
|
|
1c0695 |
@@ -12,7 +12,7 @@ use Storable qw (store retrieve freeze thaw nstore nfreeze);
|
|
|
1c0695 |
sub slurp {
|
|
|
1c0695 |
my $file = shift;
|
|
|
1c0695 |
local (*FH, $/);
|
|
|
1c0695 |
- open FH, "<$file" or die "Can't open '$file': $!";
|
|
|
1c0695 |
+ open FH, '<', $file or die "Can't open '$file': $!";
|
|
|
1c0695 |
binmode FH;
|
|
|
1c0695 |
my $contents = <FH>;
|
|
|
1c0695 |
die "Can't read $file: $!" unless defined $contents;
|
|
|
1c0695 |
@@ -22,7 +22,7 @@ sub slurp {
|
|
|
1c0695 |
sub store_and_retrieve {
|
|
|
1c0695 |
my $data = shift;
|
|
|
1c0695 |
unlink $file or die "Can't unlink '$file': $!";
|
|
|
1c0695 |
- open FH, ">$file" or die "Can't open '$file': $!";
|
|
|
1c0695 |
+ open FH, '>', $file or die "Can't open '$file': $!";
|
|
|
1c0695 |
binmode FH;
|
|
|
1c0695 |
print FH $data or die "Can't print to '$file': $!";
|
|
|
1c0695 |
close FH or die "Can't close '$file': $!";
|
|
|
1c0695 |
@@ -35,4 +35,4 @@ sub freeze_and_thaw {
|
|
|
1c0695 |
return eval {thaw $data};
|
|
|
1c0695 |
}
|
|
|
1c0695 |
|
|
|
1c0695 |
-$file;
|
|
|
1c0695 |
+1;
|
|
|
1c0695 |
--
|
|
|
1c0695 |
2.9.3
|
|
|
1c0695 |
|