summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-10-20 14:05:47 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-10-20 14:05:47 +0000
commite41069f29fc7a1eb2dfac35a2b1b83885adc3694 (patch)
tree0a104bf2a4c0d04896e504a7e0ffe495cf40cb95
parenta2743834587451012d1a8a7aec2b7fe3a37909b9 (diff)
parented1c0269a31901e89fe8c0090d5c6cb7881eeb2f (diff)
downloadperl-e41069f29fc7a1eb2dfac35a2b1b83885adc3694.tar.gz
Integrate perlio:
[ 12530] Fixed in two places - p4 resolve [ 12529] Fix for ithreads/stdio build [ 12525] Avoid calling (now non-existant) Perl_sv_setsv(), by calling Perl_sv_setsv_flags directly. [ 12524] Add a new flag character 'm' to embed.pl set to represent "functions" which are really macros. Use it foe the troublesome sv_setsv() etc. macros in sv.h - changing latter to define sv_setsv rather than sv_setsv_macro etc. [ 12523] Add comments explaining why win32.h/embed.h are included where they are in perl.h [ 12522] Code PerlIOWin32_dup - does not fix Win32 problems as :win32 is not being used yet. [ 12511] Fix gross win32 build issues p4raw-link: @12530 on //depot/perlio: ed1c0269a31901e89fe8c0090d5c6cb7881eeb2f p4raw-link: @12529 on //depot/perlio: e0fa5af24242618e2201252ebce12dfc87892dd1 p4raw-link: @12525 on //depot/perlio: 485caab953a6ba703128628417a156139b8e7a26 p4raw-link: @12524 on //depot/perlio: af3c7592a74e7782bf0779c3272ee86140fadf53 p4raw-link: @12523 on //depot/perlio: 66a93824ccd37b2948fb857056747c3314d2a08c p4raw-link: @12522 on //depot/perlio: aa98ed8a09f34fb745cd31d496ab825619d2c82d p4raw-link: @12511 on //depot/perlio: a0ae667081b123207d4d0f2b6e6b7a5597859a57 p4raw-id: //depot/perl@12531
-rw-r--r--embed.h14
-rwxr-xr-xembed.pl24
-rw-r--r--embedvar.h2
-rwxr-xr-xext/threads/threads.xs12
-rw-r--r--global.sym6
-rw-r--r--perl.h6
-rw-r--r--perlapi.h2
-rw-r--r--perlio.c18
-rw-r--r--perlsdio.h1
-rw-r--r--pod/perlapi.pod52
-rw-r--r--proto.h12
-rw-r--r--sv.h26
-rw-r--r--win32/win32io.c33
13 files changed, 114 insertions, 94 deletions
diff --git a/embed.h b/embed.h
index 341f90768f..b591206730 100644
--- a/embed.h
+++ b/embed.h
@@ -637,7 +637,6 @@
#define sv_2iv Perl_sv_2iv
#define sv_2mortal Perl_sv_2mortal
#define sv_2nv Perl_sv_2nv
-#define sv_2pv Perl_sv_2pv
#define sv_2pvutf8 Perl_sv_2pvutf8
#define sv_2pvbyte Perl_sv_2pvbyte
#define sv_pvn_nomg Perl_sv_pvn_nomg
@@ -655,8 +654,6 @@
#define sv_catpvf Perl_sv_catpvf
#define sv_vcatpvf Perl_sv_vcatpvf
#define sv_catpv Perl_sv_catpv
-#define sv_catpvn Perl_sv_catpvn
-#define sv_catsv Perl_sv_catsv
#define sv_chop Perl_sv_chop
#define sv_clean_all Perl_sv_clean_all
#define sv_clean_objs Perl_sv_clean_objs
@@ -689,7 +686,6 @@
#define sv_peek Perl_sv_peek
#define sv_pos_u2b Perl_sv_pos_u2b
#define sv_pos_b2u Perl_sv_pos_b2u
-#define sv_pvn_force Perl_sv_pvn_force
#define sv_pvutf8n_force Perl_sv_pvutf8n_force
#define sv_pvbyten_force Perl_sv_pvbyten_force
#define sv_reftype Perl_sv_reftype
@@ -709,7 +705,6 @@
#define sv_setref_pvn Perl_sv_setref_pvn
#define sv_setpv Perl_sv_setpv
#define sv_setpvn Perl_sv_setpvn
-#define sv_setsv Perl_sv_setsv
#define sv_taint Perl_sv_taint
#define sv_tainted Perl_sv_tainted
#define sv_unmagic Perl_sv_unmagic
@@ -830,7 +825,6 @@
#define sv_pv Perl_sv_pv
#define sv_pvutf8 Perl_sv_pvutf8
#define sv_pvbyte Perl_sv_pvbyte
-#define sv_utf8_upgrade Perl_sv_utf8_upgrade
#define sv_utf8_downgrade Perl_sv_utf8_downgrade
#define sv_utf8_encode Perl_sv_utf8_encode
#define sv_utf8_decode Perl_sv_utf8_decode
@@ -1203,6 +1197,7 @@
#define ck_concat Perl_ck_concat
#define ck_defined Perl_ck_defined
#define ck_delete Perl_ck_delete
+#define ck_die Perl_ck_die
#define ck_eof Perl_ck_eof
#define ck_eval Perl_ck_eval
#define ck_exec Perl_ck_exec
@@ -2154,7 +2149,6 @@
#define sv_2iv(a) Perl_sv_2iv(aTHX_ a)
#define sv_2mortal(a) Perl_sv_2mortal(aTHX_ a)
#define sv_2nv(a) Perl_sv_2nv(aTHX_ a)
-#define sv_2pv(a,b) Perl_sv_2pv(aTHX_ a,b)
#define sv_2pvutf8(a,b) Perl_sv_2pvutf8(aTHX_ a,b)
#define sv_2pvbyte(a,b) Perl_sv_2pvbyte(aTHX_ a,b)
#define sv_pvn_nomg(a,b) Perl_sv_pvn_nomg(aTHX_ a,b)
@@ -2171,8 +2165,6 @@
#define sv_bless(a,b) Perl_sv_bless(aTHX_ a,b)
#define sv_vcatpvf(a,b,c) Perl_sv_vcatpvf(aTHX_ a,b,c)
#define sv_catpv(a,b) Perl_sv_catpv(aTHX_ a,b)
-#define sv_catpvn(a,b,c) Perl_sv_catpvn(aTHX_ a,b,c)
-#define sv_catsv(a,b) Perl_sv_catsv(aTHX_ a,b)
#define sv_chop(a,b) Perl_sv_chop(aTHX_ a,b)
#define sv_clean_all() Perl_sv_clean_all(aTHX)
#define sv_clean_objs() Perl_sv_clean_objs(aTHX)
@@ -2205,7 +2197,6 @@
#define sv_peek(a) Perl_sv_peek(aTHX_ a)
#define sv_pos_u2b(a,b,c) Perl_sv_pos_u2b(aTHX_ a,b,c)
#define sv_pos_b2u(a,b) Perl_sv_pos_b2u(aTHX_ a,b)
-#define sv_pvn_force(a,b) Perl_sv_pvn_force(aTHX_ a,b)
#define sv_pvutf8n_force(a,b) Perl_sv_pvutf8n_force(aTHX_ a,b)
#define sv_pvbyten_force(a,b) Perl_sv_pvbyten_force(aTHX_ a,b)
#define sv_reftype(a,b) Perl_sv_reftype(aTHX_ a,b)
@@ -2224,7 +2215,6 @@
#define sv_setref_pvn(a,b,c,d) Perl_sv_setref_pvn(aTHX_ a,b,c,d)
#define sv_setpv(a,b) Perl_sv_setpv(aTHX_ a,b)
#define sv_setpvn(a,b,c) Perl_sv_setpvn(aTHX_ a,b,c)
-#define sv_setsv(a,b) Perl_sv_setsv(aTHX_ a,b)
#define sv_taint(a) Perl_sv_taint(aTHX_ a)
#define sv_tainted(a) Perl_sv_tainted(aTHX_ a)
#define sv_unmagic(a,b) Perl_sv_unmagic(aTHX_ a,b)
@@ -2339,7 +2329,6 @@
#define sv_pv(a) Perl_sv_pv(aTHX_ a)
#define sv_pvutf8(a) Perl_sv_pvutf8(aTHX_ a)
#define sv_pvbyte(a) Perl_sv_pvbyte(aTHX_ a)
-#define sv_utf8_upgrade(a) Perl_sv_utf8_upgrade(aTHX_ a)
#define sv_utf8_downgrade(a,b) Perl_sv_utf8_downgrade(aTHX_ a,b)
#define sv_utf8_encode(a) Perl_sv_utf8_encode(aTHX_ a)
#define sv_utf8_decode(a) Perl_sv_utf8_decode(aTHX_ a)
@@ -2711,6 +2700,7 @@
#define ck_concat(a) Perl_ck_concat(aTHX_ a)
#define ck_defined(a) Perl_ck_defined(aTHX_ a)
#define ck_delete(a) Perl_ck_delete(aTHX_ a)
+#define ck_die(a) Perl_ck_die(aTHX_ a)
#define ck_eof(a) Perl_ck_eof(aTHX_ a)
#define ck_eval(a) Perl_ck_eval(aTHX_ a)
#define ck_exec(a) Perl_ck_exec(aTHX_ a)
diff --git a/embed.pl b/embed.pl
index 92617872af..8c3ba3ca4f 100755
--- a/embed.pl
+++ b/embed.pl
@@ -114,6 +114,7 @@ sub write_protos {
}
else {
my ($flags,$retval,$func,@args) = @_;
+ $ret .= '/* ' if $flags =~ /m/;
if ($flags =~ /s/) {
$retval = "STATIC $retval";
$func = "S_$func";
@@ -145,7 +146,9 @@ sub write_protos {
$prefix, $args - 1, $prefix, $args;
$ret .= "\n#endif\n";
}
- $ret .= ";\n";
+ $ret .= ";";
+ $ret .= ' */' if $flags =~ /m/;
+ $ret .= "\n";
}
$ret;
}
@@ -155,7 +158,7 @@ sub write_global_sym {
my $ret = "";
if (@_ > 1) {
my ($flags,$retval,$func,@args) = @_;
- if ($flags =~ /A/ && $flags !~ /x/) { # public API, so export
+ if ($flags =~ /A/ && $flags !~ /[xm]/) { # public API, so export
$func = "Perl_$func" if $flags =~ /p/;
$ret = "$func\n";
}
@@ -343,7 +346,7 @@ walk_table {
}
else {
my ($flags,$retval,$func,@args) = @_;
- unless ($flags =~ /o/) {
+ unless ($flags =~ /[om]/) {
if ($flags =~ /s/) {
$ret .= hide($func,"S_$func");
}
@@ -376,7 +379,7 @@ walk_table {
}
else {
my ($flags,$retval,$func,@args) = @_;
- unless ($flags =~ /o/) {
+ unless ($flags =~ /[om]/) {
my $args = scalar @args;
if ($args and $args[$args-1] =~ /\.\.\./) {
# we're out of luck for varargs functions under CPP
@@ -1052,6 +1055,7 @@ __END__
:
: flags are single letters with following meanings:
: A member of public API
+: m Implemented as a macro - no export, no proto, no #define
: d function has documentation with its source
: s static function, should have an S_ prefix in source
: file
@@ -1718,7 +1722,7 @@ Apd |IO* |sv_2io |SV* sv
Apd |IV |sv_2iv |SV* sv
Apd |SV* |sv_2mortal |SV* sv
Apd |NV |sv_2nv |SV* sv
-Ap |char* |sv_2pv |SV* sv|STRLEN* lp
+Am |char* |sv_2pv |SV* sv|STRLEN* lp
Apd |char* |sv_2pvutf8 |SV* sv|STRLEN* lp
Apd |char* |sv_2pvbyte |SV* sv|STRLEN* lp
Ap |char* |sv_pvn_nomg |SV* sv|STRLEN* lp
@@ -1736,8 +1740,8 @@ Apd |SV* |sv_bless |SV* sv|HV* stash
Afpd |void |sv_catpvf |SV* sv|const char* pat|...
Ap |void |sv_vcatpvf |SV* sv|const char* pat|va_list* args
Apd |void |sv_catpv |SV* sv|const char* ptr
-Apd |void |sv_catpvn |SV* sv|const char* ptr|STRLEN len
-Apd |void |sv_catsv |SV* dsv|SV* ssv
+Amd |void |sv_catpvn |SV* sv|const char* ptr|STRLEN len
+Amd |void |sv_catsv |SV* dsv|SV* ssv
Apd |void |sv_chop |SV* sv|char* ptr
pd |I32 |sv_clean_all
pd |void |sv_clean_objs
@@ -1772,7 +1776,7 @@ Apd |SV* |sv_newref |SV* sv
Ap |char* |sv_peek |SV* sv
Apd |void |sv_pos_u2b |SV* sv|I32* offsetp|I32* lenp
Apd |void |sv_pos_b2u |SV* sv|I32* offsetp
-Apd |char* |sv_pvn_force |SV* sv|STRLEN* lp
+Amd |char* |sv_pvn_force |SV* sv|STRLEN* lp
Apd |char* |sv_pvutf8n_force|SV* sv|STRLEN* lp
Apd |char* |sv_pvbyten_force|SV* sv|STRLEN* lp
Apd |char* |sv_reftype |SV* sv|int ob
@@ -1793,7 +1797,7 @@ Apd |SV* |sv_setref_pvn |SV* rv|const char* classname|char* pv \
|STRLEN n
Apd |void |sv_setpv |SV* sv|const char* ptr
Apd |void |sv_setpvn |SV* sv|const char* ptr|STRLEN len
-Apd |void |sv_setsv |SV* dsv|SV* ssv
+Amd |void |sv_setsv |SV* dsv|SV* ssv
Apd |void |sv_taint |SV* sv
Apd |bool |sv_tainted |SV* sv
Apd |int |sv_unmagic |SV* sv|int type
@@ -1925,7 +1929,7 @@ Apd |char* |sv_2pvbyte_nolen|SV* sv
Apd |char* |sv_pv |SV *sv
Apd |char* |sv_pvutf8 |SV *sv
Apd |char* |sv_pvbyte |SV *sv
-Apd |STRLEN |sv_utf8_upgrade|SV *sv
+Amd |STRLEN |sv_utf8_upgrade|SV *sv
ApdM |bool |sv_utf8_downgrade|SV *sv|bool fail_ok
Apd |void |sv_utf8_encode |SV *sv
ApdM |bool |sv_utf8_decode |SV *sv
diff --git a/embedvar.h b/embedvar.h
index 26c0eb12a6..d2e15a0801 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -1321,7 +1321,6 @@
#define PL_do_undump (PL_Vars.Gdo_undump)
#define PL_hexdigit (PL_Vars.Ghexdigit)
#define PL_malloc_mutex (PL_Vars.Gmalloc_mutex)
-#define PL_my_inv_rand_max (PL_Vars.Gmy_inv_rand_max)
#define PL_op_mutex (PL_Vars.Gop_mutex)
#define PL_patleave (PL_Vars.Gpatleave)
#define PL_sharedsv_space (PL_Vars.Gsharedsv_space)
@@ -1336,7 +1335,6 @@
#define PL_Gdo_undump PL_do_undump
#define PL_Ghexdigit PL_hexdigit
#define PL_Gmalloc_mutex PL_malloc_mutex
-#define PL_Gmy_inv_rand_max PL_my_inv_rand_max
#define PL_Gop_mutex PL_op_mutex
#define PL_Gpatleave PL_patleave
#define PL_Gsharedsv_space PL_sharedsv_space
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index cce263a7c4..b2fa87e5f9 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -102,13 +102,13 @@ SV* Perl_thread_create(char* class, SV* init_function, SV* params) {
temp_store = Perl_get_sv(current_perl, "threads::paramtempstore",
TRUE | GV_ADDMULTI);
- Perl_sv_setsv(current_perl, temp_store,params);
+ Perl_sv_setsv_flags(current_perl, temp_store,params, SV_GMAGIC);
params = NULL;
temp_store = NULL;
temp_store = Perl_get_sv(current_perl, "threads::calltempstore",
TRUE | GV_ADDMULTI);
- Perl_sv_setsv(current_perl,temp_store, init_function);
+ Perl_sv_setsv_flags(current_perl,temp_store, init_function, SV_GMAGIC);
init_function = NULL;
temp_store = NULL;
@@ -129,18 +129,18 @@ SV* Perl_thread_create(char* class, SV* init_function, SV* params) {
* inteprreter */
temp_store = Perl_get_sv(thread->interp, "threads::paramtempstore",FALSE);
- Perl_sv_setsv(thread->interp,temp_store, &PL_sv_undef);
+ Perl_sv_setsv_flags(thread->interp,temp_store, &PL_sv_undef, SV_GMAGIC);
temp_store = Perl_get_sv(thread->interp,"threads::calltempstore",FALSE);
- Perl_sv_setsv(thread->interp,temp_store, &PL_sv_undef);
+ Perl_sv_setsv_flags(thread->interp,temp_store, &PL_sv_undef, SV_GMAGIC);
PERL_SET_CONTEXT(current_perl);
temp_store = Perl_get_sv(current_perl,"threads::paramtempstore",FALSE);
- Perl_sv_setsv(current_perl, temp_store, &PL_sv_undef);
+ Perl_sv_setsv_flags(current_perl, temp_store, &PL_sv_undef, SV_GMAGIC);
temp_store = Perl_get_sv(current_perl,"threads::calltempstore",FALSE);
- Perl_sv_setsv(current_perl, temp_store, &PL_sv_undef);
+ Perl_sv_setsv_flags(current_perl, temp_store, &PL_sv_undef, SV_GMAGIC);
/* let's init the thread */
diff --git a/global.sym b/global.sym
index b5c912b36f..c5a924697b 100644
--- a/global.sym
+++ b/global.sym
@@ -393,7 +393,6 @@ Perl_sv_2io
Perl_sv_2iv
Perl_sv_2mortal
Perl_sv_2nv
-Perl_sv_2pv
Perl_sv_2pvutf8
Perl_sv_2pvbyte
Perl_sv_pvn_nomg
@@ -410,8 +409,6 @@ Perl_sv_bless
Perl_sv_catpvf
Perl_sv_vcatpvf
Perl_sv_catpv
-Perl_sv_catpvn
-Perl_sv_catsv
Perl_sv_chop
Perl_sv_clear
Perl_sv_cmp
@@ -439,7 +436,6 @@ Perl_sv_newref
Perl_sv_peek
Perl_sv_pos_u2b
Perl_sv_pos_b2u
-Perl_sv_pvn_force
Perl_sv_pvutf8n_force
Perl_sv_pvbyten_force
Perl_sv_reftype
@@ -459,7 +455,6 @@ Perl_sv_setref_pv
Perl_sv_setref_pvn
Perl_sv_setpv
Perl_sv_setpvn
-Perl_sv_setsv
Perl_sv_taint
Perl_sv_tainted
Perl_sv_unmagic
@@ -549,7 +544,6 @@ Perl_sv_2pvbyte_nolen
Perl_sv_pv
Perl_sv_pvutf8
Perl_sv_pvbyte
-Perl_sv_utf8_upgrade
Perl_sv_utf8_downgrade
Perl_sv_utf8_encode
Perl_sv_utf8_decode
diff --git a/perl.h b/perl.h
index a7e7461e92..2959df463f 100644
--- a/perl.h
+++ b/perl.h
@@ -425,6 +425,9 @@ int usleep(unsigned int);
# define MYSWAP
#endif
+/* Cannot include embed.h here on Win32 as win32.h has not
+ yet been included and defines some config variables e.g. HAVE_INTERP_INTERN
+ */
#if !defined(PERL_FOR_X2P) && !(defined(WIN32)||defined(VMS))
# include "embed.h"
#endif
@@ -1891,7 +1894,7 @@ typedef pthread_key_t perl_key;
#endif /* NETWARE */
#endif /* USE_5005THREADS || USE_ITHREADS */
-#ifdef WIN32
+#if defined(WIN32)
# include "win32.h"
#endif
@@ -3229,6 +3232,7 @@ END_EXTERN_C
#endif
#if defined(WIN32)
+/* Now all the config stuff is setup we can include embed.h */
# include "embed.h"
#endif
diff --git a/perlapi.h b/perlapi.h
index 4d7a521aa8..325b3607a1 100644
--- a/perlapi.h
+++ b/perlapi.h
@@ -923,8 +923,6 @@ END_EXTERN_C
#define PL_hexdigit (*Perl_Ghexdigit_ptr(NULL))
#undef PL_malloc_mutex
#define PL_malloc_mutex (*Perl_Gmalloc_mutex_ptr(NULL))
-#undef PL_my_inv_rand_max
-#define PL_my_inv_rand_max (*Perl_Gmy_inv_rand_max_ptr(NULL))
#undef PL_op_mutex
#define PL_op_mutex (*Perl_Gop_mutex_ptr(NULL))
#undef PL_patleave
diff --git a/perlio.c b/perlio.c
index dd9f394c84..963601acb6 100644
--- a/perlio.c
+++ b/perlio.c
@@ -128,6 +128,24 @@ PerlIO_binmode(pTHX_ PerlIO *fp, int iotype, int mode, const char *names)
#endif
}
+PerlIO *
+PerlIO_fdupopen(pTHX_ PerlIO *f, CLONE_PARAMS *param)
+{
+ if (f) {
+ int fd = PerlLIO_dup(PerlIO_fileno(f));
+ if (fd >= 0) {
+ /* the r+ is a hack */
+ return PerlIO_fdopen(fd, "r+");
+ }
+ return NULL;
+ }
+ else {
+ SETERRNO(EBADF, SS$_IVCHAN);
+ }
+ return NULL;
+}
+
+
/*
* De-mux PerlIO_openn() into fdopen, freopen and fopen type entries
*/
diff --git a/perlsdio.h b/perlsdio.h
index a1d2bec4b3..d09b632228 100644
--- a/perlsdio.h
+++ b/perlsdio.h
@@ -13,7 +13,6 @@
#define PerlIO_stdout() stdout
#define PerlIO_stdin() stdin
-#define PerlIO_fdupopen(f) (f)
#define PerlIO_isutf8(f) 0
#define PerlIO_printf fprintf
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index 0abdc1cb03..6665191a81 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -329,7 +329,7 @@ L<perlsub/"Constant Functions">.
SV* cv_const_sv(CV* cv)
=for hackers
-Found in file op.c
+Found in file opmini.c
=item dAX
@@ -1234,7 +1234,7 @@ method, similar to C<use Foo::Bar VERSION LIST>.
void load_module(U32 flags, SV* name, SV* ver, ...)
=for hackers
-Found in file op.c
+Found in file opmini.c
=item looks_like_number
@@ -1373,7 +1373,7 @@ eligible for inlining at compile-time.
CV* newCONSTSUB(HV* stash, char* name, SV* sv)
=for hackers
-Found in file op.c
+Found in file opmini.c
=item newHV
@@ -1533,7 +1533,7 @@ Found in file sv.c
Used by C<xsubpp> to hook up XSUBs as Perl subs.
=for hackers
-Found in file op.c
+Found in file opmini.c
=item newXSproto
@@ -2397,22 +2397,22 @@ which guarantees to evaluate sv only once.
=for hackers
Found in file sv.h
-=item SvNVX
+=item SvNVx
-Returns the raw value in the SV's NV slot, without checks or conversions.
-Only use when you are sure SvNOK is true. See also C<SvNV()>.
+Coerces the given SV to a double and returns it. Guarantees to evaluate
+sv only once. Use the more efficent C<SvNV> otherwise.
- NV SvNVX(SV* sv)
+ NV SvNVx(SV* sv)
=for hackers
Found in file sv.h
-=item SvNVx
+=item SvNVX
-Coerces the given SV to a double and returns it. Guarantees to evaluate
-sv only once. Use the more efficent C<SvNV> otherwise.
+Returns the raw value in the SV's NV slot, without checks or conversions.
+Only use when you are sure SvNOK is true. See also C<SvNV()>.
- NV SvNVx(SV* sv)
+ NV SvNVX(SV* sv)
=for hackers
Found in file sv.h
@@ -2606,21 +2606,21 @@ Like C<SvPV_nolen>, but converts sv to uft8 first if necessary.
=for hackers
Found in file sv.h
-=item SvPVx
+=item SvPVX
-A version of C<SvPV> which guarantees to evaluate sv only once.
+Returns a pointer to the physical string in the SV. The SV must contain a
+string.
- char* SvPVx(SV* sv, STRLEN len)
+ char* SvPVX(SV* sv)
=for hackers
Found in file sv.h
-=item SvPVX
+=item SvPVx
-Returns a pointer to the physical string in the SV. The SV must contain a
-string.
+A version of C<SvPV> which guarantees to evaluate sv only once.
- char* SvPVX(SV* sv)
+ char* SvPVx(SV* sv, STRLEN len)
=for hackers
Found in file sv.h
@@ -2827,19 +2827,19 @@ false, defined or undefined. Does not handle 'get' magic.
=for hackers
Found in file sv.h
-=item SvTYPE
-
-Returns the type of the SV. See C<svtype>.
+=item svtype
- svtype SvTYPE(SV* sv)
+An enum of flags for Perl types. These are found in the file B<sv.h>
+in the C<svtype> enum. Test these flags with the C<SvTYPE> macro.
=for hackers
Found in file sv.h
-=item svtype
+=item SvTYPE
-An enum of flags for Perl types. These are found in the file B<sv.h>
-in the C<svtype> enum. Test these flags with the C<SvTYPE> macro.
+Returns the type of the SV. See C<svtype>.
+
+ svtype SvTYPE(SV* sv)
=for hackers
Found in file sv.h
diff --git a/proto.h b/proto.h
index 0e1d3b058b..ff3ac5f77f 100644
--- a/proto.h
+++ b/proto.h
@@ -701,7 +701,7 @@ PERL_CALLCONV IO* Perl_sv_2io(pTHX_ SV* sv);
PERL_CALLCONV IV Perl_sv_2iv(pTHX_ SV* sv);
PERL_CALLCONV SV* Perl_sv_2mortal(pTHX_ SV* sv);
PERL_CALLCONV NV Perl_sv_2nv(pTHX_ SV* sv);
-PERL_CALLCONV char* Perl_sv_2pv(pTHX_ SV* sv, STRLEN* lp);
+/* PERL_CALLCONV char* sv_2pv(pTHX_ SV* sv, STRLEN* lp); */
PERL_CALLCONV char* Perl_sv_2pvutf8(pTHX_ SV* sv, STRLEN* lp);
PERL_CALLCONV char* Perl_sv_2pvbyte(pTHX_ SV* sv, STRLEN* lp);
PERL_CALLCONV char* Perl_sv_pvn_nomg(pTHX_ SV* sv, STRLEN* lp);
@@ -723,8 +723,8 @@ PERL_CALLCONV void Perl_sv_catpvf(pTHX_ SV* sv, const char* pat, ...)
;
PERL_CALLCONV void Perl_sv_vcatpvf(pTHX_ SV* sv, const char* pat, va_list* args);
PERL_CALLCONV void Perl_sv_catpv(pTHX_ SV* sv, const char* ptr);
-PERL_CALLCONV void Perl_sv_catpvn(pTHX_ SV* sv, const char* ptr, STRLEN len);
-PERL_CALLCONV void Perl_sv_catsv(pTHX_ SV* dsv, SV* ssv);
+/* PERL_CALLCONV void sv_catpvn(pTHX_ SV* sv, const char* ptr, STRLEN len); */
+/* PERL_CALLCONV void sv_catsv(pTHX_ SV* dsv, SV* ssv); */
PERL_CALLCONV void Perl_sv_chop(pTHX_ SV* sv, char* ptr);
PERL_CALLCONV I32 Perl_sv_clean_all(pTHX);
PERL_CALLCONV void Perl_sv_clean_objs(pTHX);
@@ -757,7 +757,7 @@ PERL_CALLCONV SV* Perl_sv_newref(pTHX_ SV* sv);
PERL_CALLCONV char* Perl_sv_peek(pTHX_ SV* sv);
PERL_CALLCONV void Perl_sv_pos_u2b(pTHX_ SV* sv, I32* offsetp, I32* lenp);
PERL_CALLCONV void Perl_sv_pos_b2u(pTHX_ SV* sv, I32* offsetp);
-PERL_CALLCONV char* Perl_sv_pvn_force(pTHX_ SV* sv, STRLEN* lp);
+/* PERL_CALLCONV char* sv_pvn_force(pTHX_ SV* sv, STRLEN* lp); */
PERL_CALLCONV char* Perl_sv_pvutf8n_force(pTHX_ SV* sv, STRLEN* lp);
PERL_CALLCONV char* Perl_sv_pvbyten_force(pTHX_ SV* sv, STRLEN* lp);
PERL_CALLCONV char* Perl_sv_reftype(pTHX_ SV* sv, int ob);
@@ -781,7 +781,7 @@ PERL_CALLCONV SV* Perl_sv_setref_pv(pTHX_ SV* rv, const char* classname, void* p
PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, char* pv, STRLEN n);
PERL_CALLCONV void Perl_sv_setpv(pTHX_ SV* sv, const char* ptr);
PERL_CALLCONV void Perl_sv_setpvn(pTHX_ SV* sv, const char* ptr, STRLEN len);
-PERL_CALLCONV void Perl_sv_setsv(pTHX_ SV* dsv, SV* ssv);
+/* PERL_CALLCONV void sv_setsv(pTHX_ SV* dsv, SV* ssv); */
PERL_CALLCONV void Perl_sv_taint(pTHX_ SV* sv);
PERL_CALLCONV bool Perl_sv_tainted(pTHX_ SV* sv);
PERL_CALLCONV int Perl_sv_unmagic(pTHX_ SV* sv, int type);
@@ -922,7 +922,7 @@ PERL_CALLCONV char* Perl_sv_2pvbyte_nolen(pTHX_ SV* sv);
PERL_CALLCONV char* Perl_sv_pv(pTHX_ SV *sv);
PERL_CALLCONV char* Perl_sv_pvutf8(pTHX_ SV *sv);
PERL_CALLCONV char* Perl_sv_pvbyte(pTHX_ SV *sv);
-PERL_CALLCONV STRLEN Perl_sv_utf8_upgrade(pTHX_ SV *sv);
+/* PERL_CALLCONV STRLEN sv_utf8_upgrade(pTHX_ SV *sv); */
PERL_CALLCONV bool Perl_sv_utf8_downgrade(pTHX_ SV *sv, bool fail_ok);
PERL_CALLCONV void Perl_sv_utf8_encode(pTHX_ SV *sv);
PERL_CALLCONV bool Perl_sv_utf8_decode(pTHX_ SV *sv);
diff --git a/sv.h b/sv.h
index 4d08a90138..039c22f793 100644
--- a/sv.h
+++ b/sv.h
@@ -972,29 +972,15 @@ otherwise.
#undef SvNV
#define SvNV(sv) (SvNOK(sv) ? SvNVX(sv) : sv_2nv(sv))
-#define sv_setsv_macro(dsv, ssv) sv_setsv_flags(dsv, ssv, SV_GMAGIC)
+#define sv_setsv(dsv, ssv) sv_setsv_flags(dsv, ssv, SV_GMAGIC)
#define sv_setsv_nomg(dsv, ssv) sv_setsv_flags(dsv, ssv, 0)
-#define sv_catsv_macro(dsv, ssv) sv_catsv_flags(dsv, ssv, SV_GMAGIC)
+#define sv_catsv(dsv, ssv) sv_catsv_flags(dsv, ssv, SV_GMAGIC)
#define sv_catsv_nomg(dsv, ssv) sv_catsv_flags(dsv, ssv, 0)
-#define sv_catpvn_macro(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC)
-#define sv_2pv_macro(sv, lp) sv_2pv_flags(sv, lp, SV_GMAGIC)
+#define sv_catpvn(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC)
+#define sv_2pv(sv, lp) sv_2pv_flags(sv, lp, SV_GMAGIC)
#define sv_2pv_nomg(sv, lp) sv_2pv_flags(sv, lp, 0)
-#define sv_pvn_force_macro(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC)
-#define sv_utf8_upgrade_macro(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
-
-/* function style also available for sourcecompat */
-#undef sv_setsv
-#define sv_setsv(dsv, ssv) sv_setsv_macro(dsv, ssv)
-#undef sv_catsv
-#define sv_catsv(dsv, ssv) sv_catsv_macro(dsv, ssv)
-#undef sv_catpvn
-#define sv_catpvn(dsv, sstr, slen) sv_catpvn_macro(dsv, sstr, slen)
-#undef sv_2pv
-#define sv_2pv(sv, lp) sv_2pv_macro(sv, lp)
-#undef sv_pvn_force
-#define sv_pvn_force(sv, lp) sv_pvn_force_macro(sv, lp)
-#undef sv_utf8_upgrade
-#define sv_utf8_upgrade(sv) sv_utf8_upgrade_macro(sv)
+#define sv_pvn_force(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC)
+#define sv_utf8_upgrade(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
#undef SvPV
#define SvPV(sv, lp) SvPV_flags(sv, lp, SV_GMAGIC)
diff --git a/win32/win32io.c b/win32/win32io.c
index 6152647a74..98eb292286 100644
--- a/win32/win32io.c
+++ b/win32/win32io.c
@@ -297,8 +297,37 @@ PerlIOWin32_close(PerlIO *f)
PerlIO *
PerlIOWin32_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *params)
{
- /* Almost certainly needs more work */
- return PerlIOBase_dup(aTHX_ f, o, params);
+ PerlIOWin32 *os = PerlIOSelf(f,PerlIOWin32);
+ HANDLE proc = GetCurrentProcess();
+ HANDLE new;
+ if (DuplicateHandle(proc, os->h, proc, &new, 0, FALSE, DUPLICATE_SAME_ACCESS))
+ {
+ char mode[8];
+ int fd = win32_open_osfhandle((long) new, PerlIOUnix_oflags(PerlIO_modestr(o,mode)));
+ if (fd >= 0)
+ {
+ f = PerlIOBase_dup(aTHX_ f, o, params);
+ if (f)
+ {
+ PerlIOWin32 *fs = PerlIOSelf(f,PerlIOWin32);
+ fs->h = new;
+ fs->fd = fd;
+ fs->refcnt = 1;
+ fdtable[fd] = fs;
+ if (fd > max_open_fd)
+ max_open_fd = fd;
+ }
+ else
+ {
+ win32_close(fd);
+ }
+ }
+ else
+ {
+ CloseHandle(new);
+ }
+ }
+ return f;
}
PerlIO_funcs PerlIO_win32 = {