/[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 676 by ph10, Sat Aug 27 15:53:04 2011 UTC code/branches/pcre16/pcretest.c revision 805 by ph10, Wed Dec 14 16:49:20 2011 UTC
# Line 107  appropriately for an application, not fo Line 107  appropriately for an application, not fo
107  #include "pcre.h"  #include "pcre.h"
108  #include "pcre_internal.h"  #include "pcre_internal.h"
109    
110    /* The pcre_printint() function, which prints the internal form of a compiled
111    regex, is held in a separate file so that (a) it can be compiled in either
112    8-bit or 16-bit mode, and (b) it can be #included directly in pcre_compile.c
113    when that is compiled in debug mode. */
114    
115    #ifdef SUPPORT_PCRE8
116    void pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths);
117    #endif
118    #ifdef SUPPORT_PCRE16
119    void pcre16_printint(pcre *external_re, FILE *f, BOOL print_lengths);
120    #endif
121    
122  /* We need access to some of the data tables that PCRE uses. So as not to have  /* We need access to some of the data tables that PCRE uses. So as not to have
123  to keep two copies, we include the source file here, changing the names of the  to keep two copies, we include the source file here, changing the names of the
124  external symbols to prevent clashes. */  external symbols to prevent clashes. */
# Line 118  external symbols to prevent clashes. */ Line 130  external symbols to prevent clashes. */
130  #define _pcre_utf8_table2      utf8_table2  #define _pcre_utf8_table2      utf8_table2
131  #define _pcre_utf8_table3      utf8_table3  #define _pcre_utf8_table3      utf8_table3
132  #define _pcre_utf8_table4      utf8_table4  #define _pcre_utf8_table4      utf8_table4
 #define _pcre_utf8_char_sizes  utf8_char_sizes  
133  #define _pcre_utt              utt  #define _pcre_utt              utt
134  #define _pcre_utt_size         utt_size  #define _pcre_utt_size         utt_size
135  #define _pcre_utt_names        utt_names  #define _pcre_utt_names        utt_names
# Line 126  external symbols to prevent clashes. */ Line 137  external symbols to prevent clashes. */
137    
138  #include "pcre_tables.c"  #include "pcre_tables.c"
139    
 /* We also need the pcre_printint() function for printing out compiled  
 patterns. This function is in a separate file so that it can be included in  
 pcre_compile.c when that module is compiled with debugging enabled. It needs to  
 know which case is being compiled. */  
   
 #define COMPILING_PCRETEST  
 #include "pcre_printint.src"  
   
140  /* The definition of the macro PRINTABLE, which determines whether to print an  /* The definition of the macro PRINTABLE, which determines whether to print an
141  output character as-is or as a hex value when showing compiled patterns, is  output character as-is or as a hex value when showing compiled patterns, is
142  contained in the printint.src file. We uses it here also, in cases when the  the same as in the printint.src file. We uses it here in cases when the locale
143  locale has not been explicitly changed, so as to get consistent output from  has not been explicitly changed, so as to get consistent output from systems
144  systems that differ in their output from isprint() even in the "C" locale. */  that differ in their output from isprint() even in the "C" locale. */
145    
146    #ifdef EBCDIC
147    #define PRINTABLE(c) ((c) >= 64 && (c) < 255)
148    #else
149    #define PRINTABLE(c) ((c) >= 32 && (c) < 127)
150    #endif
151    
152  #define PRINTHEX(c) (locale_set? isprint(c) : PRINTABLE(c))  #define PRINTHEX(c) (locale_set? isprint(c) : PRINTABLE(c))
153    
# Line 191  static int locale_set = 0; Line 200  static int locale_set = 0;
200  static int show_malloc;  static int show_malloc;
201  static int use_utf8;  static int use_utf8;
202  static size_t gotten_store;  static size_t gotten_store;
203    static size_t first_gotten_store = 0;
204  static const unsigned char *last_callout_mark = NULL;  static const unsigned char *last_callout_mark = NULL;
205    
206    static int (*fullinfo)(const pcre *, const pcre_extra *, int, void *);
207    
208  /* The buffers grow automatically if very long input lines are encountered. */  /* The buffers grow automatically if very long input lines are encountered. */
209    
210  static int buffer_size = 50000;  static int buffer_size = 50000;
211  static uschar *buffer = NULL;  static pcre_uint8 *buffer = NULL;
212  static uschar *dbuffer = NULL;  static pcre_uint8 *dbuffer = NULL;
213  static uschar *pbuffer = NULL;  static pcre_uint8 *pbuffer = NULL;
214    
215    #ifdef SUPPORT_PCRE16
216    static int buffer16_size = 0;
217    static pcre_uint16 *buffer16 = NULL;
218    #endif
219    
220  /* Textual explanations for runtime error codes */  /* Textual explanations for runtime error codes */
221    
# Line 230  static const char *errtexts[] = { Line 247  static const char *errtexts[] = {
247    "bad offset value",    "bad offset value",
248    NULL,  /* SHORTUTF8 is handled specially */    NULL,  /* SHORTUTF8 is handled specially */
249    "nested recursion at the same subject position",    "nested recursion at the same subject position",
250    "JIT stack limit reached"    "JIT stack limit reached",
251      "pattern compiled in wrong mode (8-bit/16-bit error)"
252  };  };
253    
254    
# Line 592  return (pcre_jit_stack *)arg; Line 610  return (pcre_jit_stack *)arg;
610  }  }
611    
612    
613    #ifdef SUPPORT_PCRE16
614    /*************************************************
615    *         Convert a string to 16-bit             *
616    *************************************************/
617    
618    /* The result is always left in buffer16. */
619    
620    static int
621    to16(unsigned char *p, int utf)
622    {
623    pcre_uint16 *pp;
624    int len = (int)strlen((char *)p) + 1;
625    
626    if (buffer16_size < 2*len)
627      {
628      if (buffer16 != NULL) free(buffer16);
629      buffer16_size = 2*len;
630      buffer16 = (pcre_uint16 *)malloc(buffer16_size);
631      if (buffer16 == NULL)
632        {
633        fprintf(stderr, "pcretest: malloc(%d) failed for buffer16\n", buffer16_size);
634        exit(1);
635        }
636      }
637    
638    pp = buffer16;
639    
640    if (!utf)
641      {
642      while (*p != 0) *pp++ = *p++;
643      *pp++ = 0;
644      }
645    
646    else
647      {
648    fprintf(stderr, "pcretest: no support yet for UTF-16\n");
649    exit(1);
650      }
651    
652    return pp - buffer16;
653    }
654    #endif
655    
656    
657  /*************************************************  /*************************************************
658  *        Read or extend an input line            *  *        Read or extend an input line            *
659  *************************************************/  *************************************************/
# Line 615  Returns:       pointer to the start of n Line 677  Returns:       pointer to the start of n
677                 NULL if no data read and EOF reached                 NULL if no data read and EOF reached
678  */  */
679    
680  static uschar *  static pcre_uint8 *
681  extend_inputline(FILE *f, uschar *start, const char *prompt)  extend_inputline(FILE *f, pcre_uint8 *start, const char *prompt)
682  {  {
683  uschar *here = start;  pcre_uint8 *here = start;
684    
685  for (;;)  for (;;)
686    {    {
# Line 665  for (;;) Line 727  for (;;)
727    else    else
728      {      {
729      int new_buffer_size = 2*buffer_size;      int new_buffer_size = 2*buffer_size;
730      uschar *new_buffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_buffer = (unsigned char *)malloc(new_buffer_size);
731      uschar *new_dbuffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_dbuffer = (unsigned char *)malloc(new_buffer_size);
732      uschar *new_pbuffer = (unsigned char *)malloc(new_buffer_size);      pcre_uint8 *new_pbuffer = (unsigned char *)malloc(new_buffer_size);
733    
734      if (new_buffer == NULL || new_dbuffer == NULL || new_pbuffer == NULL)      if (new_buffer == NULL || new_dbuffer == NULL || new_pbuffer == NULL)
735        {        {
# Line 809  Returns:     number of characters placed Line 871  Returns:     number of characters placed
871  #if !defined NOUTF8  #if !defined NOUTF8
872    
873  static int  static int
874  ord2utf8(int cvalue, uschar *utf8bytes)  ord2utf8(int cvalue, pcre_uint8 *utf8bytes)
875  {  {
876  register int i, j;  register int i, j;
877  for (i = 0; i < utf8_table1_size; i++)  for (i = 0; i < utf8_table1_size; i++)
# Line 999  return (cb->callout_number != callout_fa Line 1061  return (cb->callout_number != callout_fa
1061  *************************************************/  *************************************************/
1062    
1063  /* Alternative malloc function, to test functionality and save the size of a  /* Alternative malloc function, to test functionality and save the size of a
1064  compiled re. The show_malloc variable is set only during matching. */  compiled re, which is the first store request that pcre_compile() makes. The
1065    show_malloc variable is set only during matching. */
1066    
1067  static void *new_malloc(size_t size)  static void *new_malloc(size_t size)
1068  {  {
1069  void *block = malloc(size);  void *block = malloc(size);
1070  gotten_store = size;  gotten_store = size;
1071    if (first_gotten_store == 0) first_gotten_store = size;
1072  if (show_malloc)  if (show_malloc)
1073    fprintf(outfile, "malloc       %3d %p\n", (int)size, block);    fprintf(outfile, "malloc       %3d %p\n", (int)size, block);
1074  return block;  return block;
# Line 1044  free(block); Line 1108  free(block);
1108  static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)  static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)
1109  {  {
1110  int rc;  int rc;
1111  if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0)  if ((rc = (fullinfo)(re, study, option, ptr)) < 0)
1112    fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option);    fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option);
1113  }  }
1114    
1115    
1116    
1117  /*************************************************  /*************************************************
 *      Check for supported JIT architecture      *  
 *************************************************/  
   
 /* If it won't JIT-compile a very simple regex, return FALSE. */  
   
 static int check_jit_arch(void)  
 {  
 const char *error;  
 int erroffset, rc;  
 pcre *re = pcre_compile("abc", 0, &error, &erroffset, NULL);  
 pcre_extra *extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);  
 rc = extra != NULL && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 &&  
   extra->executable_jit != NULL;  
 pcre_free_study(extra);  
 free(re);  
 return rc;  
 }  
   
   
 /*************************************************  
1118  *         Byte flipping function                 *  *         Byte flipping function                 *
1119  *************************************************/  *************************************************/
1120    
# Line 1092  return ((value & 0x000000ff) << 24) | Line 1136  return ((value & 0x000000ff) << 24) |
1136  *************************************************/  *************************************************/
1137    
1138  static int  static int
1139  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,
1140    int start_offset, int options, int *use_offsets, int use_size_offsets,    int start_offset, int options, int *use_offsets, int use_size_offsets,
1141    int flag, unsigned long int *limit, int errnumber, const char *msg)    int flag, unsigned long int *limit, int errnumber, const char *msg)
1142  {  {
# Line 1152  Returns:    < 0, = 0, or > 0, according Line 1196  Returns:    < 0, = 0, or > 0, according
1196  */  */
1197    
1198  static int  static int
1199  strncmpic(uschar *s, uschar *t, int n)  strncmpic(pcre_uint8 *s, pcre_uint8 *t, int n)
1200  {  {
1201  while (n--)  while (n--)
1202    {    {
# Line 1179  Returns:      appropriate PCRE_NEWLINE_x Line 1223  Returns:      appropriate PCRE_NEWLINE_x
1223  */  */
1224    
1225  static int  static int
1226  check_newline(uschar *p, FILE *f)  check_newline(pcre_uint8 *p, FILE *f)
1227  {  {
1228  if (strncmpic(p, (uschar *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;  if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;
1229  if (strncmpic(p, (uschar *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;  if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;
1230  if (strncmpic(p, (uschar *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;  if (strncmpic(p, (pcre_uint8 *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF;
1231  if (strncmpic(p, (uschar *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;  if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;
1232  if (strncmpic(p, (uschar *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;  if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;
1233  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;
1234  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;
1235  fprintf(f, "Unknown newline type at: <%s\n", p);  fprintf(f, "Unknown newline type at: <%s\n", p);
1236  return 0;  return 0;
1237  }  }
# Line 1209  printf("If input is a terminal, readline Line 1253  printf("If input is a terminal, readline
1253  printf("This version of pcretest is not linked with readline().\n");  printf("This version of pcretest is not linked with readline().\n");
1254  #endif  #endif
1255  printf("\nOptions:\n");  printf("\nOptions:\n");
1256    #ifdef SUPPORT_PCRE16
1257    printf("  -16      use 16-bit interface\n");
1258    #endif
1259  printf("  -b       show compiled code (bytecode)\n");  printf("  -b       show compiled code (bytecode)\n");
1260  printf("  -C       show PCRE compile-time options and exit\n");  printf("  -C       show PCRE compile-time options and exit\n");
1261  printf("  -d       debug: show compiled code and information (-b and -i)\n");  printf("  -d       debug: show compiled code and information (-b and -i)\n");
# Line 1266  int posix = 0; Line 1313  int posix = 0;
1313  int debug = 0;  int debug = 0;
1314  int done = 0;  int done = 0;
1315  int all_use_dfa = 0;  int all_use_dfa = 0;
1316    int use_pcre16 = 0;
1317  int yield = 0;  int yield = 0;
1318  int stack_size;  int stack_size;
1319    
1320  pcre_jit_stack *jit_stack = NULL;  pcre_jit_stack *jit_stack = NULL;
1321    
   
1322  /* 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
1323  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. */
1324    
1325  uschar copynames[1024];  pcre_uchar copynames[1024];
1326  uschar getnames[1024];  pcre_uchar getnames[1024];
1327    
1328  uschar *copynamesptr;  pcre_uchar *copynamesptr;
1329  uschar *getnamesptr;  pcre_uchar *getnamesptr;
1330    
1331  /* Get buffers from malloc() so that Electric Fence will check their misuse  /* Get buffers from malloc() so that valgrind will check their misuse when
1332  when I am debugging. They grow automatically when very long lines are read. */  debugging. They grow automatically when very long lines are read. The 16-bit
1333    buffer (buffer16) is obtained only if needed. */
1334  buffer = (unsigned char *)malloc(buffer_size);  
1335  dbuffer = (unsigned char *)malloc(buffer_size);  buffer = (pcre_uint8 *)malloc(buffer_size);
1336  pbuffer = (unsigned char *)malloc(buffer_size);  dbuffer = (pcre_uint8 *)malloc(buffer_size);
1337    pbuffer = (pcre_uint8 *)malloc(buffer_size);
1338    
1339  /* The outfile variable is static so that new_malloc can use it. */  /* The outfile variable is static so that new_malloc can use it. */
1340    
# Line 1307  while (argc > 1 && argv[op][0] == '-') Line 1355  while (argc > 1 && argv[op][0] == '-')
1355    {    {
1356    unsigned char *endptr;    unsigned char *endptr;
1357    
1358    if (strcmp(argv[op], "-m") == 0) showstore = 1;    if (strcmp(argv[op], "-16") == 0) use_pcre16 = 1;
1359      else if (strcmp(argv[op], "-m") == 0) showstore = 1;
1360    else if (strcmp(argv[op], "-s") == 0) force_study = 0;    else if (strcmp(argv[op], "-s") == 0) force_study = 0;
1361    else if (strcmp(argv[op], "-s+") == 0)    else if (strcmp(argv[op], "-s+") == 0)
1362      {      {
1363      force_study = 1;      force_study = 1;
1364      force_study_options = PCRE_STUDY_JIT_COMPILE;      force_study_options = PCRE_STUDY_JIT_COMPILE;
1365      }      }
1366    else if (strcmp(argv[op], "-q") == 0) quiet = 1;    else if (strcmp(argv[op], "-q") == 0) quiet = 1;
1367    else if (strcmp(argv[op], "-b") == 0) debug = 1;    else if (strcmp(argv[op], "-b") == 0) debug = 1;
1368    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
# Line 1374  while (argc > 1 && argv[op][0] == '-') Line 1423  while (argc > 1 && argv[op][0] == '-')
1423      unsigned long int lrc;      unsigned long int lrc;
1424      printf("PCRE version %s\n", pcre_version());      printf("PCRE version %s\n", pcre_version());
1425      printf("Compiled with\n");      printf("Compiled with\n");
1426    
1427    /* At least one of SUPPORT_PCRE8 and SUPPORT_PCRE16 will be set. */
1428    
1429    #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
1430        printf("  8-bit and 16-bit support\n");
1431        (void)pcre_config(PCRE_CONFIG_UTF8, &rc);
1432        printf("  %sUTF-8 support\n", rc? "" : "No ");
1433        (void)pcre16_config(PCRE_CONFIG_UTF16, &rc);
1434        printf("  %sUTF-16 support\n", rc? "" : "No ");
1435    #elif defined SUPPORT_PCRE8
1436        printf("  8-bit support only\n");
1437      (void)pcre_config(PCRE_CONFIG_UTF8, &rc);      (void)pcre_config(PCRE_CONFIG_UTF8, &rc);
1438      printf("  %sUTF-8 support\n", rc? "" : "No ");      printf("  %sUTF-8 support\n", rc? "" : "No ");
1439    #else
1440        printf("  16-bit support only\n");
1441        (void)pcre16_config(PCRE_CONFIG_UTF16, &rc);
1442        printf("  %sUTF-16 support\n", rc? "" : "No ");
1443    #endif
1444    
1445      (void)pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);      (void)pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);
1446      printf("  %sUnicode properties support\n", rc? "" : "No ");      printf("  %sUnicode properties support\n", rc? "" : "No ");
1447      (void)pcre_config(PCRE_CONFIG_JIT, &rc);      (void)pcre_config(PCRE_CONFIG_JIT, &rc);
1448      if (rc)      if (rc)
1449        printf("  Just-in-time compiler support%s\n", check_jit_arch()?        printf("  Just-in-time compiler support\n");
         "" : " (but this architecture is unsupported)");  
1450      else      else
1451        printf("  No just-in-time compiler support\n");        printf("  No just-in-time compiler support\n");
1452      (void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);      (void)pcre_config(PCRE_CONFIG_NEWLINE, &rc);
# Line 1423  while (argc > 1 && argv[op][0] == '-') Line 1488  while (argc > 1 && argv[op][0] == '-')
1488    argc--;    argc--;
1489    }    }
1490    
1491    /* Select which fullinfo function to use. */
1492    
1493    fullinfo = use_pcre16? pcre16_fullinfo : pcre_fullinfo;
1494    
1495  /* Get the store for the offsets vector, and remember what it was */  /* Get the store for the offsets vector, and remember what it was */
1496    
1497  size_offsets_max = size_offsets;  size_offsets_max = size_offsets;
# Line 1461  if (argc > 2) Line 1530  if (argc > 2)
1530    
1531  /* Set alternative malloc function */  /* Set alternative malloc function */
1532    
1533    #ifdef SUPPORT_PCRE8
1534  pcre_malloc = new_malloc;  pcre_malloc = new_malloc;
1535  pcre_free = new_free;  pcre_free = new_free;
1536  pcre_stack_malloc = stack_malloc;  pcre_stack_malloc = stack_malloc;
1537  pcre_stack_free = stack_free;  pcre_stack_free = stack_free;
1538    #endif
1539    
1540    #ifdef SUPPORT_PCRE16
1541    pcre16_malloc = new_malloc;
1542    pcre16_free = new_free;
1543    pcre16_stack_malloc = stack_malloc;
1544    pcre16_stack_free = stack_free;
1545    #endif
1546    
1547  /* Heading line unless quiet, then prompt for first regex if stdin */  /* Heading line unless quiet, then prompt for first regex if stdin */
1548    
# Line 1518  while (!done) Line 1596  while (!done)
1596    if (*p == '<' && strchr((char *)(p+1), '<') == NULL)    if (*p == '<' && strchr((char *)(p+1), '<') == NULL)
1597      {      {
1598      unsigned long int magic, get_options;      unsigned long int magic, get_options;
1599      uschar sbuf[8];      pcre_uint8 sbuf[8];
1600      FILE *f;      FILE *f;
1601    
1602      p++;      p++;
# Line 1541  while (!done) Line 1619  while (!done)
1619        (sbuf[4] << 24) | (sbuf[5] << 16) | (sbuf[6] << 8) | sbuf[7];        (sbuf[4] << 24) | (sbuf[5] << 16) | (sbuf[6] << 8) | sbuf[7];
1620    
1621      re = (real_pcre *)new_malloc(true_size);      re = (real_pcre *)new_malloc(true_size);
1622      regex_gotten_store = gotten_store;      regex_gotten_store = first_gotten_store;
1623    
1624      if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;      if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;
1625    
# Line 1650  while (!done) Line 1728  while (!done)
1728    /* Look for options after final delimiter */    /* Look for options after final delimiter */
1729    
1730    options = 0;    options = 0;
1731      study_options = 0;
1732    log_store = showstore;  /* default from command line */    log_store = showstore;  /* default from command line */
1733    
1734    while (*pp != 0)    while (*pp != 0)
# Line 1686  while (!done) Line 1765  while (!done)
1765  #endif  #endif
1766    
1767        case 'S':        case 'S':
1768        if (do_study == 0)        if (do_study == 0)
1769          {          {
1770          do_study = 1;          do_study = 1;
1771          if (*pp == '+')          if (*pp == '+')
1772            {            {
1773            study_options |= PCRE_STUDY_JIT_COMPILE;            study_options |= PCRE_STUDY_JIT_COMPILE;
1774            pp++;            pp++;
1775            }            }
1776          }          }
1777        else        else
1778          {          {
1779          do_study = 0;          do_study = 0;
# Line 1754  while (!done) Line 1833  while (!done)
1833    
1834        case '<':        case '<':
1835          {          {
1836          if (strncmpic(pp, (uschar *)"JS>", 3) == 0)          if (strncmpic(pp, (pcre_uint8 *)"JS>", 3) == 0)
1837            {            {
1838            options |= PCRE_JAVASCRIPT_COMPAT;            options |= PCRE_JAVASCRIPT_COMPAT;
1839            pp += 3;            pp += 3;
# Line 1782  while (!done) Line 1861  while (!done)
1861    
1862    /* Handle compiling via the POSIX interface, which doesn't support the    /* Handle compiling via the POSIX interface, which doesn't support the
1863    timing, showing, or debugging options, nor the ability to pass over    timing, showing, or debugging options, nor the ability to pass over
1864    local character tables. */    local character tables. Neither does it have 16-bit support. */
1865    
1866  #if !defined NOPOSIX  #if !defined NOPOSIX
1867    if (posix || do_posix)    if (posix || do_posix)
# Line 1798  while (!done) Line 1877  while (!done)
1877      if ((options & PCRE_UCP) != 0) cflags |= REG_UCP;      if ((options & PCRE_UCP) != 0) cflags |= REG_UCP;
1878      if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY;      if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY;
1879    
1880        first_gotten_store = 0;
1881      rc = regcomp(&preg, (char *)p, cflags);      rc = regcomp(&preg, (char *)p, cflags);
1882    
1883      /* Compilation failed; go back for another re, skipping to blank line      /* Compilation failed; go back for another re, skipping to blank line
# Line 1818  while (!done) Line 1898  while (!done)
1898    
1899      {      {
1900      unsigned long int get_options;      unsigned long int get_options;
1901    
1902        /* In 16-bit mode, convert the input. The space needed for a non-UTF string
1903        is exactly double the 8-bit size. For a UTF-8 string, the size needed for
1904        UTF-16 is no more than double, because up to 0xffff uses no more than 3
1905        bytes in UTF-8 but possibly 4 in UTF-16. Higher values use 4 bytes in UTF-8
1906        and up to 4 bytes in UTF-16. */
1907    
1908    #ifdef SUPPORT_PCRE16
1909        if (use_pcre16) (void)to16(p, options & PCRE_UTF8);
1910    #endif
1911    
1912        /* Compile many times when timing */
1913    
1914      if (timeit > 0)      if (timeit > 0)
1915        {        {
# Line 1826  while (!done) Line 1918  while (!done)
1918        clock_t start_time = clock();        clock_t start_time = clock();
1919        for (i = 0; i < timeit; i++)        for (i = 0; i < timeit; i++)
1920          {          {
1921          re = pcre_compile((char *)p, options, &error, &erroroffset, tables);  #ifdef SUPPORT_PCRE16
1922            if (use_pcre16)
1923              re = pcre16_compile((PCRE_SPTR16)buffer16, options, &error, &erroroffset, tables);
1924            else
1925    #endif
1926              re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
1927          if (re != NULL) free(re);          if (re != NULL) free(re);
1928          }          }
1929        time_taken = clock() - start_time;        time_taken = clock() - start_time;
# Line 1835  while (!done) Line 1932  while (!done)
1932            (double)CLOCKS_PER_SEC);            (double)CLOCKS_PER_SEC);
1933        }        }
1934    
1935      re = pcre_compile((char *)p, options, &error, &erroroffset, tables);      first_gotten_store = 0;
1936    
1937    #ifdef SUPPORT_PCRE16
1938        if (use_pcre16)
1939          re = pcre16_compile((PCRE_SPTR16)buffer16, options, &error, &erroroffset, tables);
1940        else
1941    #endif
1942          re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
1943    
1944      /* Compilation failed; go back for another re, skipping to blank line      /* Compilation failed; go back for another re, skipping to blank line
1945      if non-interactive. */      if non-interactive. */
# Line 1869  while (!done) Line 1973  while (!done)
1973      new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);      new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
1974      if ((get_options & PCRE_UTF8) != 0) use_utf8 = 1;      if ((get_options & PCRE_UTF8) != 0) use_utf8 = 1;
1975    
1976      /* Print information if required. There are now two info-returning      /* Extract the size for possible writing before possibly flipping it,
1977      functions. The old one has a limited interface and returns only limited      and remember the store that was got. */
1978      data. Check that it agrees with the newer one. */  
1979        true_size = ((real_pcre *)re)->size;
1980        regex_gotten_store = first_gotten_store;
1981    
1982        /* Output code size information if requested */
1983    
1984      if (log_store)      if (log_store)
1985        fprintf(outfile, "Memory allocation (code space): %d\n",        fprintf(outfile, "Memory allocation (code space): %d\n",
1986          (int)(gotten_store -          (int)(first_gotten_store -
1987                sizeof(real_pcre) -                sizeof(real_pcre) -
1988                ((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size));                ((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size));
1989    
     /* Extract the size for possible writing before possibly flipping it,  
     and remember the store that was got. */  
   
     true_size = ((real_pcre *)re)->size;  
     regex_gotten_store = gotten_store;  
   
1990      /* If -s or /S was present, study the regex to generate additional info to      /* If -s or /S was present, study the regex to generate additional info to
1991      help with the matching, unless the pattern has the SS option, which      help with the matching, unless the pattern has the SS option, which
1992      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
# Line 1898  while (!done) Line 2000  while (!done)
2000          clock_t time_taken;          clock_t time_taken;
2001          clock_t start_time = clock();          clock_t start_time = clock();
2002          for (i = 0; i < timeit; i++)          for (i = 0; i < timeit; i++)
2003            extra = pcre_study(re, study_options | force_study_options, &error);            {
2004              if (use_pcre16)
2005                extra = pcre16_study(re, study_options | force_study_options, &error);
2006              else
2007                extra = pcre_study(re, study_options | force_study_options, &error);
2008              }
2009          time_taken = clock() - start_time;          time_taken = clock() - start_time;
2010          if (extra != NULL) pcre_free_study(extra);          if (extra != NULL) pcre_free_study(extra);
2011          fprintf(outfile, "  Study time %.4f milliseconds\n",          fprintf(outfile, "  Study time %.4f milliseconds\n",
2012            (((double)time_taken * 1000.0) / (double)timeit) /            (((double)time_taken * 1000.0) / (double)timeit) /
2013              (double)CLOCKS_PER_SEC);              (double)CLOCKS_PER_SEC);
2014          }          }
2015        extra = pcre_study(re, study_options | force_study_options, &error);        if (use_pcre16)
2016            extra = pcre16_study(re, study_options | force_study_options, &error);
2017          else
2018            extra = pcre_study(re, study_options | force_study_options, &error);
2019        if (error != NULL)        if (error != NULL)
2020          fprintf(outfile, "Failed to study: %s\n", error);          fprintf(outfile, "Failed to study: %s\n", error);
2021        else if (extra != NULL)        else if (extra != NULL)
2022            {
2023          true_study_size = ((pcre_study_data *)(extra->study_data))->size;          true_study_size = ((pcre_study_data *)(extra->study_data))->size;
2024            if (log_store)
2025              {
2026              size_t jitsize;
2027              new_info(re, extra, PCRE_INFO_JITSIZE, &jitsize);
2028              if (jitsize != 0)
2029                fprintf(outfile, "Memory allocation (JIT code): %d\n", jitsize);
2030              }
2031            }
2032        }        }
2033    
2034      /* If /K was present, we set up for handling MARK data. */      /* If /K was present, we set up for handling MARK data. */
# Line 1942  while (!done) Line 2061  while (!done)
2061          (pcre_uint16)byteflip(rre->top_bracket, sizeof(rre->top_bracket));          (pcre_uint16)byteflip(rre->top_bracket, sizeof(rre->top_bracket));
2062        rre->top_backref =        rre->top_backref =
2063          (pcre_uint16)byteflip(rre->top_backref, sizeof(rre->top_backref));          (pcre_uint16)byteflip(rre->top_backref, sizeof(rre->top_backref));
2064        rre->first_byte =        rre->first_char =
2065          (pcre_uint16)byteflip(rre->first_byte, sizeof(rre->first_byte));          (pcre_uint16)byteflip(rre->first_char, sizeof(rre->first_char));
2066        rre->req_byte =        rre->req_char =
2067          (pcre_uint16)byteflip(rre->req_byte, sizeof(rre->req_byte));          (pcre_uint16)byteflip(rre->req_char, sizeof(rre->req_char));
2068        rre->name_table_offset = (pcre_uint16)byteflip(rre->name_table_offset,        rre->name_table_offset = (pcre_uint16)byteflip(rre->name_table_offset,
2069          sizeof(rre->name_table_offset));          sizeof(rre->name_table_offset));
2070        rre->name_entry_size = (pcre_uint16)byteflip(rre->name_entry_size,        rre->name_entry_size = (pcre_uint16)byteflip(rre->name_entry_size,
# Line 1962  while (!done) Line 2081  while (!done)
2081          }          }
2082        }        }
2083    
2084      /* Extract information from the compiled data if required */      /* Extract and display information from the compiled data if required. */
2085    
2086      SHOW_INFO:      SHOW_INFO:
2087    
2088      if (do_debug)      if (do_debug)
2089        {        {
2090        fprintf(outfile, "------------------------------------------------------------------\n");        fprintf(outfile, "------------------------------------------------------------------\n");
2091        pcre_printint(re, outfile, debug_lengths);        if (use_pcre16)
2092            pcre16_printint(re, outfile, debug_lengths);
2093          else
2094            pcre_printint(re, outfile, debug_lengths);
2095        }        }
2096    
2097      /* We already have the options in get_options (see above) */      /* We already have the options in get_options (see above) */
# Line 1983  while (!done) Line 2105  while (!done)
2105        int count, backrefmax, first_char, need_char, okpartial, jchanged,        int count, backrefmax, first_char, need_char, okpartial, jchanged,
2106          hascrorlf;          hascrorlf;
2107        int nameentrysize, namecount;        int nameentrysize, namecount;
2108        const uschar *nametable;        const pcre_uchar *nametable;
2109    
2110        new_info(re, NULL, PCRE_INFO_SIZE, &size);        new_info(re, NULL, PCRE_INFO_SIZE, &size);
2111        new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);        new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
# Line 1997  while (!done) Line 2119  while (!done)
2119        new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged);        new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged);
2120        new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf);        new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf);
2121    
2122          /* The old, obsolete function pcre_info() works only in 8-bit mode. Check
2123          that it gives the same results as the new function. */
2124    
2125  #if !defined NOINFOCHECK  #if !defined NOINFOCHECK
2126        old_count = pcre_info(re, &old_options, &old_first_char);        if (!use_pcre16)
2127        if (count < 0) fprintf(outfile,          {
2128          "Error %d from pcre_info()\n", count);          old_count = pcre_info(re, &old_options, &old_first_char);
2129        else          if (count < 0) fprintf(outfile,
2130          {            "Error %d from pcre_info()\n", count);
2131          if (old_count != count) fprintf(outfile,          else
2132            "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count,            {
2133              old_count);            if (old_count != count) fprintf(outfile,
2134                "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count,
2135          if (old_first_char != first_char) fprintf(outfile,                old_count);
2136            "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n",  
2137              first_char, old_first_char);            if (old_first_char != first_char) fprintf(outfile,
2138                "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n",
2139          if (old_options != (int)get_options) fprintf(outfile,                first_char, old_first_char);
2140            "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n",  
2141              get_options, old_options);            if (old_options != (int)get_options) fprintf(outfile,
2142          }              "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n",
2143                  get_options, old_options);
2144              }
2145            }
2146  #endif  #endif
2147    
2148        if (size != regex_gotten_store) fprintf(outfile,        if (size != regex_gotten_store) fprintf(outfile,
# Line 2101  while (!done) Line 2229  while (!done)
2229          }          }
2230        else        else
2231          {          {
2232          int ch = first_char & 255;          const char *caseless =
2233          const char *caseless = ((first_char & REQ_CASELESS) == 0)?            ((((real_pcre *)re)->flags & PCRE_FCH_CASELESS) == 0)?
2234            "" : " (caseless)";            "" : " (caseless)";
2235          if (PRINTHEX(ch))  
2236            fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless);          if (PRINTHEX(first_char))
2237              fprintf(outfile, "First char = \'%c\'%s\n", first_char, caseless);
2238          else          else
2239            fprintf(outfile, "First char = %d%s\n", ch, caseless);            fprintf(outfile, "First char = %d%s\n", first_char, caseless);
2240          }          }
2241    
2242        if (need_char < 0)        if (need_char < 0)
# Line 2116  while (!done) Line 2245  while (!done)
2245          }          }
2246        else        else
2247          {          {
2248          int ch = need_char & 255;          const char *caseless =
2249          const char *caseless = ((need_char & REQ_CASELESS) == 0)?            ((((real_pcre *)re)->flags & PCRE_RCH_CASELESS) == 0)?
2250            "" : " (caseless)";            "" : " (caseless)";
2251          if (PRINTHEX(ch))  
2252            fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless);          if (PRINTHEX(need_char))
2253              fprintf(outfile, "Need char = \'%c\'%s\n", need_char, caseless);
2254          else          else
2255            fprintf(outfile, "Need char = %d%s\n", ch, caseless);            fprintf(outfile, "Need char = %d%s\n", need_char, caseless);
2256          }          }
2257    
2258        /* Don't output study size; at present it is in any case a fixed        /* Don't output study size; at present it is in any case a fixed
# Line 2139  while (!done) Line 2269  while (!done)
2269            fprintf(outfile, "Study returned NULL\n");            fprintf(outfile, "Study returned NULL\n");
2270          else          else
2271            {            {
2272            uschar *start_bits = NULL;            pcre_uint8 *start_bits = NULL;
2273            int minlength;            int minlength;
2274    
2275            new_info(re, extra, PCRE_INFO_MINLENGTH, &minlength);            new_info(re, extra, PCRE_INFO_MINLENGTH, &minlength);
# Line 2177  while (!done) Line 2307  while (!done)
2307              fprintf(outfile, "\n");              fprintf(outfile, "\n");
2308              }              }
2309            }            }
2310    
2311          /* Show this only if the JIT was set by /S, not by -s. */          /* Show this only if the JIT was set by /S, not by -s. */
2312    
2313          if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)          if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)
2314            {            {
2315            int jit;            int jit;
2316            new_info(re, extra, PCRE_INFO_JIT, &jit);            new_info(re, extra, PCRE_INFO_JIT, &jit);
2317            if (jit)            if (jit)
2318              fprintf(outfile, "JIT study was successful\n");              fprintf(outfile, "JIT study was successful\n");
2319            else            else
2320  #ifdef SUPPORT_JIT  #ifdef SUPPORT_JIT
2321              fprintf(outfile, "JIT study was not successful\n");              fprintf(outfile, "JIT study was not successful\n");
2322  #else  #else
2323              fprintf(outfile, "JIT support is not available in this version of PCRE\n");              fprintf(outfile, "JIT support is not available in this version of PCRE\n");
2324  #endif  #endif
2325            }            }
2326          }          }
2327        }        }
2328    
# Line 2209  while (!done) Line 2339  while (!done)
2339          }          }
2340        else        else
2341          {          {
2342          uschar sbuf[8];          pcre_uint8 sbuf[8];
2343          sbuf[0] = (uschar)((true_size >> 24) & 255);          sbuf[0] = (pcre_uint8)((true_size >> 24) & 255);
2344          sbuf[1] = (uschar)((true_size >> 16) & 255);          sbuf[1] = (pcre_uint8)((true_size >> 16) & 255);
2345          sbuf[2] = (uschar)((true_size >>  8) & 255);          sbuf[2] = (pcre_uint8)((true_size >>  8) & 255);
2346          sbuf[3] = (uschar)((true_size) & 255);          sbuf[3] = (pcre_uint8)((true_size) & 255);
2347    
2348          sbuf[4] = (uschar)((true_study_size >> 24) & 255);          sbuf[4] = (pcre_uint8)((true_study_size >> 24) & 255);
2349          sbuf[5] = (uschar)((true_study_size >> 16) & 255);          sbuf[5] = (pcre_uint8)((true_study_size >> 16) & 255);
2350          sbuf[6] = (uschar)((true_study_size >>  8) & 255);          sbuf[6] = (pcre_uint8)((true_study_size >>  8) & 255);
2351          sbuf[7] = (uschar)((true_study_size) & 255);          sbuf[7] = (pcre_uint8)((true_study_size) & 255);
2352    
2353          if (fwrite(sbuf, 1, 8, f) < 8 ||          if (fwrite(sbuf, 1, 8, f) < 8 ||
2354              fwrite(re, 1, true_size, f) < true_size)              fwrite(re, 1, true_size, f) < true_size)
# Line 2261  while (!done) Line 2391  while (!done)
2391    
2392    for (;;)    for (;;)
2393      {      {
2394      uschar *q;      pcre_uint8 *q;
2395      uschar *bptr;      pcre_uint8 *bptr;
2396      int *use_offsets = offsets;      int *use_offsets = offsets;
2397      int use_size_offsets = size_offsets;      int use_size_offsets = size_offsets;
2398      int callout_data = 0;      int callout_data = 0;
# Line 2367  while (!done) Line 2497  while (!done)
2497            {            {
2498            unsigned char *pt = p;            unsigned char *pt = p;
2499            c = 0;            c = 0;
2500            while (isxdigit(*(++pt)))  
2501              c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W');            /* We used to have "while (isxdigit(*(++pt)))" here, but it fails
2502              when isxdigit() is a macro that refers to its argument more than
2503              once. This is banned by the C Standard, but apparently happens in at
2504              least one MacOS environment. */
2505    
2506              for (pt++; isxdigit(*pt); pt++)
2507                c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);
2508            if (*pt == '}')            if (*pt == '}')
2509              {              {
2510              unsigned char buff8[8];              unsigned char buff8[8];
# Line 2398  while (!done) Line 2534  while (!done)
2534          c = 0;          c = 0;
2535          while (i++ < 2 && isxdigit(*p))          while (i++ < 2 && isxdigit(*p))
2536            {            {
2537            c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W');            c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'a' - 10);
2538            p++;            p++;
2539            }            }
2540          break;          break;
# Line 2433  while (!done) Line 2569  while (!done)
2569            }            }
2570          else if (isalnum(*p))          else if (isalnum(*p))
2571            {            {
2572            uschar *npp = copynamesptr;            pcre_uchar *npp = copynamesptr;
2573            while (isalnum(*p)) *npp++ = *p++;            while (isalnum(*p)) *npp++ = *p++;
2574            *npp++ = 0;            *npp++ = 0;
2575            *npp = 0;            *npp = 0;
# Line 2503  while (!done) Line 2639  while (!done)
2639            }            }
2640          else if (isalnum(*p))          else if (isalnum(*p))
2641            {            {
2642            uschar *npp = getnamesptr;            pcre_uchar *npp = getnamesptr;
2643            while (isalnum(*p)) *npp++ = *p++;            while (isalnum(*p)) *npp++ = *p++;
2644            *npp++ = 0;            *npp++ = 0;
2645            *npp = 0;            *npp = 0;
# Line 2513  while (!done) Line 2649  while (!done)
2649            getnamesptr = npp;            getnamesptr = npp;
2650            }            }
2651          continue;          continue;
2652    
2653          case 'J':          case 'J':
2654          while(isdigit(*p)) n = n * 10 + *p++ - '0';          while(isdigit(*p)) n = n * 10 + *p++ - '0';
2655          if (extra != NULL          if (extra != NULL
2656              && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0              && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0
2657              && extra->executable_jit != NULL)              && extra->executable_jit != NULL)
2658            {            {
2659            if (jit_stack != NULL) pcre_jit_stack_free(jit_stack);            if (jit_stack != NULL) pcre_jit_stack_free(jit_stack);
2660            jit_stack = pcre_jit_stack_alloc(1, n * 1024);            jit_stack = pcre_jit_stack_alloc(1, n * 1024);
2661            pcre_assign_jit_stack(extra, jit_callback, jit_stack);            pcre_assign_jit_stack(extra, jit_callback, jit_stack);
2662            }            }
2663          continue;          continue;
2664    
2665          case 'L':          case 'L':
# Line 2711  while (!done) Line 2847  while (!done)
2847          register int i;          register int i;
2848          clock_t time_taken;          clock_t time_taken;
2849          clock_t start_time = clock();          clock_t start_time = clock();
2850    
2851    #ifdef SUPPORT_PCRE16
2852            if (use_pcre16) len = to16(bptr, options & PCRE_UTF8);
2853    #endif
2854    
2855    
2856  #if !defined NODFA  #if !defined NODFA
2857          if (all_use_dfa || use_dfa)          if (all_use_dfa || use_dfa)
# Line 2749  while (!done) Line 2890  while (!done)
2890            extra->flags = 0;            extra->flags = 0;
2891            }            }
2892          else extra->flags &= ~PCRE_EXTRA_EXECUTABLE_JIT;          else extra->flags &= ~PCRE_EXTRA_EXECUTABLE_JIT;
2893    
2894          (void)check_match_limit(re, extra, bptr, len, start_offset,          (void)check_match_limit(re, extra, bptr, len, start_offset,
2895            options|g_notempty, use_offsets, use_size_offsets,            options|g_notempty, use_offsets, use_size_offsets,
2896            PCRE_EXTRA_MATCH_LIMIT, &(extra->match_limit),            PCRE_EXTRA_MATCH_LIMIT, &(extra->match_limit),
# Line 2797  while (!done) Line 2938  while (!done)
2938    
2939        else        else
2940          {          {
2941          count = pcre_exec(re, extra, (char *)bptr, len,          if (use_pcre16)
2942            start_offset, options | g_notempty, use_offsets, use_size_offsets);            count = pcre16_exec(re, extra, (PCRE_SPTR16)buffer16, len,
2943                start_offset, options | g_notempty, use_offsets, use_size_offsets);
2944            else
2945              count = pcre_exec(re, extra, (char *)bptr, len,
2946                start_offset, options | g_notempty, use_offsets, use_size_offsets);
2947          if (count == 0)          if (count == 0)
2948            {            {
2949            fprintf(outfile, "Matched, but too many substrings\n");            fprintf(outfile, "Matched, but too many substrings\n");
# Line 3104  while (!done) Line 3249  while (!done)
3249      setlocale(LC_CTYPE, "C");      setlocale(LC_CTYPE, "C");
3250      locale_set = 0;      locale_set = 0;
3251      }      }
3252    if (jit_stack != NULL)    if (jit_stack != NULL)
3253      {      {
3254      pcre_jit_stack_free(jit_stack);      pcre_jit_stack_free(jit_stack);
3255      jit_stack = NULL;      jit_stack = NULL;
3256      }      }
3257    }    }
3258    
3259  if (infile == stdin) fprintf(outfile, "\n");  if (infile == stdin) fprintf(outfile, "\n");
# Line 3123  free(dbuffer); Line 3268  free(dbuffer);
3268  free(pbuffer);  free(pbuffer);
3269  free(offsets);  free(offsets);
3270    
3271    #ifdef SUPPORT_PCRE16
3272    if (buffer16 != NULL) free(buffer16);
3273    #endif
3274    
3275  return yield;  return yield;
3276  }  }
3277    

Legend:
Removed from v.676  
changed lines
  Added in v.805

  ViewVC Help
Powered by ViewVC 1.1.5