[pcre-dev] [Bug 678] New: Non-const constant tables hurt por…

Top Page
Delete this message
Author: Lauri Aalto
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 678] New: Non-const constant tables hurt portability
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=678
           Summary: Non-const constant tables hurt portability
           Product: PCRE
           Version: N/A
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: wishlist
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: laalto@???
                CC: pcre-dev@???



There's some writable global data in pcre_compile.c and pcre_dfa_exec.c that
actually does not need to be writable, it could be just const data that is
initialized at compile time.

This causes compilation errors when porting to some systems such as Symbian OS
where writable static data in shared libraries is relatively expensive and not
enabled by default.

Fixing these is easy. A patch against pcre-7.6 release:

diff ../pcre-7.6/pcre_compile.c pcre_compile.c
161c161
< static verbitem verbs[] = {
---
> static const verbitem verbs[] = {

171c171
< static int verbcount = sizeof(verbs)/sizeof(verbitem);
---
> static const int verbcount = sizeof(verbs)/sizeof(verbitem);

diff ../pcre-7.6/pcre_dfa_exec.c pcre_dfa_exec.c
87c87
< static uschar coptable[] = {
---
> static const uschar coptable[] = {

141c141
< static uschar toptable1[] = {
---
> static const uschar toptable1[] = {

149c149
< static uschar toptable2[] = {
---
> static const uschar toptable2[] = {



(pcre_globals.c also has writable global data but I'm not compiling it in for
my ports.)


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email