diff --git a/commit.h b/commit.h index 5cc1e7ec9ee80965d1669e0f96dfeab03f3b0798..9f189cb054266cd8f8c084853afbb678ca56c9e9 100644 --- a/commit.h +++ b/commit.h @@ -254,7 +254,6 @@ extern int for_each_commit_graft(each_commit_graft_fn, void *); extern int is_repository_shallow(void); extern struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag); -extern void check_shallow_file_for_update(void); extern void set_alternate_shallow_file(const char *path, int override); extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol, const struct sha1_array *extra); diff --git a/http.c b/http.c index 44b130c54adc6e0b966fd3423e13e6b72809cb0c..4ecf9e8f7b2ac87e96bc5faeaf9392d2b5248465 100644 --- a/http.c +++ b/http.c @@ -117,6 +117,37 @@ size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf) return eltsize * nmemb; } +static void closedown_active_slot(struct active_request_slot *slot) +{ + active_requests--; + slot->in_use = 0; +} + +static void finish_active_slot(struct active_request_slot *slot) +{ + closedown_active_slot(slot); + curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code); + + if (slot->finished != NULL) + (*slot->finished) = 1; + + /* Store slot results so they can be read after the slot is reused */ + if (slot->results != NULL) { + slot->results->curl_result = slot->curl_result; + slot->results->http_code = slot->http_code; +#if LIBCURL_VERSION_NUM >= 0x070a08 + curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL, + &slot->results->auth_avail); +#else + slot->results->auth_avail = 0; +#endif + } + + /* Run callback if appropriate */ + if (slot->callback_func != NULL) + slot->callback_func(slot->callback_data); +} + #ifdef USE_CURL_MULTI static void process_curl_messages(void) { @@ -736,12 +767,6 @@ void run_active_slot(struct active_request_slot *slot) #endif } -static void closedown_active_slot(struct active_request_slot *slot) -{ - active_requests--; - slot->in_use = 0; -} - static void release_active_slot(struct active_request_slot *slot) { closedown_active_slot(slot); @@ -758,31 +783,6 @@ static void release_active_slot(struct active_request_slot *slot) #endif } -void finish_active_slot(struct active_request_slot *slot) -{ - closedown_active_slot(slot); - curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code); - - if (slot->finished != NULL) - (*slot->finished) = 1; - - /* Store slot results so they can be read after the slot is reused */ - if (slot->results != NULL) { - slot->results->curl_result = slot->curl_result; - slot->results->http_code = slot->http_code; -#if LIBCURL_VERSION_NUM >= 0x070a08 - curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL, - &slot->results->auth_avail); -#else - slot->results->auth_avail = 0; -#endif - } - - /* Run callback if appropriate */ - if (slot->callback_func != NULL) - slot->callback_func(slot->callback_data); -} - void finish_all_active_slots(void) { struct active_request_slot *slot = active_queue_head; @@ -845,7 +845,7 @@ char *get_remote_object_url(const char *url, const char *hex, return strbuf_detach(&buf, NULL); } -int handle_curl_result(struct slot_results *results) +static int handle_curl_result(struct slot_results *results) { /* * If we see a failing http code with CURLE_OK, we have turned off diff --git a/http.h b/http.h index 473179b14d5648635853af4c5bf425116c32b6fe..49afe39279d02785f3567aad2fec55c623a53d5f 100644 --- a/http.h +++ b/http.h @@ -85,9 +85,7 @@ extern curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp); extern struct active_request_slot *get_active_slot(void); extern int start_active_slot(struct active_request_slot *slot); extern void run_active_slot(struct active_request_slot *slot); -extern void finish_active_slot(struct active_request_slot *slot); extern void finish_all_active_slots(void); -extern int handle_curl_result(struct slot_results *results); /* * This will run one slot to completion in a blocking manner, similar to how diff --git a/line-log.c b/line-log.c index b7864ad5869eb076e778c352e2f64666dc77a525..a490efea07519edb006e515c8a0fdf60241e546d 100644 --- a/line-log.c +++ b/line-log.c @@ -237,7 +237,7 @@ static void diff_ranges_release(struct diff_ranges *diff) range_set_release(&diff->target); } -void line_log_data_init(struct line_log_data *r) +static void line_log_data_init(struct line_log_data *r) { memset(r, 0, sizeof(struct line_log_data)); range_set_init(&r->ranges, 0); diff --git a/line-log.h b/line-log.h index a9212d84e492304b4e57da1e0327189b3b6434ed..7a5c24e2df40c09274077928574bc91349d475d1 100644 --- a/line-log.h +++ b/line-log.h @@ -54,8 +54,6 @@ struct line_log_data { struct diff_ranges diff; }; -extern void line_log_data_init(struct line_log_data *r); - extern void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args); extern int line_log_filter(struct rev_info *rev); diff --git a/pack-bitmap.c b/pack-bitmap.c index 3281df389e23e2fdf220e3b8aa74f4051f397c74..365f9d92ed8b57c1e766a126b6e6571009eedde5 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -252,6 +252,20 @@ static int load_bitmap_entries_v1(struct bitmap_index *index) return 0; } +static char *pack_bitmap_filename(struct packed_git *p) +{ + char *idx_name; + int len; + + len = strlen(p->pack_name) - strlen(".pack"); + idx_name = xmalloc(len + strlen(".bitmap") + 1); + + memcpy(idx_name, p->pack_name, len); + memcpy(idx_name + len, ".bitmap", strlen(".bitmap") + 1); + + return idx_name; +} + static int open_pack_bitmap_1(struct packed_git *packfile) { int fd; @@ -322,20 +336,6 @@ static int load_pack_bitmap(void) return -1; } -char *pack_bitmap_filename(struct packed_git *p) -{ - char *idx_name; - int len; - - len = strlen(p->pack_name) - strlen(".pack"); - idx_name = xmalloc(len + strlen(".bitmap") + 1); - - memcpy(idx_name, p->pack_name, len); - memcpy(idx_name + len, ".bitmap", strlen(".bitmap") + 1); - - return idx_name; -} - static int open_pack_bitmap(void) { struct packed_git *p; diff --git a/pack-bitmap.h b/pack-bitmap.h index 487600b18c79be22c4c611fc4c3d29d817f1f304..0adcef77b58cc13822f1b400d5418ec6f8b34421 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -38,7 +38,6 @@ int prepare_bitmap_git(void); void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags); void traverse_bitmap_commit_list(show_reachable_fn show_reachable); void test_bitmap_walk(struct rev_info *revs); -char *pack_bitmap_filename(struct packed_git *p); int prepare_bitmap_walk(struct rev_info *revs); int reuse_partial_packfile_from_bitmap(struct packed_git **packfile, uint32_t *entries, off_t *up_to); int rebuild_existing_bitmaps(struct packing_data *mapping, khash_sha1 *reused_bitmaps, int show_progress); diff --git a/prompt.c b/prompt.c index 8181eebbfcd0080540bc580416336436ced98297..75406390c6fdabf74e74d4c2a90e6ac92afc4ccc 100644 --- a/prompt.c +++ b/prompt.c @@ -73,8 +73,3 @@ char *git_prompt(const char *prompt, int flags) } return r; } - -char *git_getpass(const char *prompt) -{ - return git_prompt(prompt, PROMPT_ASKPASS); -} diff --git a/prompt.h b/prompt.h index 04f321a781d37af780b906c2a4564c08eea830c8..e04cced030ca4df6d729c2132ca4671b959952b4 100644 --- a/prompt.h +++ b/prompt.h @@ -5,6 +5,5 @@ #define PROMPT_ECHO (1<<1) char *git_prompt(const char *prompt, int flags); -char *git_getpass(const char *prompt); #endif /* PROMPT_H */ diff --git a/remote.c b/remote.c index 7b71ebf4bfca0ce6490a122afc5c321d2b35690c..68901b0070d257dc31b59e9292cd7b6d7ef2e952 100644 --- a/remote.c +++ b/remote.c @@ -2156,7 +2156,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet /* * Compare-and-swap */ -void clear_cas_option(struct push_cas_option *cas) +static void clear_cas_option(struct push_cas_option *cas) { int i; diff --git a/remote.h b/remote.h index f346524dbd805bca5167337b71e5eff605fcd81b..02d66ceff5c962995de37f351a09fe91055d6364 100644 --- a/remote.h +++ b/remote.h @@ -261,7 +261,6 @@ struct push_cas_option { extern int parseopt_push_cas_option(const struct option *, const char *arg, int unset); extern int parse_push_cas_option(struct push_cas_option *, const char *arg, int unset); -extern void clear_cas_option(struct push_cas_option *); extern int is_empty_cas(const struct push_cas_option *); void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *); diff --git a/revision.c b/revision.c index 4bc851c070e40fbdc7aedf5edc9db78f808f328e..66520c671ee1141b1c0edb7ab776dd9d9df04726 100644 --- a/revision.c +++ b/revision.c @@ -2970,6 +2970,61 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi return commit_show; } +define_commit_slab(saved_parents, struct commit_list *); + +#define EMPTY_PARENT_LIST ((struct commit_list *)-1) + +/* + * You may only call save_parents() once per commit (this is checked + * for non-root commits). + */ +static void save_parents(struct rev_info *revs, struct commit *commit) +{ + struct commit_list **pp; + + if (!revs->saved_parents_slab) { + revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents)); + init_saved_parents(revs->saved_parents_slab); + } + + pp = saved_parents_at(revs->saved_parents_slab, commit); + + /* + * When walking with reflogs, we may visit the same commit + * several times: once for each appearance in the reflog. + * + * In this case, save_parents() will be called multiple times. + * We want to keep only the first set of parents. We need to + * store a sentinel value for an empty (i.e., NULL) parent + * list to distinguish it from a not-yet-saved list, however. + */ + if (*pp) + return; + if (commit->parents) + *pp = copy_commit_list(commit->parents); + else + *pp = EMPTY_PARENT_LIST; +} + +static void free_saved_parents(struct rev_info *revs) +{ + if (revs->saved_parents_slab) + clear_saved_parents(revs->saved_parents_slab); +} + +struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit) +{ + struct commit_list *parents; + + if (!revs->saved_parents_slab) + return commit->parents; + + parents = *saved_parents_at(revs->saved_parents_slab, commit); + if (parents == EMPTY_PARENT_LIST) + return NULL; + return parents; +} + enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit) { enum commit_action action = get_commit_action(revs, commit); @@ -3269,54 +3324,3 @@ void put_revision_mark(const struct rev_info *revs, const struct commit *commit) fputs(mark, stdout); putchar(' '); } - -define_commit_slab(saved_parents, struct commit_list *); - -#define EMPTY_PARENT_LIST ((struct commit_list *)-1) - -void save_parents(struct rev_info *revs, struct commit *commit) -{ - struct commit_list **pp; - - if (!revs->saved_parents_slab) { - revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents)); - init_saved_parents(revs->saved_parents_slab); - } - - pp = saved_parents_at(revs->saved_parents_slab, commit); - - /* - * When walking with reflogs, we may visit the same commit - * several times: once for each appearance in the reflog. - * - * In this case, save_parents() will be called multiple times. - * We want to keep only the first set of parents. We need to - * store a sentinel value for an empty (i.e., NULL) parent - * list to distinguish it from a not-yet-saved list, however. - */ - if (*pp) - return; - if (commit->parents) - *pp = copy_commit_list(commit->parents); - else - *pp = EMPTY_PARENT_LIST; -} - -struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit) -{ - struct commit_list *parents; - - if (!revs->saved_parents_slab) - return commit->parents; - - parents = *saved_parents_at(revs->saved_parents_slab, commit); - if (parents == EMPTY_PARENT_LIST) - return NULL; - return parents; -} - -void free_saved_parents(struct rev_info *revs) -{ - if (revs->saved_parents_slab) - clear_saved_parents(revs->saved_parents_slab); -} diff --git a/revision.h b/revision.h index 17ebafc4c76de4ac74f5b977101af1aedd1a1ae9..0ea8b4e25555e30d852f47ce37ec2a75a61043e3 100644 --- a/revision.h +++ b/revision.h @@ -300,18 +300,14 @@ extern int rewrite_parents(struct rev_info *revs, struct commit *commit, rewrite_parent_fn_t rewrite_parent); /* - * Save a copy of the parent list, and return the saved copy. This is - * used by the log machinery to retrieve the original parents when - * commit->parents has been modified by history simpification. - * - * You may only call save_parents() once per commit (this is checked - * for non-root commits). + * The log machinery saves the original parent list so that + * get_saved_parents() can later tell what the real parents of the + * commits are, when commit->parents has been modified by history + * simpification. * * get_saved_parents() will transparently return commit->parents if * history simplification is off. */ -extern void save_parents(struct rev_info *revs, struct commit *commit); extern struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit); -extern void free_saved_parents(struct rev_info *revs); #endif diff --git a/shallow.c b/shallow.c index f5e67204a4084ff79beec0d5a5dd0fb06966cc3f..d8bf40ad4bed3bc846bb71945f1c2bfce76a202d 100644 --- a/shallow.c +++ b/shallow.c @@ -137,7 +137,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, return result; } -void check_shallow_file_for_update(void) +static void check_shallow_file_for_update(void) { if (is_shallow == -1) die("BUG: shallow must be initialized by now"); diff --git a/urlmatch.c b/urlmatch.c index 618d2164919758b141aa9d6408c57a4fb99c922c..132d342bc12bf790f9964f179385aa4f08e6ae00 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -412,9 +412,9 @@ static size_t url_match_prefix(const char *url, return 0; } -int match_urls(const struct url_info *url, - const struct url_info *url_prefix, - int *exactusermatch) +static int match_urls(const struct url_info *url, + const struct url_info *url_prefix, + int *exactusermatch) { /* * url_prefix matches url if the scheme, host and port of url_prefix diff --git a/urlmatch.h b/urlmatch.h index b461dfd3dfee2c37eb65e5abb28f6f128f40096b..528862adc55c43ed26763b3c05e1d27d558a1b74 100644 --- a/urlmatch.h +++ b/urlmatch.h @@ -31,7 +31,6 @@ struct url_info { }; extern char *url_normalize(const char *, struct url_info *); -extern int match_urls(const struct url_info *url, const struct url_info *url_prefix, int *exactusermatch); struct urlmatch_item { size_t matched_len;