@@ -152,7 +152,7 @@ static RmParrot *rm_parrot_open(RmSession *session, const char *json_path, bool
152
152
rm_trie_init (& polly -> directory_trie );
153
153
154
154
for (GSList * iter = session -> cfg -> paths ; iter ; iter = iter -> next ) {
155
- RmPath * rmpath = iter -> data ;
155
+ const RmPath * rmpath = iter -> data ;
156
156
RmStat stat_buf ;
157
157
if (rm_sys_stat (rmpath -> path , & stat_buf ) != -1 ) {
158
158
g_hash_table_add (polly -> disk_ids , GUINT_TO_POINTER (stat_buf .st_dev ));
@@ -310,7 +310,7 @@ static RmFile *rm_parrot_try_next(RmParrot *polly) {
310
310
}
311
311
312
312
/* Fake the checksum using RM_DIGEST_EXT */
313
- JsonNode * cksum_node = json_object_get_member (object , "checksum" );
313
+ const JsonNode * cksum_node = json_object_get_member (object , "checksum" );
314
314
if (cksum_node != NULL ) {
315
315
const char * cksum = json_object_get_string_member (object , "checksum" );
316
316
if (cksum != NULL ) {
@@ -319,7 +319,7 @@ static RmFile *rm_parrot_try_next(RmParrot *polly) {
319
319
}
320
320
321
321
/* Fix the hardlink relationship */
322
- JsonNode * hardlink_of = json_object_get_member (object , "hardlink_of" );
322
+ const JsonNode * hardlink_of = json_object_get_member (object , "hardlink_of" );
323
323
if (hardlink_of != NULL ) {
324
324
rm_file_hardlink_add (polly -> last_original , file );
325
325
} else {
@@ -426,11 +426,11 @@ static RmFile *rm_parrot_next(RmParrot *polly) {
426
426
427
427
#define FAIL_MSG (msg ) rm_log_debug(RED "[" msg "]\n" RESET)
428
428
429
- static bool rm_parrot_check_depth (RmCfg * cfg , RmFile * file ) {
429
+ static bool rm_parrot_check_depth (const RmCfg * cfg , const RmFile * file ) {
430
430
return (file -> depth == 0 || file -> depth <= cfg -> depth );
431
431
}
432
432
433
- static bool rm_parrot_check_size (RmCfg * cfg , RmFile * file ) {
433
+ static bool rm_parrot_check_size (const RmCfg * cfg , const RmFile * file ) {
434
434
if (cfg -> limits_specified == false) {
435
435
return true;
436
436
}
@@ -451,7 +451,7 @@ static bool rm_parrot_check_size(RmCfg *cfg, RmFile *file) {
451
451
return false;
452
452
}
453
453
454
- static bool rm_parrot_check_hidden (RmCfg * cfg , _UNUSED RmFile * file ,
454
+ static bool rm_parrot_check_hidden (const RmCfg * cfg , _UNUSED RmFile * file ,
455
455
const char * file_path ) {
456
456
if (cfg -> ignore_hidden == false && cfg -> partial_hidden == false) {
457
457
// no need to check.
@@ -507,7 +507,7 @@ static bool rm_parrot_check_path(RmParrot *polly, RmFile *file, const char *file
507
507
*/
508
508
509
509
for (GSList * iter = cfg -> paths ; iter ; iter = iter -> next ) {
510
- RmPath * rmpath = iter -> data ;
510
+ const RmPath * rmpath = iter -> data ;
511
511
size_t path_len = strlen (rmpath -> path );
512
512
513
513
if (strncmp (file_path , rmpath -> path , path_len ) == 0 ) {
@@ -527,7 +527,7 @@ static bool rm_parrot_check_path(RmParrot *polly, RmFile *file, const char *file
527
527
return (highest_match > 0 );
528
528
}
529
529
530
- static bool rm_parrot_check_types (RmCfg * cfg , RmFile * file ) {
530
+ static bool rm_parrot_check_types (RmCfg * cfg , const RmFile * file ) {
531
531
switch (file -> lint_type ) {
532
532
case RM_LINT_TYPE_DUPE_CANDIDATE :
533
533
return cfg -> find_duplicates ;
@@ -623,15 +623,15 @@ static void rm_parrot_fix_duplicate_entries(RmParrotCage *cage, GQueue *group) {
623
623
}
624
624
625
625
static void rm_parrot_fix_must_match_tagged (RmParrotCage * cage , GQueue * group ) {
626
- RmCfg * cfg = cage -> session -> cfg ;
626
+ const RmCfg * cfg = cage -> session -> cfg ;
627
627
if (!(cfg -> must_match_tagged || cfg -> must_match_untagged )) {
628
628
return ;
629
629
}
630
630
631
631
bool has_prefd = false, has_non_prefd = false;
632
632
633
633
for (GList * iter = group -> head ; iter ; iter = iter -> next ) {
634
- RmFile * file = iter -> data ;
634
+ const RmFile * file = iter -> data ;
635
635
if (file -> lint_type != RM_LINT_TYPE_DUPE_CANDIDATE &&
636
636
file -> lint_type != RM_LINT_TYPE_DUPE_DIR_CANDIDATE ) {
637
637
// -k and -m only applies to dupes.
@@ -684,12 +684,12 @@ static void rm_parrot_update_stats(RmParrotCage *cage, RmFile *file) {
684
684
}
685
685
686
686
static void rm_parrot_cage_write_group (RmParrotCage * cage , GQueue * group , bool pack_directories ) {
687
- RmCfg * cfg = cage -> session -> cfg ;
687
+ const RmCfg * cfg = cage -> session -> cfg ;
688
688
689
689
if (cfg -> filter_mtime ) {
690
690
gsize older = 0 ;
691
691
for (GList * iter = group -> head ; iter ; iter = iter -> next ) {
692
- RmFile * file = iter -> data ;
692
+ const RmFile * file = iter -> data ;
693
693
older += (file -> mtime >= cfg -> min_mtime );
694
694
}
695
695
@@ -877,7 +877,7 @@ static void rm_parrot_merge_identical_groups(RmParrotCage *cage) {
877
877
GQueue * existing_group = g_hash_table_lookup (digest_to_group , head_file -> digest );
878
878
879
879
if (existing_group != NULL ) {
880
- RmFile * existing_head_file = existing_group -> head -> data ;
880
+ const RmFile * existing_head_file = existing_group -> head -> data ;
881
881
882
882
/* Merge only groups with the same type */
883
883
if (existing_head_file -> lint_type == head_file -> lint_type ) {
@@ -914,7 +914,7 @@ void rm_parrot_cage_flush(RmParrotCage *cage) {
914
914
* If so, we need to merge them up again using treemerge.c
915
915
*/
916
916
for (GList * iter = cage -> parrots -> head ; iter ; iter = iter -> next ) {
917
- RmParrot * parrot = iter -> data ;
917
+ const RmParrot * parrot = iter -> data ;
918
918
if (parrot -> pack_directories ) {
919
919
pack_directories = true;
920
920
break ;
0 commit comments