bryancall opened a new pull request, #12612:
URL: https://github.com/apache/trafficserver/pull/12612

   Implements deep copy using pcre2_code_copy() to enable safe copying of Regex 
objects and storage in STL containers.
   
   ## Changes
   
   - Added copy constructor and assignment operator
   - Uses pcre2_code_copy() for independent copies
   - Preserves all pattern properties (flags, JIT, etc.)
   - Copy assignment uses copy-and-swap idiom to avoid code duplication
   - Safe self-assignment handling
   - Added comprehensive unit tests (77 assertions)
   
   ## Benefits
   
   - Enables natural C++ value semantics for Regex objects
   - Allows storage in STL containers like std::vector
   - Each copy is fully independent (no shared state)
   - Exception-safe copy assignment
   
   ## Testing
   
   All existing tests pass, plus 3 new test cases:
   - Copy constructor (8 sections, 30+ assertions)
   - Copy assignment (6 sections, 30+ assertions)  
   - Copy with flags (1 section, 6+ assertions)
   
   Total: 212 assertions passing
   
   ## Motivation
   
   This solves memory management issues in plugins that need to share compiled 
regex patterns. For example, PR #12594 (maxmind_acl) currently has unsafe 
pointer sharing that can be replaced with safe value copying using this feature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to