diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | maint/MultiStage2.py | 19 | ||||
-rw-r--r-- | pcre_ucd.c | 19 |
3 files changed, 45 insertions, 0 deletions
@@ -34,6 +34,13 @@ Version 8.00 ??-???-?? 6. No libpcreposix.pc file was created for pkg-config; there was just libpcre.pc and libpcrecpp.pc. The omission has been rectified. +7. Added #ifndef SUPPORT_UCP into the pcre_ucd.c module, to reduce its size + when UCP support is not needed, by modifying the Python script that + generates it from Unicode data files. This should not matter if the module + is correctly used as a library, but I received one complaint about 50K of + unwanted data. My guess is that the person linked everything into his + program rather than using a library. Anyway, it does no harm. + Version 7.9 11-Apr-09 --------------------- diff --git a/maint/MultiStage2.py b/maint/MultiStage2.py index f1a8e15..2e20039 100755 --- a/maint/MultiStage2.py +++ b/maint/MultiStage2.py @@ -26,6 +26,7 @@ # Adjusted global table names by prefixing _pcre_. # Commented out stuff relating to the casefolding table, which isn't used. # Corrected size calculation +# Add #ifndef SUPPORT_UCP to use dummy tables when no UCP support is needed. # # The tables generated by this script are used by macros defined in # pcre_internal.h. They look up Unicode character properties using short @@ -276,11 +277,28 @@ for block_size in [2 ** i for i in range(5,10)]: print "#ifdef HAVE_CONFIG_H" print "#include \"config.h\"" print "#endif" +print print "#include \"pcre_internal.h\"" print print "/* Unicode character database. */" print "/* This file was autogenerated by the MultiStage2.py script. */" print "/* Total size: %d bytes, block size: %d. */" % (min_size, min_block_size) +print +print "/* The tables herein are needed only when UCP support is built */" +print "/* into PCRE. This module should not be referenced otherwise, so */" +print "/* it should not matter whether it is compiled or not. However */" +print "/* a comment was received about space saving - maybe the guy linked */" +print "/* all the modules rather than using a library - so we include a */" +print "/* condition to cut out the tables when not needed. But don't leave */" +print "/* a totally empty module because some compilers barf at that. */" +print "/* Instead, just supply small dummy tables. */" +print +print "#ifndef SUPPORT_UCP" +print "const ucd_record _pcre_ucd_records[] = {{0,0,0 }};" +print "const uschar _pcre_ucd_stage1[] = {0};" +print "const pcre_uint16 _pcre_ucd_stage2[] = {0};" +print "#else" +print print record_struct print_records(records, record_size) print_table(min_stage1, '_pcre_ucd_stage1') @@ -288,6 +306,7 @@ print_table(min_stage2, '_pcre_ucd_stage2', min_block_size) print "#if UCD_BLOCK_SIZE != %d" % min_block_size print "#error Please correct UCD_BLOCK_SIZE in pcre_internal.h" print "#endif" +print "#endif /* SUPPORT_UCP */" """ @@ -1,11 +1,28 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + #include "pcre_internal.h" /* Unicode character database. */ /* This file was autogenerated by the MultiStage2.py script. */ /* Total size: 52808 bytes, block size: 128. */ + +/* The tables herein are needed only when UCP support is built */ +/* into PCRE. This module should not be referenced otherwise, so */ +/* it should not matter whether it is compiled or not. However */ +/* a comment was received about space saving - maybe the guy linked */ +/* all the modules rather than using a library - so we include a */ +/* condition to cut out the tables when not needed. But don't leave */ +/* a totally empty module because some compilers barf at that. */ +/* Instead, just supply small dummy tables. */ + +#ifndef SUPPORT_UCP +const ucd_record _pcre_ucd_records[] = {{0,0,0 }}; +const uschar _pcre_ucd_stage1[] = {0}; +const pcre_uint16 _pcre_ucd_stage2[] = {0}; +#else + /* When recompiling tables with a new Unicode version, please check types in the structure definition from pcre_internal.h: typedef struct { @@ -14,6 +31,7 @@ uschar property_1; pcre_int32 property_2; } ucd_record; */ + const ucd_record _pcre_ucd_records[] = { /* 3656 bytes, record size 8 */ { 9, 0, 0, }, /* 0 */ { 9, 29, 0, }, /* 1 */ @@ -2607,3 +2625,4 @@ const pcre_uint16 _pcre_ucd_stage2[] = { /* 40448 bytes, block = 128 */ #if UCD_BLOCK_SIZE != 128 #error Please correct UCD_BLOCK_SIZE in pcre_internal.h #endif +#endif /* SUPPORT_UCP */ |