[Pcre-svn] [895] code/trunk: Modified, and made non-default…

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [895] code/trunk: Modified, and made non-default the stack size info experimental code.
Revision: 895
          http://vcs.pcre.org/viewvc?view=rev&revision=895
Author:   ph10
Date:     2012-01-20 12:12:03 +0000 (Fri, 20 Jan 2012)


Log Message:
-----------
Modified, and made non-default the stack size info experimental code.

Modified Paths:
--------------
    code/trunk/pcre_exec.c
    code/trunk/pcretest.c


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2012-01-20 11:58:19 UTC (rev 894)
+++ code/trunk/pcre_exec.c    2012-01-20 12:12:03 UTC (rev 895)
@@ -618,22 +618,17 @@


/* 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 @@
 #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 */

Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2012-01-20 11:58:19 UTC (rev 894)
+++ code/trunk/pcretest.c    2012-01-20 12:12:03 UTC (rev 895)
@@ -2436,9 +2436,13 @@
     (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 ||