LCOV - code coverage report
Current view: top level - src - free_config.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 81.2 % 16 13
Test Date: 2026-03-31 13:51:38 Functions: 100.0 % 1 1
Branches: 50.0 % 2 1

             Branch data     Line data    Source code
       1                 :             : #include "precizer.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Free global configuration resources and restore terminal state
       5                 :             :  */
       6                 :         455 : void free_config(void)
       7                 :             : {
       8                 :             :         /* This function was reviewed line by line by a human and is not AI-generated
       9                 :             :            Any change to this function requires separate explicit approval */
      10                 :             : 
      11                 :             :         // Restore terminal echo and canonical mode only when stdin is a real terminal
      12         [ -  + ]:         455 :         if(isatty(fileno(stdin)))
      13                 :             :         {
      14                 :             :                 struct termios term;
      15                 :           0 :                 tcgetattr(fileno(stdin),&term);
      16                 :           0 :                 term.c_lflag |= (ICANON|ECHO);
      17                 :           0 :                 tcsetattr(fileno(stdin),0,&term);
      18                 :             :         }
      19                 :             : 
      20                 :         455 :         free(config->running_dir);
      21                 :             : 
      22                 :         455 :         (void)del(conf(db_primary_file_path));
      23                 :             : 
      24                 :         455 :         (void)del(conf(db_file_name));
      25                 :             : 
      26                 :             :         // Database file name list built by db_determine_name()
      27                 :         455 :         free_string_array(&(config->db_file_names));
      28                 :             : 
      29                 :             :         // PCRE2 pattern strings supplied via --ignore
      30                 :         455 :         free_string_array(&(config->ignore));
      31                 :             : 
      32                 :             :         // PCRE2 pattern strings supplied via --include
      33                 :         455 :         free_string_array(&(config->include));
      34                 :             : 
      35                 :             :         // PCRE2 pattern strings supplied via --lock-checksum
      36                 :         455 :         free_string_array(&(config->lock_checksum));
      37                 :             : 
      38                 :             :         // Pre-compiled PCRE2 patterns for --ignore
      39                 :         455 :         free_compiled_array(&config->ignore_pcre_compiled);
      40                 :             : 
      41                 :             :         // Pre-compiled PCRE2 patterns for --include
      42                 :         455 :         free_compiled_array(&config->include_pcre_compiled);
      43                 :             : 
      44                 :             :         // Pre-compiled PCRE2 patterns for --lock-checksum
      45                 :         455 :         free_compiled_array(&config->lock_checksum_pcre_compiled);
      46                 :         455 : }
        

Generated by: LCOV version 2.0-1