Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: BULKDD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.068
Fixed in: 2.069



Subject: [PATCH] consting misc tables
This patch makes Compress-Raw-Bzip2 use no perl caused RW static/global memory. On some OSes/CCs, this allows complete removal of the RW initialized memory section from shared library.
Subject: 0001-consting-misc-tables.patch
From ee192022999295c6c4f58fe24af37eec7fec0ad4 Mon Sep 17 00:00:00 2001 From: bulk88 <bulk88@hotmail.com> Date: Mon, 5 Jan 2015 03:09:15 -0500 Subject: [PATCH] consting misc tables --- Bzip2.xs | 6 +++++- bzip2-src/blocksort.c | 2 +- bzip2-src/bzlib_private.h | 4 ++-- bzip2-src/crctable.c | 2 +- bzip2-src/randtable.c | 4 +++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Bzip2.xs b/Bzip2.xs index 17924c7..6f676c5 100644 --- a/Bzip2.xs +++ b/Bzip2.xs @@ -101,6 +101,10 @@ static const char my_z_errmsg[][32] = { # define NO_WRITEABLE_DATA #endif +/* for efficiency, optimize trace to a constant in regular builds */ +#undef NO_WRITEABLE_DATA +#define NO_WRITEABLE_DATA + #define TRACE_DEFAULT 0 #ifdef NO_WRITEABLE_DATA @@ -133,10 +137,10 @@ GetErrorString(error_no) int error_no ; #endif { - dTHX; char * errstr ; #if 0 + dTHX; if (error_no == BZ_ERRNO) { errstr = Strerror(errno) ; } diff --git a/bzip2-src/blocksort.c b/bzip2-src/blocksort.c index d0d662c..820167d 100644 --- a/bzip2-src/blocksort.c +++ b/bzip2-src/blocksort.c @@ -477,7 +477,7 @@ Bool mainGtU ( UInt32 i1, usually small, typically <= 20. --*/ static -Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, +const Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161, 2391484 }; diff --git a/bzip2-src/bzlib_private.h b/bzip2-src/bzlib_private.h index 5d0217f..a18585d 100644 --- a/bzip2-src/bzlib_private.h +++ b/bzip2-src/bzlib_private.h @@ -128,7 +128,7 @@ extern void bz_internal_error ( int errcode ); /*-- Stuff for randomising repetitive blocks. --*/ -extern Int32 BZ2_rNums[512]; +extern const Int32 BZ2_rNums[512]; #define BZ_RAND_DECLS \ Int32 rNToGo; \ @@ -152,7 +152,7 @@ extern Int32 BZ2_rNums[512]; /*-- Stuff for doing CRCs. --*/ -extern UInt32 BZ2_crc32Table[256]; +extern const UInt32 BZ2_crc32Table[256]; #define BZ_INITIALISE_CRC(crcVar) \ { \ diff --git a/bzip2-src/crctable.c b/bzip2-src/crctable.c index 1fea7e9..9616312 100644 --- a/bzip2-src/crctable.c +++ b/bzip2-src/crctable.c @@ -28,7 +28,7 @@ comp.compression FAQ. --*/ -UInt32 BZ2_crc32Table[256] = { +const UInt32 BZ2_crc32Table[256] = { /*-- Ugly, innit? --*/ diff --git a/bzip2-src/randtable.c b/bzip2-src/randtable.c index 6d62459..a22d4fc 100644 --- a/bzip2-src/randtable.c +++ b/bzip2-src/randtable.c @@ -23,7 +23,9 @@ /*---------------------------------------------*/ -Int32 BZ2_rNums[512] = { + +/* left as Int32 because on many CPU archs Int16s are slow */ +const Int32 BZ2_rNums[512] = { 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, -- 1.7.9.msysgit.0
On Mon Jan 05 03:19:29 2015, BULKDD wrote: Show quoted text
> This patch makes Compress-Raw-Bzip2 use no perl caused RW > static/global memory. On some OSes/CCs, this allows complete removal > of the RW initialized memory section from shared library.
Since this patches the bzip src code, maybe it needs to be submitted upstream. IDK if it is worth it.
On Mon Jan 05 03:19:29 2015, BULKDD wrote: Show quoted text
> This patch makes Compress-Raw-Bzip2 use no perl caused RW > static/global memory. On some OSes/CCs, this allows complete removal > of the RW initialized memory section from shared library.
Bump.
On Tue Jun 02 08:44:16 2015, BULKDD wrote: Show quoted text
> On Mon Jan 05 03:19:29 2015, BULKDD wrote:
> > This patch makes Compress-Raw-Bzip2 use no perl caused RW > > static/global memory. On some OSes/CCs, this allows complete removal > > of the RW initialized memory section from shared library.
> > Bump.
Bump.