|
|
b8876f |
From 7b3443d31f11c15859593e5b710c301795a6de01 Mon Sep 17 00:00:00 2001
|
|
|
b8876f |
From: Tony Cook <tony@develop-help.com>
|
|
|
b8876f |
Date: Thu, 8 Jun 2017 11:06:39 +1000
|
|
|
b8876f |
Subject: [PATCH] [perl #131221] sv_dup/sv_dup_inc are only available under
|
|
|
b8876f |
threads
|
|
|
b8876f |
MIME-Version: 1.0
|
|
|
b8876f |
Content-Type: text/plain; charset=UTF-8
|
|
|
b8876f |
Content-Transfer-Encoding: 8bit
|
|
|
b8876f |
|
|
|
b8876f |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
b8876f |
---
|
|
|
b8876f |
ext/PerlIO-via/via.xs | 42 +++++++++++++++++++++++-------------------
|
|
|
b8876f |
1 file changed, 23 insertions(+), 19 deletions(-)
|
|
|
b8876f |
|
|
|
b8876f |
diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs
|
|
|
b8876f |
index 61953c8..d91c685 100644
|
|
|
b8876f |
--- a/ext/PerlIO-via/via.xs
|
|
|
b8876f |
+++ b/ext/PerlIO-via/via.xs
|
|
|
b8876f |
@@ -619,26 +619,30 @@ static PerlIO *
|
|
|
b8876f |
PerlIOVia_dup(pTHX_ PerlIO * f, PerlIO * o, CLONE_PARAMS * param,
|
|
|
b8876f |
int flags)
|
|
|
b8876f |
{
|
|
|
b8876f |
- if ((f = PerlIOBase_dup(aTHX_ f, o, param, flags)) && param) {
|
|
|
b8876f |
- /* For a non-interpreter dup stash and obj have been set up
|
|
|
b8876f |
- by the implied push.
|
|
|
b8876f |
-
|
|
|
b8876f |
- But if this is a clone for a new interpreter we need to
|
|
|
b8876f |
- translate the objects to their dups.
|
|
|
b8876f |
- */
|
|
|
b8876f |
-
|
|
|
b8876f |
- PerlIOVia *fs = PerlIOSelf(f, PerlIOVia);
|
|
|
b8876f |
- PerlIOVia *os = PerlIOSelf(o, PerlIOVia);
|
|
|
b8876f |
-
|
|
|
b8876f |
- fs->obj = sv_dup_inc(os->obj, param);
|
|
|
b8876f |
- fs->stash = (HV*)sv_dup((SV*)os->stash, param);
|
|
|
b8876f |
- fs->var = sv_dup_inc(os->var, param);
|
|
|
b8876f |
- fs->cnt = os->cnt;
|
|
|
b8876f |
-
|
|
|
b8876f |
- /* fh, io, cached CVs left as NULL, PerlIOVia_method()
|
|
|
b8876f |
- will reinitialize them if needed */
|
|
|
b8876f |
+ if ((f = PerlIOBase_dup(aTHX_ f, o, param, flags))) {
|
|
|
b8876f |
+#ifdef USE_ITHREADS
|
|
|
b8876f |
+ if (param) {
|
|
|
b8876f |
+ /* For a non-interpreter dup stash and obj have been set up
|
|
|
b8876f |
+ by the implied push.
|
|
|
b8876f |
+
|
|
|
b8876f |
+ But if this is a clone for a new interpreter we need to
|
|
|
b8876f |
+ translate the objects to their dups.
|
|
|
b8876f |
+ */
|
|
|
b8876f |
+
|
|
|
b8876f |
+ PerlIOVia *fs = PerlIOSelf(f, PerlIOVia);
|
|
|
b8876f |
+ PerlIOVia *os = PerlIOSelf(o, PerlIOVia);
|
|
|
b8876f |
+
|
|
|
b8876f |
+ fs->obj = sv_dup_inc(os->obj, param);
|
|
|
b8876f |
+ fs->stash = (HV*)sv_dup((SV*)os->stash, param);
|
|
|
b8876f |
+ fs->var = sv_dup_inc(os->var, param);
|
|
|
b8876f |
+ fs->cnt = os->cnt;
|
|
|
b8876f |
+
|
|
|
b8876f |
+ /* fh, io, cached CVs left as NULL, PerlIOVia_method()
|
|
|
b8876f |
+ will reinitialize them if needed */
|
|
|
b8876f |
+ }
|
|
|
b8876f |
+#endif
|
|
|
b8876f |
+ /* for a non-threaded dup fs->obj and stash should be set by _pushed() */
|
|
|
b8876f |
}
|
|
|
b8876f |
- /* for a non-threaded dup fs->obj and stash should be set by _pushed() */
|
|
|
b8876f |
|
|
|
b8876f |
return f;
|
|
|
b8876f |
}
|
|
|
b8876f |
--
|
|
|
b8876f |
2.9.4
|
|
|
b8876f |
|