/[pcre2]/code/trunk/src/pcre2test.c
ViewVC logotype

Diff of /code/trunk/src/pcre2test.c

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

revision 692 by ph10, Tue Mar 21 16:18:54 2017 UTC revision 697 by ph10, Tue Mar 21 18:36:13 2017 UTC
# Line 1017  are supported. */ Line 1017  are supported. */
1017    if (test_mode == PCRE8_MODE) \    if (test_mode == PCRE8_MODE) \
1018      r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size)); \      r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size)); \
1019    else if (test_mode == PCRE16_MODE) \    else if (test_mode == PCRE16_MODE) \
1020      r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size)); \      r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2)); \
1021    else \    else \
1022      r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))      r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
1023    
1024  #define PCRE2_GET_OVECTOR_COUNT(a,b) \  #define PCRE2_GET_OVECTOR_COUNT(a,b) \
1025    if (test_mode == PCRE8_MODE) \    if (test_mode == PCRE8_MODE) \
# Line 1399  the three different cases. */ Line 1399  the three different cases. */
1399    
1400  /* ----- Common macros for two-mode cases ----- */  /* ----- Common macros for two-mode cases ----- */
1401    
1402    #define BYTEONE (BITONE/8)
1403    #define BYTETWO (BITTWO/8)
1404    
1405  #define CASTFLD(t,a,b) \  #define CASTFLD(t,a,b) \
1406    ((test_mode == G(G(PCRE,BITONE),_MODE))? (t)(G(a,BITONE)->b) : \    ((test_mode == G(G(PCRE,BITONE),_MODE))? (t)(G(a,BITONE)->b) : \
1407      (t)(G(a,BITTWO)->b))      (t)(G(a,BITTWO)->b))
# Line 1481  the three different cases. */ Line 1484  the three different cases. */
1484    
1485  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
1486    if (test_mode == G(G(PCRE,BITONE),_MODE)) \    if (test_mode == G(G(PCRE,BITONE),_MODE)) \
1487      r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size)); \      r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size/BYTEONE)); \
1488    else \    else \
1489      r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size))      r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size/BYTETWO))
1490    
1491  #define PCRE2_GET_OVECTOR_COUNT(a,b) \  #define PCRE2_GET_OVECTOR_COUNT(a,b) \
1492    if (test_mode == G(G(PCRE,BITONE),_MODE)) \    if (test_mode == G(G(PCRE,BITONE),_MODE)) \
# Line 1904  the three different cases. */ Line 1907  the three different cases. */
1907  #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \  #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
1908    a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),h,i,j)    a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),h,i,j)
1909  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
1910    r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))    r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2))
1911  #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_16(G(b,16))  #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_16(G(b,16))
1912  #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_16(G(b,16))  #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_16(G(b,16))
1913  #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_16(G(a,16),b)  #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_16(G(a,16),b)
# Line 2000  the three different cases. */ Line 2003  the three different cases. */
2003  #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \  #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
2004    a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),h,i,j)    a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),h,i,j)
2005  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \  #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
2006    r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))    r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
2007  #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_32(G(b,32))  #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_32(G(b,32))
2008  #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_32(G(b,32))  #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_32(G(b,32))
2009  #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_32(G(a,32),b)  #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_32(G(a,32),b)
# Line 2889  if (pbuffer32_size < 4*len + 4) Line 2892  if (pbuffer32_size < 4*len + 4)
2892    {    {
2893    if (pbuffer32 != NULL) free(pbuffer32);    if (pbuffer32 != NULL) free(pbuffer32);
2894    pbuffer32_size = 4*len + 4;    pbuffer32_size = 4*len + 4;
2895    if (pbuffer32_size < 256) pbuffer32_size = 256;    if (pbuffer32_size < 512) pbuffer32_size = 512;
2896    pbuffer32 = (uint32_t *)malloc(pbuffer32_size);    pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
2897    if (pbuffer32 == NULL)    if (pbuffer32 == NULL)
2898      {      {
# Line 7600  if (arg_error != NULL) Line 7603  if (arg_error != NULL)
7603    int errcode;    int errcode;
7604    char *endptr;    char *endptr;
7605    
7606  /* Ensure the relevant non-8-bit buffer is available. */  /* Ensure the relevant non-8-bit buffer is available. Ensure that it is at
7607    least 128 code units, because it is used for retrieving error messages. */
7608    
7609  #ifdef SUPPORT_PCRE2_16  #ifdef SUPPORT_PCRE2_16
7610    if (test_mode == PCRE16_MODE)    if (test_mode == PCRE16_MODE)
# Line 7620  if (arg_error != NULL) Line 7624  if (arg_error != NULL)
7624  #ifdef SUPPORT_PCRE2_32  #ifdef SUPPORT_PCRE2_32
7625    if (test_mode == PCRE32_MODE)    if (test_mode == PCRE32_MODE)
7626      {      {
7627      pbuffer32_size = 256;      pbuffer32_size = 512;
7628      pbuffer32 = (uint32_t *)malloc(pbuffer32_size);      pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
7629      if (pbuffer32 == NULL)      if (pbuffer32 == NULL)
7630        {        {

Legend:
Removed from v.692  
changed lines
  Added in v.697

  ViewVC Help
Powered by ViewVC 1.1.5