Skip to content

v0.3.4

Choose a tag to compare

@davidesantangelo davidesantangelo released this 03 Apr 07:19
· 93 commits to main since this release

Fixed

  • Line Output: Resolved an issue where the filename prefix was sometimes missing on lines following the first match on that line when multiple matches occurred close together. The logic now correctly prints the prefix once per unique line displayed (Addresses Issue #17).
  • Highlighting: Corrected a bug where ANSI color codes (KREP_COLOR_MATCH, KREP_COLOR_RESET) were not consistently applied to the matched text segments. Switched text printing in print_matching_lines to use fprintf exclusively for better consistency.
  • Compilation: Fixed "typedef redefinition" errors by removing duplicate definitions of match_position_t and match_result_t from krep.c. These structs are now solely defined in krep.h.
  • Regex Search: Improved the logic for advancing the search position after a regex match, particularly addressing potential infinite loops with zero-length matches.

Added

  • Testing: Introduced a new test suite (test_numeric_patterns) specifically designed to verify the correct behavior when searching for numeric patterns (e.g., "11") in files containing line numbers or other numeric sequences, guarding against potential false positives.
  • Error Handling: Added more descriptive perror messages for memory allocation (malloc/realloc) failures in result management functions. Added checks and error messages for invalid command-line arguments (e.g., empty pattern for literal search, pattern too long).

Changed

  • Code Quality: Refined argument parsing and validation in main. Improved comments and added minor validation checks in various search and utility functions. Updated error handling and return codes in API functions (search_string, search_file). Optimized prepare_bad_char_table slightly.
  • Build: Updated version number to 0.3.4 in Makefile, README.md, krep.c, and krep.h.