Skip to content

Commit

Permalink
Deal better with copy-on-write
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Dec 8, 2012
1 parent 1b76bb0 commit c47ceb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
Revision history for File-Map

{{$NEXT}}
Deal better with copy-on-write
Remove Const::Fast dependency

0.53 2012-11-07 11:45:09 Europe/Amsterdam
Expand Down
3 changes: 2 additions & 1 deletion lib/File/Map.xs
Expand Up @@ -213,6 +213,7 @@ static void mmap_fixup(pTHX_ SV* var, struct mmap_info* info, const char* string

if (string && len)
Copy(string, info->fake_address, MIN(len, info->fake_length), char);
SV_CHECK_THINKFIRST_COW_DROP(var);
if (SvROK(var))
sv_unref_flags(var, SV_IMMEDIATE_UNREF);
if (SvPOK(var))
Expand Down Expand Up @@ -341,7 +342,7 @@ static Off_t S_sv_to_offset(pTHX_ SV* var) {
static void check_new_variable(pTHX_ SV* var) {
if (SvTYPE(var) > SVt_PVMG && SvTYPE(var) != SVt_PVLV)
Perl_croak(aTHX_ "Trying to map into a nonscalar!\n");
SV_CHECK_THINKFIRST(var);
SV_CHECK_THINKFIRST_COW_DROP(var);
if (SvREADONLY(var))
Perl_croak(aTHX_ "%s", PL_no_modify);
if (SvMAGICAL(var) && mg_find(var, PERL_MAGIC_uvar))
Expand Down

0 comments on commit c47ceb2

Please sign in to comment.