struct walker *get_http_walker(const char *url, struct remote *remote) { char *s; struct walker_data *data = xmalloc(sizeof(struct walker_data)); struct walker *walker = xmalloc(sizeof(struct walker)); http_init(remote); data->no_pragma_header = curl_slist_append(NULL, "Pragma:"); data->alt = xmalloc(sizeof(*data->alt)); data->alt->base = xmalloc(strlen(url) + 1); strcpy(data->alt->base, url); for (s = data->alt->base + strlen(data->alt->base) - 1; *s == '/'; --s) *s = 0; data->alt->got_indices = 0; data->alt->packs = NULL; data->alt->next = NULL; data->got_alternates = -1; walker->corrupt_object_found = 0; walker->fetch = fetch; walker->fetch_ref = fetch_ref; walker->prefetch = prefetch; walker->cleanup = cleanup; walker->data = data; #ifdef USE_CURL_MULTI add_fill_function(walker, (int (*)(void *)) fill_active_slot); #endif return walker; }
static void run_request_queue(void) { #ifdef USE_CURL_MULTI is_running_queue = 1; fill_active_slots(); add_fill_function(NULL, fill_active_slot); #endif do { finish_all_active_slots(); #ifdef USE_CURL_MULTI fill_active_slots(); #endif } while (request_queue_head && !aborted); #ifdef USE_CURL_MULTI is_running_queue = 0; #endif }
struct walker *get_http_walker(const char *url) { char *s; struct walker_data *data = xmalloc(sizeof(struct walker_data)); struct walker *walker = xmalloc(sizeof(struct walker)); data->alt = xmalloc(sizeof(*data->alt)); data->alt->base = xmalloc(strlen(url) + 1); strcpy(data->alt->base, url); for (s = data->alt->base + strlen(data->alt->base) - 1; *s == '/'; --s) *s = 0; data->alt->got_indices = 0; data->alt->packs = NULL; data->alt->next = NULL; data->got_alternates = -1; walker->corrupt_object_found = 0; walker->fetch = fetch; walker->fetch_ref = fetch_ref; walker->prefetch = prefetch; walker->cleanup = cleanup; walker->data = data; walker->skip_sparse_checkout = !core_apply_sparse_checkout; memset(&walker->exclude_list, 0, sizeof(walker->exclude_list)); if (!walker->skip_sparse_checkout) { if (add_excludes_from_file_to_list(git_path("info/sparse-checkout"), "", 0, &walker->exclude_list, 0) < 0) walker->skip_sparse_checkout = 1; } walker->sparse_checkout_list_count = 0; walker->sparse_checkout_list_size = 256; walker->sparse_checkout_list = !walker->skip_sparse_checkout ? xmalloc(walker->sparse_checkout_list_size * sizeof(unsigned char[20])) : NULL; #ifdef USE_CURL_MULTI add_fill_function(walker, (int (*)(void *)) fill_active_slot); #endif return walker; }