Merge branch 'jc/unused-symbols'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Feb 2015 21:44:07 +0000 (13:44 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Feb 2015 21:44:07 +0000 (13:44 -0800)
Mark file-local symbols as "static", and drop functions that nobody
uses.

* jc/unused-symbols:
shallow.c: make check_shallow_file_for_update() static
remote.c: make clear_cas_option() static
urlmatch.c: make match_urls() static
revision.c: make save_parents() and free_saved_parents() static
line-log.c: make line_log_data_init() static
pack-bitmap.c: make pack_bitmap_filename() static
prompt.c: remove git_getpass() nobody uses
http.c: make finish_active_slot() and handle_curl_result() static

1  2 
http.c
pack-bitmap.c
remote.c
remote.h
revision.c
revision.h
shallow.c
diff --combined http.c
index 44b130c54adc6e0b966fd3423e13e6b72809cb0c,16a6a2d934515b43612d587db5632f8774706230..4ecf9e8f7b2ac87e96bc5faeaf9392d2b5248465
--- 1/http.c
--- 2/http.c
+++ b/http.c
@@@ -62,9 -62,6 +62,9 @@@ static const char *user_agent
  
  static struct credential cert_auth = CREDENTIAL_INIT;
  static int ssl_cert_password_required;
 +#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
 +static unsigned long http_auth_methods = CURLAUTH_ANY;
 +#endif
  
  static struct curl_slist *pragma_header;
  static struct curl_slist *no_pragma_header;
@@@ -117,6 -114,37 +117,37 @@@ size_t fwrite_null(char *ptr, size_t el
        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)
  {
@@@ -583,9 -611,6 +614,9 @@@ struct active_request_slot *get_active_
        curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
        curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
        curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
 +#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
 +      curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
 +#endif
        if (http_auth.password)
                init_curl_http_auth(slot->curl);
  
@@@ -736,12 -761,6 +767,6 @@@ void run_active_slot(struct active_requ
  #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);
  #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 -839,7 +845,7 @@@ char *get_remote_object_url(const char 
        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
                        credential_reject(&http_auth);
                        return HTTP_NOAUTH;
                } else {
 +#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
 +                      http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
 +#endif
                        return HTTP_REAUTH;
                }
        } else {
@@@ -995,7 -986,6 +995,7 @@@ static void extract_content_type(struc
                strbuf_addstr(charset, "ISO-8859-1");
  }
  
 +
  /* http_request() targets */
  #define HTTP_REQUEST_STRBUF   0
  #define HTTP_REQUEST_FILE     1
diff --combined pack-bitmap.c
index 3281df389e23e2fdf220e3b8aa74f4051f397c74,0cd85f6c3ad83bb4b2290d67364e7f69fd6403e9..365f9d92ed8b57c1e766a126b6e6571009eedde5
@@@ -60,7 -60,7 +60,7 @@@ static struct bitmap_index 
        struct ewah_bitmap *blobs;
        struct ewah_bitmap *tags;
  
 -      /* Map from SHA1 -> `stored_bitmap` for all the bitmapped comits */
 +      /* Map from SHA1 -> `stored_bitmap` for all the bitmapped commits */
        khash_sha1 *bitmaps;
  
        /* Number of bitmapped commits */
@@@ -252,6 -252,20 +252,20 @@@ static int load_bitmap_entries_v1(struc
        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 +336,6 @@@ failed
        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 --combined remote.c
index 7b71ebf4bfca0ce6490a122afc5c321d2b35690c,0b3939ce814d01b770b54c2c4e314a9f0d9bfb80..68901b0070d257dc31b59e9292cd7b6d7ef2e952
+++ b/remote.c
@@@ -975,8 -975,8 +975,8 @@@ struct ref *copy_ref(const struct ref *
        cpy = xmalloc(sizeof(struct ref) + len + 1);
        memcpy(cpy, ref, sizeof(struct ref) + len + 1);
        cpy->next = NULL;
 -      cpy->symref = ref->symref ? xstrdup(ref->symref) : NULL;
 -      cpy->remote_status = ref->remote_status ? xstrdup(ref->remote_status) : NULL;
 +      cpy->symref = xstrdup_or_null(ref->symref);
 +      cpy->remote_status = xstrdup_or_null(ref->remote_status);
        cpy->peer_ref = copy_ref(ref->peer_ref);
        return cpy;
  }
@@@ -2156,7 -2156,7 +2156,7 @@@ struct ref *get_stale_heads(struct refs
  /*
   * 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 --combined remote.h
index f346524dbd805bca5167337b71e5eff605fcd81b,31ccdcd14f4aaa89a78d110c6ccfc5f71faeb892..02d66ceff5c962995de37f351a09fe91055d6364
+++ b/remote.h
@@@ -115,8 -115,7 +115,8 @@@ struct ref 
                REF_STATUS_REJECT_SHALLOW,
                REF_STATUS_UPTODATE,
                REF_STATUS_REMOTE_REJECT,
 -              REF_STATUS_EXPECTING_REPORT
 +              REF_STATUS_EXPECTING_REPORT,
 +              REF_STATUS_ATOMIC_PUSH_FAILED
        } status;
        char *remote_status;
        struct ref *peer_ref; /* when renaming */
@@@ -261,7 -260,6 +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 --combined revision.c
index 4bc851c070e40fbdc7aedf5edc9db78f808f328e,0f4619c404b53df327ed863888a7eee31cfa4493..66520c671ee1141b1c0edb7ab776dd9d9df04726
@@@ -2017,8 -2017,6 +2017,8 @@@ static int handle_revision_opt(struct r
                grep_set_pattern_type_option(GREP_PATTERN_TYPE_PCRE, &revs->grep_filter);
        } else if (!strcmp(arg, "--all-match")) {
                revs->grep_filter.all_match = 1;
 +      } else if (!strcmp(arg, "--invert-grep")) {
 +              revs->invert_grep = 1;
        } else if ((argcount = parse_long_opt("encoding", argv, &optarg))) {
                if (strcmp(optarg, "none"))
                        git_log_output_encoding = xstrdup(optarg);
@@@ -2917,7 -2915,7 +2917,7 @@@ static int commit_match(struct commit *
                                     (char *)message, strlen(message));
        strbuf_release(&buf);
        unuse_commit_buffer(commit, message);
 -      return retval;
 +      return opt->invert_grep ? !retval : retval;
  }
  
  static inline int want_ancestry(const struct rev_info *revs)
@@@ -2970,6 -2968,61 +2970,61 @@@ enum commit_action get_commit_action(st
        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 -3322,3 +3324,3 @@@ void put_revision_mark(const struct rev
        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 --combined revision.h
index 17ebafc4c76de4ac74f5b977101af1aedd1a1ae9,07807e5301871ae19c5fba716dae5a00db25e34e..0ea8b4e25555e30d852f47ce37ec2a75a61043e3
@@@ -169,8 -169,6 +169,8 @@@ struct rev_info 
  
        /* Filter by commit log message */
        struct grep_opt grep_filter;
 +      /* Negate the match of grep_filter */
 +      int invert_grep;
  
        /* Display history graph */
        struct git_graph *graph;
@@@ -300,18 -298,14 +300,14 @@@ extern int rewrite_parents(struct rev_i
        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 --combined shallow.c
index f5e67204a4084ff79beec0d5a5dd0fb06966cc3f,04ea816e0e8f2ed2829ed4ceca8d031a867e2cda..d8bf40ad4bed3bc846bb71945f1c2bfce76a202d
+++ b/shallow.c
@@@ -22,7 -22,7 +22,7 @@@ void set_alternate_shallow_file(const c
        if (alternate_shallow_file && !override)
                return;
        free(alternate_shallow_file);
 -      alternate_shallow_file = path ? xstrdup(path) : NULL;
 +      alternate_shallow_file = xstrdup_or_null(path);
  }
  
  int register_shallow(const unsigned char *sha1)
@@@ -137,7 -137,7 +137,7 @@@ struct commit_list *get_shallow_commits
        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");