static struct list *download_loop(struct list *files, int isfailed) { int ret; struct file local; struct list *iter; iter = list_head(files); while (iter) { struct file *file; char *fullname; file = iter->data; iter = iter->next; if (file->is_deleted) { continue; } fullname = mk_full_filename(path_prefix, file->filename); if (fullname == NULL) { abort(); } memset(&local, 0, sizeof(struct file)); local.filename = file->filename; populate_file_struct(&local, fullname); if (cmdline_option_quick) { ret = compute_hash_lazy(&local, fullname); } else { ret = compute_hash(&local, fullname); } if (ret != 0) { free(fullname); continue; } if (hash_needs_work(file, local.hash)) { full_download(file); } else { /* mark the file as good to save time later */ file->do_not_update = 1; } free(fullname); } if (isfailed) { list_free_list(files); } return end_full_download(); }
static struct list *full_download_loop(struct list *updates, int isfailed) { struct list *iter; struct file *file; iter = list_head(updates); while (iter) { file = iter->data; iter = iter->next; if (file->is_deleted) { continue; } full_download(file); } if (isfailed) { list_free_list(updates); } return end_full_download(); }