LCOV - code coverage report
Current view: top level - src - db_primary_consider_vacuum.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 93.3 % 15 14
Test Date: 2026-03-01 04:31:48 Functions: 100.0 % 1 1
Branches: 87.5 % 8 7

             Branch data     Line data    Source code
       1                 :             : #include "precizer.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  *
       5                 :             :  * The VACUUM command rebuilds the database file,
       6                 :             :  * repacking it into a minimal amount of disk space.
       7                 :             :  *
       8                 :             :  */
       9                 :         283 : Return db_primary_consider_vacuum(void)
      10                 :             : {
      11                 :             :         /* Status returned by this function through provide()
      12                 :             :            Default value assumes successful completion */
      13                 :         283 :         Return status = SUCCESS;
      14                 :             : 
      15                 :             :         /* Interrupt the function smoothly */
      16                 :             :         /* Interrupt when Ctrl+C */
      17         [ -  + ]:         283 :         if(global_interrupt_flag == true)
      18                 :             :         {
      19                 :           0 :                 provide(status);
      20                 :             :         }
      21                 :             : 
      22                 :             :         // Don't do anything
      23         [ +  + ]:         283 :         if(config->compare == true)
      24                 :             :         {
      25                 :          70 :                 slog(TRACE,"Comparison mode is enabled. The primary database doesn't require vacuuming\n");
      26                 :          70 :                 provide(status);
      27                 :             : 
      28         [ +  + ]:         213 :         } else if(config->dry_run == true){
      29                 :          16 :                 slog(TRACE,"Dry Run mode is enabled. The primary database doesn't require vacuuming\n");
      30                 :          16 :                 provide(status);
      31                 :             : 
      32         [ +  + ]:         197 :         } else if(config->db_primary_file_modified == false){
      33                 :          24 :                 slog(TRACE,"No changes were made. The primary database doesn't require vacuuming\n");
      34                 :          24 :                 provide(status);
      35                 :             :         }
      36                 :             : 
      37                 :             :         /* Vacuum the primary database */
      38                 :         173 :         status = db_vacuum(confstr(db_primary_file_path));
      39                 :             : 
      40                 :         173 :         provide(status);
      41                 :             : }
        

Generated by: LCOV version 2.0-1