Mercurial > geeqie.yaz
comparison src/collect.c @ 516:b7e99bfeadc9
Convert the minority of while() to while ().
author | zas_ |
---|---|
date | Thu, 24 Apr 2008 15:49:57 +0000 |
parents | 985fdfebd89e |
children | 905688aa2317 |
comparison
equal
deleted
inserted
replaced
515:adc45cd3f08b | 516:b7e99bfeadc9 |
---|---|
112 | 112 |
113 void collection_list_free(GList *list) | 113 void collection_list_free(GList *list) |
114 { | 114 { |
115 GList *work; | 115 GList *work; |
116 work = list; | 116 work = list; |
117 while(work) | 117 while (work) |
118 { | 118 { |
119 collection_info_free((CollectInfo *)work->data); | 119 collection_info_free((CollectInfo *)work->data); |
120 work = work->next; | 120 work = work->next; |
121 } | 121 } |
122 g_list_free(list); | 122 g_list_free(list); |
213 | 213 |
214 CollectInfo *collection_list_find(GList *list, const gchar *path) | 214 CollectInfo *collection_list_find(GList *list, const gchar *path) |
215 { | 215 { |
216 GList *work = list; | 216 GList *work = list; |
217 | 217 |
218 while(work) | 218 while (work) |
219 { | 219 { |
220 CollectInfo *ci = work->data; | 220 CollectInfo *ci = work->data; |
221 if (strcmp(ci->fd->path, path) == 0) return ci; | 221 if (strcmp(ci->fd->path, path) == 0) return ci; |
222 work = work->next; | 222 work = work->next; |
223 } | 223 } |
228 #if 0 | 228 #if 0 |
229 static GList *collection_list_find_link(GList *list, gchar *path) | 229 static GList *collection_list_find_link(GList *list, gchar *path) |
230 { | 230 { |
231 GList *work = list; | 231 GList *work = list; |
232 | 232 |
233 while(work) | 233 while (work) |
234 { | 234 { |
235 CollectInfo *ci = work->data; | 235 CollectInfo *ci = work->data; |
236 if (strcmp(ci->fd->path, path) == 0) return work; | 236 if (strcmp(ci->fd->path, path) == 0) return work; |
237 work = work->next; | 237 work = work->next; |
238 } | 238 } |
243 static gint collection_list_find_index(GList *list, gchar *path) | 243 static gint collection_list_find_index(GList *list, gchar *path) |
244 { | 244 { |
245 gint c = 0; | 245 gint c = 0; |
246 GList *work = list; | 246 GList *work = list; |
247 | 247 |
248 while(work) | 248 while (work) |
249 { | 249 { |
250 CollectInfo *ci = work->data; | 250 CollectInfo *ci = work->data; |
251 if (strcmp(ci->fd->path, path) == 0) return c; | 251 if (strcmp(ci->fd->path, path) == 0) return c; |
252 work = work->next; | 252 work = work->next; |
253 c++; | 253 c++; |
434 GList *work = NULL; | 434 GList *work = NULL; |
435 GList *infol = NULL; | 435 GList *infol = NULL; |
436 gint b, e; | 436 gint b, e; |
437 | 437 |
438 b = 0; | 438 b = 0; |
439 while(data[b] != '\0' && data[b] != '\n' ) b++; | 439 while (data[b] != '\0' && data[b] != '\n' ) b++; |
440 b++; | 440 b++; |
441 e = b; | 441 e = b; |
442 | 442 |
443 while (data[b] != '\0') | 443 while (data[b] != '\0') |
444 { | 444 { |
479 } | 479 } |
480 | 480 |
481 temp = NULL; | 481 temp = NULL; |
482 temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n)); | 482 temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n)); |
483 work = list; | 483 work = list; |
484 while(work) | 484 while (work) |
485 { | 485 { |
486 n = g_list_index(cd->list, work->data); | 486 n = g_list_index(cd->list, work->data); |
487 if (n >= 0) | 487 if (n >= 0) |
488 { | 488 { |
489 temp = g_list_prepend(temp, g_strdup_printf("%d\n", n)); | 489 temp = g_list_prepend(temp, g_strdup_printf("%d\n", n)); |
491 work = work->next; | 491 work = work->next; |
492 } | 492 } |
493 | 493 |
494 total = 0; | 494 total = 0; |
495 work = temp; | 495 work = temp; |
496 while(work) | 496 while (work) |
497 { | 497 { |
498 total += strlen((gchar *)work->data); | 498 total += strlen((gchar *)work->data); |
499 work = work->next; | 499 work = work->next; |
500 } | 500 } |
501 total += 1; | 501 total += 1; |
502 | 502 |
503 uri_text = g_malloc(total); | 503 uri_text = g_malloc(total); |
504 ptr = uri_text; | 504 ptr = uri_text; |
505 | 505 |
506 work = g_list_last(temp); | 506 work = g_list_last(temp); |
507 while(work) | 507 while (work) |
508 { | 508 { |
509 gchar *text = work->data; | 509 gchar *text = work->data; |
510 | 510 |
511 work = work->prev; | 511 work = work->prev; |
512 | 512 |
716 collection_remove_by_info(cd, (CollectInfo *)list->data); | 716 collection_remove_by_info(cd, (CollectInfo *)list->data); |
717 return; | 717 return; |
718 } | 718 } |
719 | 719 |
720 work = list; | 720 work = list; |
721 while(work) | 721 while (work) |
722 { | 722 { |
723 cd->list = collection_list_remove(cd->list, work->data); | 723 cd->list = collection_list_remove(cd->list, work->data); |
724 work = work->next; | 724 work = work->next; |
725 } | 725 } |
726 cd->changed = (cd->list != NULL); | 726 cd->changed = (cd->list != NULL); |
760 void collection_maint_removed(FileData *fd) | 760 void collection_maint_removed(FileData *fd) |
761 { | 761 { |
762 GList *work; | 762 GList *work; |
763 | 763 |
764 work = collection_list; | 764 work = collection_list; |
765 while(work) | 765 while (work) |
766 { | 766 { |
767 CollectionData *cd = work->data; | 767 CollectionData *cd = work->data; |
768 work = work->next; | 768 work = work->next; |
769 | 769 |
770 while(collection_remove(cd, fd)); | 770 while (collection_remove(cd, fd)); |
771 } | 771 } |
772 #if 0 | 772 #if 0 |
773 /* Do we really need to do this? removed files are | 773 /* Do we really need to do this? removed files are |
774 * automatically ignored when loading a collection. | 774 * automatically ignored when loading a collection. |
775 */ | 775 */ |
780 void collection_maint_renamed(FileData *fd) | 780 void collection_maint_renamed(FileData *fd) |
781 { | 781 { |
782 GList *work; | 782 GList *work; |
783 | 783 |
784 work = collection_list; | 784 work = collection_list; |
785 while(work) | 785 while (work) |
786 { | 786 { |
787 CollectionData *cd = work->data; | 787 CollectionData *cd = work->data; |
788 work = work->next; | 788 work = work->next; |
789 | 789 |
790 while(collection_rename(cd, fd)); | 790 while (collection_rename(cd, fd)); |
791 } | 791 } |
792 | 792 |
793 collect_manager_moved(fd); | 793 collect_manager_moved(fd); |
794 } | 794 } |
795 | 795 |