Revision: 793
http://vcs.pcre.org/viewvc?view=rev&revision=793
Author: ph10
Date: 2011-12-07 16:52:34 +0000 (Wed, 07 Dec 2011)
Log Message:
-----------
Computation of memory needed for the table of names of groups was giving an
unnecessarily large value.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_compile.c
code/trunk/testdata/testoutput10
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2011-12-07 16:44:48 UTC (rev 792)
+++ code/trunk/ChangeLog 2011-12-07 16:52:34 UTC (rev 793)
@@ -113,7 +113,10 @@
28. Fixed a possible uninitialized memory bug in pcre_jit_compile.c.
+29. Computation of memory usage for the table of capturing group names was
+ giving an unnecessarily large value.
+
Version 8.20 21-Oct-2011
------------------------
Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c 2011-12-07 16:44:48 UTC (rev 792)
+++ code/trunk/pcre_compile.c 2011-12-07 16:52:34 UTC (rev 793)
@@ -7543,7 +7543,7 @@
because nowadays we limit the maximum value of cd->names_found and
cd->name_entry_size. */
-size = length + sizeof(real_pcre) + cd->names_found * (cd->name_entry_size + 3);
+size = length + sizeof(real_pcre) + cd->names_found * cd->name_entry_size;
re = (real_pcre *)(pcre_malloc)(size);
if (re == NULL)
Modified: code/trunk/testdata/testoutput10
===================================================================
--- code/trunk/testdata/testoutput10 2011-12-07 16:44:48 UTC (rev 792)
+++ code/trunk/testdata/testoutput10 2011-12-07 16:52:34 UTC (rev 793)
@@ -194,7 +194,7 @@
------------------------------------------------------------------
/a(?P<name1>b|c)d(?P<longername2>e)/BM
-Memory allocation (code space): 42
+Memory allocation (code space): 36
------------------------------------------------------------------
0 32 Bra
3 a
@@ -212,7 +212,7 @@
------------------------------------------------------------------
/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/BM
-Memory allocation (code space): 54
+Memory allocation (code space): 45
------------------------------------------------------------------
0 41 Bra
3 25 Bra
@@ -232,7 +232,7 @@
------------------------------------------------------------------
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
-Memory allocation (code space): 37
+Memory allocation (code space): 34
------------------------------------------------------------------
0 30 Bra
3 7 CBra 1