/[pcre]/code/tags/pcre-7.8/pcretest.c
ViewVC logotype

Diff of /code/tags/pcre-7.8/pcretest.c

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

revision 67 by nigel, Sat Feb 24 21:40:13 2007 UTC revision 69 by nigel, Sat Feb 24 21:40:18 2007 UTC
# Line 37  Makefile. */ Line 37  Makefile. */
37    
38  #define LOOPREPEAT 50000  #define LOOPREPEAT 50000
39    
40    #define BUFFER_SIZE 30000
41    #define DBUFFER_SIZE 1024
42    
43    
44  static FILE *outfile;  static FILE *outfile;
45  static int log_store = 0;  static int log_store = 0;
# Line 50  static size_t gotten_store; Line 53  static size_t gotten_store;
53    
54    
55    
56  static int utf8_table1[] = {  static const int utf8_table1[] = {
57    0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff};    0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff};
58    
59  static int utf8_table2[] = {  static const int utf8_table2[] = {
60    0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};    0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
61    
62  static int utf8_table3[] = {  static const int utf8_table3[] = {
63    0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};    0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
64    
65    
# Line 387  int posix = 0; Line 390  int posix = 0;
390  #endif  #endif
391  int debug = 0;  int debug = 0;
392  int done = 0;  int done = 0;
393  unsigned char buffer[30000];  
394  unsigned char dbuffer[1024];  unsigned char *buffer;
395    unsigned char *dbuffer;
396    
397    /* Get buffers from malloc() so that Electric Fence will check their misuse
398    when I am debugging. */
399    
400    buffer = malloc(BUFFER_SIZE);
401    dbuffer = malloc(DBUFFER_SIZE);
402    
403  /* Static so that new_malloc can use it. */  /* Static so that new_malloc can use it. */
404    
# Line 518  while (!done) Line 528  while (!done)
528    use_utf8 = 0;    use_utf8 = 0;
529    
530    if (infile == stdin) printf("  re> ");    if (infile == stdin) printf("  re> ");
531    if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break;    if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL) break;
532    if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);    if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
533    fflush(outfile);    fflush(outfile);
534    
# Line 549  while (!done) Line 559  while (!done)
559        }        }
560      if (*pp != 0) break;      if (*pp != 0) break;
561    
562      len = sizeof(buffer) - (pp - buffer);      len = BUFFER_SIZE - (pp - buffer);
563      if (len < 256)      if (len < 256)
564        {        {
565        fprintf(outfile, "** Expression too long - missing delimiter?\n");        fprintf(outfile, "** Expression too long - missing delimiter?\n");
# Line 648  while (!done) Line 658  while (!done)
658    
659      if (rc != 0)      if (rc != 0)
660        {        {
661        (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));        (void)regerror(rc, &preg, (char *)buffer, BUFFER_SIZE);
662        fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);        fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);
663        goto SKIP_DATA;        goto SKIP_DATA;
664        }        }
# Line 689  while (!done) Line 699  while (!done)
699          {          {
700          for (;;)          for (;;)
701            {            {
702            if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)            if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL)
703              {              {
704              done = 1;              done = 1;
705              goto CONTINUE;              goto CONTINUE;
# Line 921  while (!done) Line 931  while (!done)
931      callout_fail_id = -1;      callout_fail_id = -1;
932    
933      if (infile == stdin) printf("data> ");      if (infile == stdin) printf("data> ");
934      if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)      if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL)
935        {        {
936        done = 1;        done = 1;
937        goto CONTINUE;        goto CONTINUE;
# Line 1134  while (!done) Line 1144  while (!done)
1144    
1145        if (rc != 0)        if (rc != 0)
1146          {          {
1147          (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));          (void)regerror(rc, &preg, (char *)buffer, BUFFER_SIZE);
1148          fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);          fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);
1149          }          }
1150        else        else

Legend:
Removed from v.67  
changed lines
  Added in v.69

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12