You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New -o command-line option to print only the matched (non-empty) parts of lines, similar to grep -o.
New -d command-line option to display a detailed search summary (performance, algorithm used, etc.).
Changed
Performance: Significantly optimized -c (count lines) mode. It now counts unique lines directly during the search process instead of storing all match positions first, drastically reducing memory usage and execution time for large files/many matches.
Behavior:-c (count lines) mode now always runs single-threaded to ensure accurate line state tracking for counting. Multi-threading support for this mode is deprecated due to complexity.
Behavior:-o now correctly prints each individual match on a separate newline.
Internal: Updated signatures for all core search functions (kmp_search, boyer_moore_search, etc.) to support the new optimized line counting mode.
Internal: Renamed print_matching_lines function to print_matching_items to better reflect its dual role (printing lines or matches).
Fixed
Fixed regex_search incorrectly handling patterns like ^$ on empty input strings.
Fixed -o behavior which previously relied on incorrect unique line tracking logic.
Fixed -Wsign-compare compiler warning related to file size comparison in threading logic.
Fixed various compiler errors caused by conflicting function declarations/definitions after updating search function signatures.
Fixed incorrect test assertions for overlapping matches in literal search tests (aba in abababa, aa in aaaaa) to expect non-overlapping counts (2), matching the implemented skip-ahead logic.
Fixed incorrect test assertions for regex tests involving multiple matches ([a-z]{5}), empty string matching (^$), and overlapping matches (aa in aaaaa) to align with standard POSIX regex behavior and the fixed search logic.
Build
Refactored Makefile for improved robustness:
Separated standard CFLAGS from testing-specific TEST_CFLAGS.
Introduced a dedicated object file (krep_test.o) for compiling krep.c with -DTESTING, preventing object file conflicts between normal (krep) and test (test_krep) builds.
Corrected dependencies and linking commands for the test target.
Removed
Removed the internal count_unique_matching_lines function, as line counting is now integrated directly into the search algorithms when -c is used.
Documentation
Updated README.md with version 0.3.7, added -o and -d options, revised examples, updated command descriptions, and modified performance/implementation details to reflect current behavior (e.g., single-threading for -c/-o).