comparison src/dupe.c @ 495:c7a2471e5c4e

Introduce macros to display debug messages. if (debug) printf(...) is now replaced by variadic macros: DEBUG_1() And for higher debugging levels: DEBUG_2() DEBUG_3() DEBUG_4()
author zas_
date Wed, 23 Apr 2008 20:47:19 +0000
parents 5212d4fed37f
children a33badd85f16
comparison
equal deleted inserted replaced
494:3bb9a8df6ee9 495:c7a2471e5c4e
963 if (best == child || dupe_match_highest_rank(child) == parent) 963 if (best == child || dupe_match_highest_rank(child) == parent)
964 { 964 {
965 GList *work; 965 GList *work;
966 gdouble rank; 966 gdouble rank;
967 967
968 if (debug > 1) printf("link found %s to %s [%d]\n", child->fd->name, parent->fd->name, g_list_length(parent->group)); 968 DEBUG_2("link found %s to %s [%d]\n", child->fd->name, parent->fd->name, g_list_length(parent->group));
969 969
970 work = parent->group; 970 work = parent->group;
971 while (work) 971 while (work)
972 { 972 {
973 DupeMatch *dm = work->data; 973 DupeMatch *dm = work->data;
992 dupe_match_link(child, parent, rank); 992 dupe_match_link(child, parent, rank);
993 list = g_list_remove(list, parent); 993 list = g_list_remove(list, parent);
994 } 994 }
995 else 995 else
996 { 996 {
997 if (debug > 1) printf("unlinking %s and %s\n", child->fd->name, parent->fd->name); 997 DEBUG_2("unlinking %s and %s\n", child->fd->name, parent->fd->name);
998 998
999 dupe_match_unlink(child, parent); 999 dupe_match_unlink(child, parent);
1000 } 1000 }
1001 1001
1002 return list; 1002 return list;
1095 { 1095 {
1096 GList *list; 1096 GList *list;
1097 1097
1098 list = dupe_match_rank_sort(dw->list); 1098 list = dupe_match_rank_sort(dw->list);
1099 1099
1100 if (debug > 1) dupe_match_print_list(list); 1100 if (debug >= 2) dupe_match_print_list(list);
1101 1101
1102 if (debug) printf("Similar items: %d\n", g_list_length(list)); 1102 DEBUG_1("Similar items: %d\n", g_list_length(list));
1103 list = dupe_match_group_trim(list, dw); 1103 list = dupe_match_group_trim(list, dw);
1104 if (debug) printf("Unique groups: %d\n", g_list_length(list)); 1104 DEBUG_1("Unique groups: %d\n", g_list_length(list));
1105 1105
1106 dupe_match_sort_groups(list); 1106 dupe_match_sort_groups(list);
1107 1107
1108 if (debug) dupe_match_print_list(list); 1108 if (debug) dupe_match_print_list(list);
1109 1109
1183 1183
1184 *rank = f * 100.0; 1184 *rank = f * 100.0;
1185 1185
1186 if (f < m) return FALSE; 1186 if (f < m) return FALSE;
1187 1187
1188 if (debug > 2) printf("similar: %32s %32s = %f\n", a->fd->name, b->fd->name, f); 1188 DEBUG_3("similar: %32s %32s = %f\n", a->fd->name, b->fd->name, f);
1189 } 1189 }
1190 1190
1191 return TRUE; 1191 return TRUE;
1192 } 1192 }
1193 1193
1338 1338
1339 /* start it */ 1339 /* start it */
1340 if (!thumb_loader_start(dw->thumb_loader, di->fd->path)) 1340 if (!thumb_loader_start(dw->thumb_loader, di->fd->path))
1341 { 1341 {
1342 /* error, handle it, do next */ 1342 /* error, handle it, do next */
1343 if (debug) printf("error loading thumb for %s\n", di->fd->path); 1343 DEBUG_1("error loading thumb for %s\n", di->fd->path);
1344 dupe_thumb_do(dw); 1344 dupe_thumb_do(dw);
1345 dupe_thumb_step(dw); 1345 dupe_thumb_step(dw);
1346 } 1346 }
1347 } 1347 }
1348 1348