summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-20 12:12:03 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-20 12:12:03 +0000
commitb7fc81681f9f1c09da3b23110baf4a5324fb1bad (patch)
tree32164247faa55c58cafec0a5d8d9c6d5bc0a2745
parentd1e1fc0eef865cba36f9ba23ee22f50ab3c467ff (diff)
downloadpcre-b7fc81681f9f1c09da3b23110baf4a5324fb1bad.tar.gz
Modified, and made non-default the stack size info experimental code.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@895 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--pcre_exec.c17
-rw-r--r--pcretest.c10
2 files changed, 13 insertions, 14 deletions
diff --git a/pcre_exec.c b/pcre_exec.c
index 2bcf716..0b49cf6 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -618,22 +618,17 @@ eptrblock newptrb;
/* There is a special fudge for calling match() in a way that causes it to
measure the size of its basic stack frame when the stack is being used for
-recursion. The first argument (eptr) points to a pointer that is used
-"statically" for doing the calculation. The second argument (ecode) being NULL
-triggers this behaviour. It cannot normally every be NULL. The return is the
-negated value of the frame size. */
+recursion. The second argument (ecode) being NULL triggers this behaviour. It
+cannot normally every be NULL. The return is the negated value of the frame
+size. */
if (ecode == NULL)
{
- char **aptr = (char **)eptr;
if (rdepth == 0)
- {
- *aptr = (char *)&rdepth;
- return match(eptr, NULL, NULL, 0, NULL, NULL, 1);
- }
+ return match((PCRE_PUCHAR)&rdepth, NULL, NULL, 0, NULL, NULL, 1);
else
{
- int len = (char *)&rdepth - *aptr;
+ int len = (char *)&rdepth - (char *)eptr;
return (len > 0)? -len : len;
}
}
@@ -6219,7 +6214,7 @@ if (re == NULL && extra_data == NULL && subject == NULL && length == -1)
#ifdef NO_RECURSE
return -sizeof(heapframe);
#else
- return match((PCRE_PUCHAR)&start_partial, NULL, NULL, 0, NULL, NULL, 0);
+ return match(NULL, NULL, NULL, 0, NULL, NULL, 0);
#endif
/* Plausibility checks */
diff --git a/pcretest.c b/pcretest.c
index a05e81f..c3e547a 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -2436,9 +2436,13 @@ are set, either both UTFs are supported or both are not supported. */
(void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
printf(" Default recursion depth limit = %ld\n", lrc);
(void)PCRE_CONFIG(PCRE_CONFIG_STACKRECURSE, &rc);
- printf(" Match recursion uses %s: ", rc? "stack" : "heap");
- PCRE_EXEC(rc, NULL, NULL, NULL, -1, -1, 0, NULL, 0);
- printf("frame size = %d bytes\n", -rc);
+ printf(" Match recursion uses %s", rc? "stack" : "heap");
+ if (showstore)
+ {
+ PCRE_EXEC(stack_size, NULL, NULL, NULL, -1, -1, 0, NULL, 0);
+ printf(": %sframe size = %d bytes", rc? "approximate " : "", -stack_size);
+ }
+ printf("\n");
goto EXIT;
}
else if (strcmp(argv[op], "-help") == 0 ||