/[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

revision 808 by ph10, Sun Dec 18 11:11:48 2011 UTC revision 809 by zherczeg, Mon Dec 19 11:04:45 2011 UTC
# Line 197  use these in the definitions of generic Line 197  use these in the definitions of generic
197    
198  #define PCRE_STUDY8(extra, re, options, error) \  #define PCRE_STUDY8(extra, re, options, error) \
199    extra = pcre_study(re, options, error)    extra = pcre_study(re, options, error)
200  #endif  
201    #define PCRE_FREE_STUDY8(extra) \
202      pcre_free_study(extra)
203    
204    #endif /* SUPPORT_PCRE8 */
205    
206    
207  #ifdef SUPPORT_PCRE16  #ifdef SUPPORT_PCRE16
# Line 217  use these in the definitions of generic Line 221  use these in the definitions of generic
221    
222  #define PCRE_STUDY16(extra, re, options, error) \  #define PCRE_STUDY16(extra, re, options, error) \
223    extra = pcre16_study(re, options, error)    extra = pcre16_study(re, options, error)
224  #endif  
225    #define PCRE_FREE_STUDY16(extra) \
226      pcre16_free_study(extra)
227    
228    #endif /* SUPPORT_PCRE16 */
229    
230    
231  /* ----- Both modes are supported; a runtime test is needed ----- */  /* ----- Both modes are supported; a runtime test is needed ----- */
# Line 257  use these in the definitions of generic Line 265  use these in the definitions of generic
265    else \    else \
266      PCRE_STUDY8(extra, re, options, error)      PCRE_STUDY8(extra, re, options, error)
267    
268    #define PCRE_FREE_STUDY(extra) \
269      if (use_pcre16) \
270        PCRE_FREE_STUDY16(extra); \
271      else \
272        PCRE_FREE_STUDY8(extra)
273    
274  /* ----- Only 8-bit mode is supported ----- */  /* ----- Only 8-bit mode is supported ----- */
275    
276  #elif defined SUPPORT_PCRE8  #elif defined SUPPORT_PCRE8
277  #define PCHARS       PCHARS8  #define PCHARS           PCHARS8
278  #define PCHARSV      PCHARSV8  #define PCHARSV          PCHARSV8
279  #define PCRE_COMPILE PCRE_COMPILE8  #define PCRE_COMPILE     PCRE_COMPILE8
280  #define PCRE_EXEC    PCRE_EXEC8  #define PCRE_EXEC        PCRE_EXEC8
281  #define PCRE_STUDY   PCRE_STUDY8  #define PCRE_STUDY       PCRE_STUDY8
282    #define PCRE_FREE_STUDY  PCRE_FREE_STUDY8
283    
284  /* ----- Only 16-bit mode is supported ----- */  /* ----- Only 16-bit mode is supported ----- */
285    
286  #else  #else
287  #define PCHARS       PCHARS16  #define PCHARS           PCHARS16
288  #define PCHARSV      PCHARSV16  #define PCHARSV          PCHARSV16
289  #define PCRE_COMPILE PCRE_COMPILE16  #define PCRE_COMPILE     PCRE_COMPILE16
290  #define PCRE_EXEC    PCRE_EXEC16  #define PCRE_EXEC        PCRE_EXEC16
291  #define PCRE_STUDY   PCRE_STUDY16  #define PCRE_STUDY       PCRE_STUDY16
292    #define PCRE_FREE_STUDY  PCRE_FREE_STUDY16
293  #endif  #endif
294    
295  /* ----- End of mode-specific function call macros ----- */  /* ----- End of mode-specific function call macros ----- */
# Line 1861  while (!done) Line 1877  while (!done)
1877          {          {
1878          FAIL_READ:          FAIL_READ:
1879          fprintf(outfile, "Failed to read data from %s\n", p);          fprintf(outfile, "Failed to read data from %s\n", p);
1880          if (extra != NULL) pcre_free_study(extra);          if (extra != NULL)
1881              {
1882              PCRE_FREE_STUDY(extra);
1883              }
1884          if (re != NULL) new_free(re);          if (re != NULL) new_free(re);
1885          fclose(f);          fclose(f);
1886          continue;          continue;
# Line 2192  while (!done) Line 2211  while (!done)
2211            PCRE_STUDY(extra, re, study_options | force_study_options, &error);            PCRE_STUDY(extra, re, study_options | force_study_options, &error);
2212            }            }
2213          time_taken = clock() - start_time;          time_taken = clock() - start_time;
2214          if (extra != NULL) pcre_free_study(extra);          if (extra != NULL)
2215              {
2216              PCRE_FREE_STUDY(extra);
2217              }
2218          fprintf(outfile, "  Study time %.4f milliseconds\n",          fprintf(outfile, "  Study time %.4f milliseconds\n",
2219            (((double)time_taken * 1000.0) / (double)timeit) /            (((double)time_taken * 1000.0) / (double)timeit) /
2220              (double)CLOCKS_PER_SEC);              (double)CLOCKS_PER_SEC);
# Line 2270  while (!done) Line 2292  while (!done)
2292      if (do_debug)      if (do_debug)
2293        {        {
2294        fprintf(outfile, "------------------------------------------------------------------\n");        fprintf(outfile, "------------------------------------------------------------------\n");
2295    #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
2296        if (use_pcre16)        if (use_pcre16)
2297          pcre16_printint(re, outfile, debug_lengths);          pcre16_printint(re, outfile, debug_lengths);
2298        else        else
2299          pcre_printint(re, outfile, debug_lengths);          pcre_printint(re, outfile, debug_lengths);
2300    #elif defined SUPPORT_PCRE8
2301          pcre_printint(re, outfile, debug_lengths);
2302    #else
2303          pcre16_printint(re, outfile, debug_lengths);
2304    #endif
2305        }        }
2306    
2307      /* We already have the options in get_options (see above) */      /* We already have the options in get_options (see above) */
# Line 2558  while (!done) Line 2586  while (!done)
2586          }          }
2587    
2588        new_free(re);        new_free(re);
2589        if (extra != NULL) pcre_free_study(extra);        if (extra != NULL)
2590            {
2591            PCRE_FREE_STUDY(extra);
2592            }
2593        if (locale_set)        if (locale_set)
2594          {          {
2595          new_free((void *)tables);          new_free((void *)tables);
# Line 3424  while (!done) Line 3455  while (!done)
3455  #endif  #endif
3456    
3457    if (re != NULL) new_free(re);    if (re != NULL) new_free(re);
3458    if (extra != NULL) pcre_free_study(extra);    if (extra != NULL)
3459        {
3460        PCRE_FREE_STUDY(extra);
3461        }
3462    if (locale_set)    if (locale_set)
3463      {      {
3464      new_free((void *)tables);      new_free((void *)tables);

Legend:
Removed from v.808  
changed lines
  Added in v.809

  ViewVC Help
Powered by ViewVC 1.1.5