diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-14 22:02:49 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-14 22:02:49 +0000 |
commit | 05ec9bb346c404c8906ed1ac374d4bce61c84f5d (patch) | |
tree | c0c3deb21e984b2371d1058155b645467055217d /util.c | |
parent | e567eb179f8c37fa2e2a16e90180982901849683 (diff) | |
download | perl-05ec9bb346c404c8906ed1ac374d4bce61c84f5d.tar.gz |
Use PerlMemShared for CopSTASHPV and CopFILE. MUCH harder than it sounds!
Need to use CopXXXXX macros everywhere and add CopSTASH_free
Add new scope type and add support for it to scope.c and scope stack
dup-er in sv.c. Add savesharedpv().
Also zealous version of Win32's vmem.h to catch all the abuses.
With this t/op/fork.t passes even with zealous checking and
checker is point a finger at various threads/shared issues.
PL_curcop->cop_io is still an issue.
p4raw-id: //depot/perlio@14259
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -891,10 +891,11 @@ Copy a string to a safe spot. This does not use an SV. char * Perl_savepv(pTHX_ const char *sv) { - register char *newaddr; - - New(902,newaddr,strlen(sv)+1,char); - (void)strcpy(newaddr,sv); + register char *newaddr = sv; + if (sv) { + New(902,newaddr,strlen(sv)+1,char); + (void)strcpy(newaddr,sv); + } return newaddr; } @@ -920,6 +921,27 @@ Perl_savepvn(pTHX_ const char *sv, register I32 len) return newaddr; } +/* +=for apidoc savesharedpv + +Copy a string to a safe spot in memory shared between threads. +This does not use an SV. + +=cut +*/ +char * +Perl_savesharedpv(pTHX_ const char *sv) +{ + register char *newaddr = sv; + if (sv) { + newaddr = PerlMemShared_malloc(strlen(sv)+1); + (void)strcpy(newaddr,sv); + } + return newaddr; +} + + + /* the SV for Perl_form() and mess() is not kept in an arena */ STATIC SV * |