Skip to content

feat: enhance regex handling and memory management; - #6

Merged
trethore merged 1 commit into
mainfrom
work/fix-optimize
Dec 8, 2025
Merged

feat: enhance regex handling and memory management;#6
trethore merged 1 commit into
mainfrom
work/fix-optimize

Conversation

@trethore

@trethore trethore commented Dec 8, 2025

Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to memory management for regular expressions and match data, and refactors clipboard functionality for Linux systems. The most important changes are grouped below.

Regex and Match Data Resource Management

  • Added explicit allocation and cleanup for pcre2_match_data objects in both global and scoped strip rules, ensuring proper memory management and preventing leaks. This includes new fields in scoped_strip_rule and recap_context structs, updated allocation logic in add_scoped_strip_rule, and corresponding cleanup handlers in main.c. [1] [2] [3] [4] [5] [6]
  • Updated regex matching logic in traverse.c to reuse pre-allocated match data objects, improving performance and reliability during file content processing.
  • Enabled JIT compilation for regex patterns to improve matching performance.

Clipboard Functionality Refactor (Linux)

  • Refactored clipboard copying on Linux to use fork/exec instead of shell commands, prioritizing wl-copy for Wayland environments and falling back to xclip or xsel as available. This change improves reliability, security, and compatibility across different Linux setups. [1] [2]

These changes collectively enhance resource safety, performance, and platform compatibility for regex handling and clipboard operations.

@trethore
trethore requested a review from Copilot December 8, 2025 10:39
@trethore
trethore merged commit 3f1c0a9 into main Dec 8, 2025
8 checks passed
@trethore
trethore removed the request for review from Copilot March 23, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant