/[pcre]/code/branches/pcre16/pcretest.c
ViewVC logotype

Diff of /code/branches/pcre16/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

code/trunk/pcretest.c revision 658 by ph10, Mon Aug 15 17:43:44 2011 UTC code/branches/pcre16/pcretest.c revision 756 by ph10, Mon Nov 21 10:48:42 2011 UTC
# Line 112  to keep two copies, we include the sourc Line 112  to keep two copies, we include the sourc
112  external symbols to prevent clashes. */  external symbols to prevent clashes. */
113    
114  #define _pcre_ucp_gentype      ucp_gentype  #define _pcre_ucp_gentype      ucp_gentype
115    #define _pcre_ucp_typerange    ucp_typerange
116  #define _pcre_utf8_table1      utf8_table1  #define _pcre_utf8_table1      utf8_table1
117  #define _pcre_utf8_table1_size utf8_table1_size  #define _pcre_utf8_table1_size utf8_table1_size
118  #define _pcre_utf8_table2      utf8_table2  #define _pcre_utf8_table2      utf8_table2
# Line 194  static const unsigned char *last_callout Line 195  static const unsigned char *last_callout
195  /* The buffers grow automatically if very long input lines are encountered. */  /* The buffers grow automatically if very long input lines are encountered. */
196    
197  static int buffer_size = 50000;  static int buffer_size = 50000;
198  static uschar *buffer = NULL;  static pcre_uint8 *buffer = NULL;
199  static uschar *dbuffer = NULL;  static pcre_uint8 *dbuffer = NULL;
200  static uschar *pbuffer = NULL;  static pcre_uint8 *pbuffer = NULL;
201    
202  /* Textual explanations for runtime error codes */  /* Textual explanations for runtime error codes */
203    
# Line 227  static const char *errtexts[] = { Line 228  static const char *errtexts[] = {
228    "invalid combination of newline options",    "invalid combination of newline options",
229    "bad offset value",    "bad offset value",
230    NULL,  /* SHORTUTF8 is handled specially */    NULL,  /* SHORTUTF8 is handled specially */
231    "nested recursion at the same subject position"    "nested recursion at the same subject position",
232      "JIT stack limit reached"
233  };  };
234    
235    
# Line 579  return sys_errlist[n]; Line 581  return sys_errlist[n];
581  #endif /* HAVE_STRERROR */  #endif /* HAVE_STRERROR */
582    
583    
584    /*************************************************
585    *         JIT memory callback                    *
586    *************************************************/
587    
588    static pcre_jit_stack* jit_callback(void *arg)
589    {
590    return (pcre_jit_stack *)arg;
591    }
592    
593    
594  /*************************************************  /*************************************************
# Line 604  Returns:       pointer to the start of n Line 614  Returns:       pointer to the start of n
614                 NULL if no data read and EOF reached                 NULL if no data read and EOF reached
615  */  */
616    
617  static uschar *  static pcre_uint8 *
618  extend_inputline(FILE *f, uschar *start, const char *prompt)  extend_inputline(FILE *f, pcre_uint8 *start, const char *prompt)
619  {  {
620  uschar *here = start;  pcre_uint8 *here = start;
621    
622  for (;;)  for (;;)
623    {    {
# Line 654  for (;;) Line 664  for (;;)
664    else    else
665      {      {
666      int new_buffer_size = 2*buffer_size;      int new_buffer_size = 2*buffer_size;
667      uschar *new_buffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_buffer = (unsigned char *)malloc(new_buffer_size);
668      uschar *new_dbuffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_dbuffer = (unsigned char *)malloc(new_buffer_size);
669      uschar *new_pbuffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_pbuffer = (unsigned char *)malloc(new_buffer_size);
670    
671      if (new_buffer == NULL || new_dbuffer == NULL || new_pbuffer == NULL)      if (new_buffer == NULL || new_dbuffer == NULL || new_pbuffer == NULL)
672        {        {
# Line 798  Returns:     number of characters placed Line 808  Returns:     number of characters placed
808  #if !defined NOUTF8  #if !defined NOUTF8
809    
810  static int  static int
811  ord2utf8(int cvalue, uschar *utf8bytes)  ord2utf8(int cvalue, pcre_uint8 *utf8bytes)
812  {  {
813  register int i, j;  register int i, j;
814  for (i = 0; i < utf8_table1_size; i++)  for (i = 0; i < utf8_table1_size; i++)
# Line 987  return (cb->callout_number != callout_fa Line 997  return (cb->callout_number != callout_fa
997  *            Local malloc functions              *  *            Local malloc functions              *
998  *************************************************/  *************************************************/
999    
1000  /* Alternative malloc function, to test functionality and show the size of the  /* Alternative malloc function, to test functionality and save the size of a
1001  compiled re. */  compiled re. The show_malloc variable is set only during matching. */
1002    
1003  static void *new_malloc(size_t size)  static void *new_malloc(size_t size)
1004  {  {
# Line 1006  if (show_malloc) Line 1016  if (show_malloc)
1016  free(block);  free(block);
1017  }  }
1018    
   
1019  /* For recursion malloc/free, to test stacking calls */  /* For recursion malloc/free, to test stacking calls */
1020    
1021  static void *stack_malloc(size_t size)  static void *stack_malloc(size_t size)
# Line 1062  return ((value & 0x000000ff) << 24) | Line 1071  return ((value & 0x000000ff) << 24) |
1071  *************************************************/  *************************************************/
1072    
1073  static int  static int
1074  check_match_limit(pcre *re, pcre_extra *extra, uschar *bptr, int len,  check_match_limit(pcre *re, pcre_extra *extra, pcre_uint8 *bptr, int len,
1075    int start_offset, int options, int *use_offsets, int use_size_offsets,    int start_offset, int options, int *use_offsets, int use_size_offsets,
1076    int flag, unsigned long int *limit, int errnumber, const char *msg)    int flag, unsigned long int *limit, int errnumber, const char *msg)
1077  {  {
# Line 1122  Returns:    < 0, = 0, or > 0, according Line 1131  Returns:    < 0, = 0, or > 0, according
1131  */  */
1132    
1133  static int  static int
1134  strncmpic(uschar *s, uschar *t, int n)  strncmpic(pcre_uint8 *s, pcre_uint8 *t, int n)
1135  {  {
1136  while (n--)  while (n--)
1137    {    {
# Line 1149  Returns:      appropriate PCRE_NEWLINE_x Line 1158  Returns:      appropriate PCRE_NEWLINE_x
1158  */  */
1159    
1160  static int  static int
1161  check_newline(uschar *p, FILE *f)  check_newline(pcre_uint8 *p, FILE *f)
1162  {  {
1163  if (strncmpic(p, (uschar *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;  if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;
1164  if (strncmpic(p, (uschar *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;  if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;
1165  if (strncmpic(p, (uschar *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;  if (strncmpic(p, (pcre_uint8 *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;
1166  if (strncmpic(p, (uschar *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;  if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;
1167  if (strncmpic(p, (uschar *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;  if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;
1168  if (strncmpic(p, (uschar *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;  if (strncmpic(p, (pcre_uint8 *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;
1169  if (strncmpic(p, (uschar *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;  if (strncmpic(p, (pcre_uint8 *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;
1170  fprintf(f, "Unknown newline type at: <%s\n", p);  fprintf(f, "Unknown newline type at: <%s\n", p);
1171  return 0;  return 0;
1172  }  }
# Line 1195  printf("  -p       use POSIX interface\n Line 1204  printf("  -p       use POSIX interface\n
1204  #endif  #endif
1205  printf("  -q       quiet: do not output PCRE version number at start\n");  printf("  -q       quiet: do not output PCRE version number at start\n");
1206  printf("  -S <n>   set stack size to <n> megabytes\n");  printf("  -S <n>   set stack size to <n> megabytes\n");
1207  printf("  -s       force each pattern to be studied\n"  printf("  -s       force each pattern to be studied at basic level\n"
1208           "  -s+      force each pattern to be studied, using JIT if available\n"
1209         "  -t       time compilation and execution\n");         "  -t       time compilation and execution\n");
1210  printf("  -t <n>   time compilation and execution, repeating <n> times\n");  printf("  -t <n>   time compilation and execution, repeating <n> times\n");
1211  printf("  -tm      time execution (matching) only\n");  printf("  -tm      time execution (matching) only\n");
# Line 1223  int timeit = 0; Line 1233  int timeit = 0;
1233  int timeitm = 0;  int timeitm = 0;
1234  int showinfo = 0;  int showinfo = 0;
1235  int showstore = 0;  int showstore = 0;
1236  int force_study = 0;  int force_study = -1;
1237    int force_study_options = 0;
1238  int quiet = 0;  int quiet = 0;
1239  int size_offsets = 45;  int size_offsets = 45;
1240  int size_offsets_max;  int size_offsets_max;
# Line 1237  int all_use_dfa = 0; Line 1248  int all_use_dfa = 0;
1248  int yield = 0;  int yield = 0;
1249  int stack_size;  int stack_size;
1250    
1251    pcre_jit_stack *jit_stack = NULL;
1252    
1253    
1254  /* These vectors store, end-to-end, a list of captured substring names. Assume  /* These vectors store, end-to-end, a list of captured substring names. Assume
1255  that 1024 is plenty long enough for the few names we'll be testing. */  that 1024 is plenty long enough for the few names we'll be testing. */
1256    
1257  uschar copynames[1024];  pcre_uchar copynames[1024];
1258  uschar getnames[1024];  pcre_uchar getnames[1024];
1259    
1260  uschar *copynamesptr;  pcre_uchar *copynamesptr;
1261  uschar *getnamesptr;  pcre_uchar *getnamesptr;
1262    
1263  /* Get buffers from malloc() so that Electric Fence will check their misuse  /* Get buffers from malloc() so that Electric Fence will check their misuse
1264  when I am debugging. They grow automatically when very long lines are read. */  when I am debugging. They grow automatically when very long lines are read. */
1265    
1266  buffer = (unsigned char *)malloc(buffer_size);  buffer = (pcre_uint8 *)malloc(buffer_size);
1267  dbuffer = (unsigned char *)malloc(buffer_size);  dbuffer = (pcre_uint8 *)malloc(buffer_size);
1268  pbuffer = (unsigned char *)malloc(buffer_size);  pbuffer = (pcre_uint8 *)malloc(buffer_size);
1269    
1270  /* The outfile variable is static so that new_malloc can use it. */  /* The outfile variable is static so that new_malloc can use it. */
1271    
# Line 1273  while (argc > 1 && argv[op][0] == '-') Line 1287  while (argc > 1 && argv[op][0] == '-')
1287    unsigned char *endptr;    unsigned char *endptr;
1288    
1289    if (strcmp(argv[op], "-m") == 0) showstore = 1;    if (strcmp(argv[op], "-m") == 0) showstore = 1;
1290    else if (strcmp(argv[op], "-s") == 0) force_study = 1;    else if (strcmp(argv[op], "-s") == 0) force_study = 0;
1291      else if (strcmp(argv[op], "-s+") == 0)
1292        {
1293        force_study = 1;
1294        force_study_options = PCRE_STUDY_JIT_COMPILE;
1295        }
1296    else if (strcmp(argv[op], "-q") == 0) quiet = 1;    else if (strcmp(argv[op], "-q") == 0) quiet = 1;
1297    else if (strcmp(argv[op], "-b") == 0) debug = 1;    else if (strcmp(argv[op], "-b") == 0) debug = 1;
1298    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
# Line 1338  while (argc > 1 && argv[op][0] == '-') Line 1357  while (argc > 1 && argv[op][0] == '-')
1357      printf("  %sUTF-8 support\n", rc? "" : "No ");      printf("  %sUTF-8 support\n", rc? "" : "No ");
1358      (void)pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);      (void)pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);
1359      printf("  %sUnicode properties support\n", rc? "" : "No ");      printf("  %sUnicode properties support\n", rc? "" : "No ");
1360        (void)pcre_config(PCRE_CONFIG_JIT, &rc);
1361        if (rc)
1362          printf("  Just-in-time compiler support\n");
1363        else
1364          printf("  No just-in-time compiler support\n");
1365      (void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);      (void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);
1366      /* Note that these values are always the ASCII values, even      /* Note that these values are always the ASCII values, even
1367      in EBCDIC environments. CR is 13 and NL is 10. */      in EBCDIC environments. CR is 13 and NL is 10. */
# Line 1472  while (!done) Line 1496  while (!done)
1496    if (*p == '<' && strchr((char *)(p+1), '<') == NULL)    if (*p == '<' && strchr((char *)(p+1), '<') == NULL)
1497      {      {
1498      unsigned long int magic, get_options;      unsigned long int magic, get_options;
1499      uschar sbuf[8];      pcre_uint8 sbuf[8];
1500      FILE *f;      FILE *f;
1501    
1502      p++;      p++;
# Line 1538  while (!done) Line 1562  while (!done)
1562          {          {
1563          FAIL_READ:          FAIL_READ:
1564          fprintf(outfile, "Failed to read data from %s\n", p);          fprintf(outfile, "Failed to read data from %s\n", p);
1565          if (extra != NULL) new_free(extra);          if (extra != NULL) pcre_free_study(extra);
1566          if (re != NULL) new_free(re);          if (re != NULL) new_free(re);
1567          fclose(f);          fclose(f);
1568          continue;          continue;
# Line 1604  while (!done) Line 1628  while (!done)
1628    /* Look for options after final delimiter */    /* Look for options after final delimiter */
1629    
1630    options = 0;    options = 0;
   study_options = 0;  
1631    log_store = showstore;  /* default from command line */    log_store = showstore;  /* default from command line */
1632    
1633    while (*pp != 0)    while (*pp != 0)
# Line 1641  while (!done) Line 1664  while (!done)
1664  #endif  #endif
1665    
1666        case 'S':        case 'S':
1667        if (do_study == 0) do_study = 1; else        if (do_study == 0)
1668            {
1669            do_study = 1;
1670            if (*pp == '+')
1671              {
1672              study_options |= PCRE_STUDY_JIT_COMPILE;
1673              pp++;
1674              }
1675            }
1676          else
1677          {          {
1678          do_study = 0;          do_study = 0;
1679          no_force_study = 1;          no_force_study = 1;
# Line 1700  while (!done) Line 1732  while (!done)
1732    
1733        case '<':        case '<':
1734          {          {
1735          if (strncmpic(pp, (uschar *)"JS>", 3) == 0)          if (strncmpic(pp, (pcre_uint8 *)"JS>", 3) == 0)
1736            {            {
1737            options |= PCRE_JAVASCRIPT_COMPAT;            options |= PCRE_JAVASCRIPT_COMPAT;
1738            pp += 3;            pp += 3;
# Line 1836  while (!done) Line 1868  while (!done)
1868      suppresses the effect of /S (used for a few test patterns where studying is      suppresses the effect of /S (used for a few test patterns where studying is
1869      never sensible). */      never sensible). */
1870    
1871      if (do_study || (force_study && !no_force_study))      if (do_study || (force_study >= 0 && !no_force_study))
1872        {        {
1873        if (timeit > 0)        if (timeit > 0)
1874          {          {
# Line 1844  while (!done) Line 1876  while (!done)
1876          clock_t time_taken;          clock_t time_taken;
1877          clock_t start_time = clock();          clock_t start_time = clock();
1878          for (i = 0; i < timeit; i++)          for (i = 0; i < timeit; i++)
1879            extra = pcre_study(re, study_options, &error);            extra = pcre_study(re, study_options | force_study_options, &error);
1880          time_taken = clock() - start_time;          time_taken = clock() - start_time;
1881          if (extra != NULL) free(extra);          if (extra != NULL) pcre_free_study(extra);
1882          fprintf(outfile, "  Study time %.4f milliseconds\n",          fprintf(outfile, "  Study time %.4f milliseconds\n",
1883            (((double)time_taken * 1000.0) / (double)timeit) /            (((double)time_taken * 1000.0) / (double)timeit) /
1884              (double)CLOCKS_PER_SEC);              (double)CLOCKS_PER_SEC);
1885          }          }
1886        extra = pcre_study(re, study_options, &error);        extra = pcre_study(re, study_options | force_study_options, &error);
1887        if (error != NULL)        if (error != NULL)
1888          fprintf(outfile, "Failed to study: %s\n", error);          fprintf(outfile, "Failed to study: %s\n", error);
1889        else if (extra != NULL)        else if (extra != NULL)
# Line 1929  while (!done) Line 1961  while (!done)
1961        int count, backrefmax, first_char, need_char, okpartial, jchanged,        int count, backrefmax, first_char, need_char, okpartial, jchanged,
1962          hascrorlf;          hascrorlf;
1963        int nameentrysize, namecount;        int nameentrysize, namecount;
1964        const uschar *nametable;        const pcre_uchar *nametable;
1965    
1966        new_info(re, NULL, PCRE_INFO_SIZE, &size);        new_info(re, NULL, PCRE_INFO_SIZE, &size);
1967        new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);        new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
# Line 2079  while (!done) Line 2111  while (!done)
2111        when auto-callouts are involved, the output from runs with and without        when auto-callouts are involved, the output from runs with and without
2112        -s should be identical. */        -s should be identical. */
2113    
2114        if (do_study || (force_study && showinfo && !no_force_study))        if (do_study || (force_study >= 0 && showinfo && !no_force_study))
2115          {          {
2116          if (extra == NULL)          if (extra == NULL)
2117            fprintf(outfile, "Study returned NULL\n");            fprintf(outfile, "Study returned NULL\n");
2118          else          else
2119            {            {
2120            uschar *start_bits = NULL;            pcre_uint8 *start_bits = NULL;
2121            int minlength;            int minlength;
2122    
2123            new_info(re, extra, PCRE_INFO_MINLENGTH, &minlength);            new_info(re, extra, PCRE_INFO_MINLENGTH, &minlength);
# Line 2123  while (!done) Line 2155  while (!done)
2155              fprintf(outfile, "\n");              fprintf(outfile, "\n");
2156              }              }
2157            }            }
2158    
2159            /* Show this only if the JIT was set by /S, not by -s. */
2160    
2161            if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)
2162              {
2163              int jit;
2164              new_info(re, extra, PCRE_INFO_JIT, &jit);
2165              if (jit)
2166                fprintf(outfile, "JIT study was successful\n");
2167              else
2168    #ifdef SUPPORT_JIT
2169                fprintf(outfile, "JIT study was not successful\n");
2170    #else
2171                fprintf(outfile, "JIT support is not available in this version of PCRE\n");
2172    #endif
2173              }
2174          }          }
2175        }        }
2176    
# Line 2139  while (!done) Line 2187  while (!done)
2187          }          }
2188        else        else
2189          {          {
2190          uschar sbuf[8];          pcre_uint8 sbuf[8];
2191          sbuf[0] = (uschar)((true_size >> 24) & 255);          sbuf[0] = (pcre_uint8)((true_size >> 24) & 255);
2192          sbuf[1] = (uschar)((true_size >> 16) & 255);          sbuf[1] = (pcre_uint8)((true_size >> 16) & 255);
2193          sbuf[2] = (uschar)((true_size >>  8) & 255);          sbuf[2] = (pcre_uint8)((true_size >>  8) & 255);
2194          sbuf[3] = (uschar)((true_size) & 255);          sbuf[3] = (pcre_uint8)((true_size) & 255);
2195    
2196          sbuf[4] = (uschar)((true_study_size >> 24) & 255);          sbuf[4] = (pcre_uint8)((true_study_size >> 24) & 255);
2197          sbuf[5] = (uschar)((true_study_size >> 16) & 255);          sbuf[5] = (pcre_uint8)((true_study_size >> 16) & 255);
2198          sbuf[6] = (uschar)((true_study_size >>  8) & 255);          sbuf[6] = (pcre_uint8)((true_study_size >>  8) & 255);
2199          sbuf[7] = (uschar)((true_study_size) & 255);          sbuf[7] = (pcre_uint8)((true_study_size) & 255);
2200    
2201          if (fwrite(sbuf, 1, 8, f) < 8 ||          if (fwrite(sbuf, 1, 8, f) < 8 ||
2202              fwrite(re, 1, true_size, f) < true_size)              fwrite(re, 1, true_size, f) < true_size)
# Line 2176  while (!done) Line 2224  while (!done)
2224          }          }
2225    
2226        new_free(re);        new_free(re);
2227        if (extra != NULL) new_free(extra);        if (extra != NULL) pcre_free_study(extra);
2228        if (locale_set)        if (locale_set)
2229          {          {
2230          new_free((void *)tables);          new_free((void *)tables);
# Line 2191  while (!done) Line 2239  while (!done)
2239    
2240    for (;;)    for (;;)
2241      {      {
2242      uschar *q;      pcre_uint8 *q;
2243      uschar *bptr;      pcre_uint8 *bptr;
2244      int *use_offsets = offsets;      int *use_offsets = offsets;
2245      int use_size_offsets = size_offsets;      int use_size_offsets = size_offsets;
2246      int callout_data = 0;      int callout_data = 0;
# Line 2297  while (!done) Line 2345  while (!done)
2345            {            {
2346            unsigned char *pt = p;            unsigned char *pt = p;
2347            c = 0;            c = 0;
2348            while (isxdigit(*(++pt)))  
2349              c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W');            /* We used to have "while (isxdigit(*(++pt)))" here, but it fails
2350              when isxdigit() is a macro that refers to its argument more than
2351              once. This is banned by the C Standard, but apparently happens in at
2352              least one MacOS environment. */
2353    
2354              for (pt++; isxdigit(*pt); pt++)
2355                c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);
2356            if (*pt == '}')            if (*pt == '}')
2357              {              {
2358              unsigned char buff8[8];              unsigned char buff8[8];
# Line 2328  while (!done) Line 2382  while (!done)
2382          c = 0;          c = 0;
2383          while (i++ < 2 && isxdigit(*p))          while (i++ < 2 && isxdigit(*p))
2384            {            {
2385            c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W');            c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'a' - 10);
2386            p++;            p++;
2387            }            }
2388          break;          break;
# Line 2363  while (!done) Line 2417  while (!done)
2417            }            }
2418          else if (isalnum(*p))          else if (isalnum(*p))
2419            {            {
2420            uschar *npp = copynamesptr;            pcre_uchar *npp = copynamesptr;
2421            while (isalnum(*p)) *npp++ = *p++;            while (isalnum(*p)) *npp++ = *p++;
2422            *npp++ = 0;            *npp++ = 0;
2423            *npp = 0;            *npp = 0;
# Line 2433  while (!done) Line 2487  while (!done)
2487            }            }
2488          else if (isalnum(*p))          else if (isalnum(*p))
2489            {            {
2490            uschar *npp = getnamesptr;            pcre_uchar *npp = getnamesptr;
2491            while (isalnum(*p)) *npp++ = *p++;            while (isalnum(*p)) *npp++ = *p++;
2492            *npp++ = 0;            *npp++ = 0;
2493            *npp = 0;            *npp = 0;
# Line 2444  while (!done) Line 2498  while (!done)
2498            }            }
2499          continue;          continue;
2500    
2501            case 'J':
2502            while(isdigit(*p)) n = n * 10 + *p++ - '0';
2503            if (extra != NULL
2504                && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0
2505                && extra->executable_jit != NULL)
2506              {
2507              if (jit_stack != NULL) pcre_jit_stack_free(jit_stack);
2508              jit_stack = pcre_jit_stack_alloc(1, n * 1024);
2509              pcre_assign_jit_stack(extra, jit_callback, jit_stack);
2510              }
2511            continue;
2512    
2513          case 'L':          case 'L':
2514          getlist = 1;          getlist = 1;
2515          continue;          continue;
# Line 2654  while (!done) Line 2720  while (!done)
2720    
2721        /* If find_match_limit is set, we want to do repeated matches with        /* If find_match_limit is set, we want to do repeated matches with
2722        varying limits in order to find the minimum value for the match limit and        varying limits in order to find the minimum value for the match limit and
2723        for the recursion limit. */        for the recursion limit. The match limits are relevant only to the normal
2724          running of pcre_exec(), so disable the JIT optimization. This makes it
2725          possible to run the same set of tests with and without JIT externally
2726          requested. */
2727    
2728        if (find_match_limit)        if (find_match_limit)
2729          {          {
# Line 2663  while (!done) Line 2732  while (!done)
2732            extra = (pcre_extra *)malloc(sizeof(pcre_extra));            extra = (pcre_extra *)malloc(sizeof(pcre_extra));
2733            extra->flags = 0;            extra->flags = 0;
2734            }            }
2735            else extra->flags &= ~PCRE_EXTRA_EXECUTABLE_JIT;
2736    
2737          (void)check_match_limit(re, extra, bptr, len, start_offset,          (void)check_match_limit(re, extra, bptr, len, start_offset,
2738            options|g_notempty, use_offsets, use_size_offsets,            options|g_notempty, use_offsets, use_size_offsets,
# Line 2861  while (!done) Line 2931  while (!done)
2931                fprintf(outfile, "%2dL %s\n", i, stringlist[i]);                fprintf(outfile, "%2dL %s\n", i, stringlist[i]);
2932              if (stringlist[i] != NULL)              if (stringlist[i] != NULL)
2933                fprintf(outfile, "string list not terminated by NULL\n");                fprintf(outfile, "string list not terminated by NULL\n");
             /* free((void *)stringlist); */  
2934              pcre_free_substring_list(stringlist);              pcre_free_substring_list(stringlist);
2935              }              }
2936            }            }
# Line 3012  while (!done) Line 3081  while (!done)
3081  #endif  #endif
3082    
3083    if (re != NULL) new_free(re);    if (re != NULL) new_free(re);
3084    if (extra != NULL) new_free(extra);    if (extra != NULL) pcre_free_study(extra);
3085    if (locale_set)    if (locale_set)
3086      {      {
3087      new_free((void *)tables);      new_free((void *)tables);
3088      setlocale(LC_CTYPE, "C");      setlocale(LC_CTYPE, "C");
3089      locale_set = 0;      locale_set = 0;
3090      }      }
3091      if (jit_stack != NULL)
3092        {
3093        pcre_jit_stack_free(jit_stack);
3094        jit_stack = NULL;
3095        }
3096    }    }
3097    
3098  if (infile == stdin) fprintf(outfile, "\n");  if (infile == stdin) fprintf(outfile, "\n");

Legend:
Removed from v.658  
changed lines
  Added in v.756

  ViewVC Help
Powered by ViewVC 1.1.5