[pcre-dev] [Bug 2323] New: Allow for new subject string to b…

Kezdőlap
Üzenet törlése
Szerző: admin
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] [Bug 2323] New: Allow for new subject string to be assigned to pcre2_match_data structure
https://bugs.exim.org/show_bug.cgi?id=2323

            Bug ID: 2323
           Summary: Allow for new subject string to be assigned to
                    pcre2_match_data structure
           Product: PCRE
           Version: 10.32 (PCRE2)
          Hardware: x86
                OS: All
            Status: NEW
          Severity: wishlist
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: a.cudbardb@???
                CC: pcre-dev@???


One annoying quirk of the new pcre2 API is that the address of the subject
string is copied to the pcre2_match_data struct by pcre2_match and friends.

Where the lifetime of the subject string isn't guaranteed to be the same as the
pcre2_match_data struct, the subject must be strdup'd first, and the duplicate
passed into pcre2_match. The lifetime of the duplicated subject and
pcre2_match_data struct can then be bound together.

In our use case, we know whether we're going to use the match data (and can
avoid duplicating the string if we're not), but we don't know if the subject
will match.

In the case where the subject doesn't match, we've just strdup'd the subject
for no good reason.

It would be helpful if libpcre2 could provide a method of modifying that
subject string pointer in the opaque pcre2_match_data struct, or a method of
internally strduping the subject string in the pcre2_match_data_struct.

--
You are receiving this mail because:
You are on the CC list for the bug.