Skip Menu |

This queue is for tickets about the Compress-Raw-Bzip2 CPAN distribution.

Report information
The Basics
Id: 81352
Status: resolved
Priority: 0/
Queue: Compress-Raw-Bzip2

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.059



Subject: [PATCH] Copy-on-write support
I am currently working on a copy-on-write mechanism for perl 5.18, which in my testing has shown a 3% speed increase. Unfortunately it causes test failures, because inflate assumes that the input is a regular string. If the string is going to be modified in place, it needs to be forced to a string first. Please consider the attached patch.
Subject: compress-raw-bzip2-cow.text
diff --git a/cpan/Compress-Raw-Bzip2/Bzip2.xs b/cpan/Compress-Raw-Bzip2/Bzip2.xs index d430b24..7010324 100644 --- a/cpan/Compress-Raw-Bzip2/Bzip2.xs +++ b/cpan/Compress-Raw-Bzip2/Bzip2.xs @@ -733,8 +733,11 @@ bzinflate (s, buf, output) /* If the buffer is a reference, dereference it */ buf = deRef(buf, "bzinflate") ; - if (s->flags & FLAG_CONSUME_INPUT && SvREADONLY(buf)) + if (s->flags & FLAG_CONSUME_INPUT) { + if (SvREADONLY(buf)) croak(UNCOMPRESS_CLASS "::bzinflate input parameter cannot be read-only when ConsumeInput is specified"); + SvPV_force(buf,PL_na); + } #ifdef UTF8_AVAILABLE if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1)) croak("Wide character in " UNCOMPRESS_CLASS "::bzinflate input parameter");
On Thu Nov 22 17:47:01 2012, SPROUT wrote: Show quoted text
> I am currently working on a copy-on-write mechanism for perl 5.18, > which in my testing has > shown a 3% speed increase. > > Unfortunately it causes test failures, because inflate assumes that > the input is a regular string. > If the string is going to be modified in place, it needs to be forced > to a string first. > > Please consider the attached patch.
Sorry, that patch was made from the perl repository and I forget to adjust the file paths. This one is probably easier to apply.
Subject: easier to apply.text
diff --git a/Bzip2.xs b/Bzip2.xs index d430b24..7010324 100644 --- a/Bzip2.xs +++ b/Bzip2.xs @@ -733,8 +733,11 @@ bzinflate (s, buf, output) /* If the buffer is a reference, dereference it */ buf = deRef(buf, "bzinflate") ; - if (s->flags & FLAG_CONSUME_INPUT && SvREADONLY(buf)) + if (s->flags & FLAG_CONSUME_INPUT) { + if (SvREADONLY(buf)) croak(UNCOMPRESS_CLASS "::bzinflate input parameter cannot be read-only when ConsumeInput is specified"); + SvPV_force(buf,PL_na); + } #ifdef UTF8_AVAILABLE if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1)) croak("Wide character in " UNCOMPRESS_CLASS "::bzinflate input parameter");
Thanks applied. Paul
Version 2.059 just uploaded to CPAN with this change included. Paul
On Sun Nov 25 08:38:54 2012, PMQS wrote: Show quoted text
> Version 2.059 just uploaded to CPAN with this change included. > > Paul
Thank you.