Re: [pcre-dev] Problem with "any" newline

トップ ページ
このメッセージを削除
著者: Philip Hazel
日付:  
To: pcre-dev
新しいトピック: [pcre-dev] Newline feature request, Re: [pcre-dev] Problem with "any" newline (and other 7.1 issues)
題目: Re: [pcre-dev] Problem with "any" newline
> I will myself do a build with "any" to see if I can reproduce this
> behaviour.


OK, it's yet another buglet in pcretest's handling of /g with "any". It
wasn't noticing the default. Here is the patch against -RC4:

<snip>
*** pcretest.c.rc4    Thu Apr  5 10:06:44 2007
--- pcretest.c    Thu Apr  5 10:15:47 2007
***************
*** 2232,2240 ****
          if (g_notempty != 0)
            {
            int onechar = 1;
            use_offsets[0] = start_offset;
!           if ((((real_pcre *)re)->options & PCRE_NEWLINE_BITS) ==
!                   PCRE_NEWLINE_ANY &&
                start_offset < len - 1 &&
                bptr[start_offset] == '\r' &&
                bptr[start_offset+1] == '\n')
--- 2232,2249 ----
          if (g_notempty != 0)
            {
            int onechar = 1;
+           unsigned int obits = ((real_pcre *)re)->options;
            use_offsets[0] = start_offset;
!           if ((obits & PCRE_NEWLINE_BITS) == 0)
!             {
!             int d;
!             (void)pcre_config(PCRE_CONFIG_NEWLINE, &d);
!             obits = (d == '\r')? PCRE_NEWLINE_CR :
!                     (d == '\n')? PCRE_NEWLINE_LF :
!                     (d == ('\r'<<8 | '\n'))? PCRE_NEWLINE_CRLF :
!                     (d == -1)? PCRE_NEWLINE_ANY : 0;
!             }
!           if ((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY &&
                start_offset < len - 1 &&
                bptr[start_offset] == '\r' &&
                bptr[start_offset+1] == '\n')
<snap>


Philip

--
Philip Hazel, University of Cambridge Computing Service.