Code

Merge branch 'jc/symbol-static'
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 Jan 2010 22:37:25 +0000 (14:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Jan 2010 22:37:25 +0000 (14:37 -0800)
* jc/symbol-static:
  date.c: mark file-local function static
  Replace parse_blob() with an explanatory comment
  symlinks.c: remove unused functions
  object.c: remove unused functions
  strbuf.c: remove unused function
  sha1_file.c: remove unused function
  mailmap.c: remove unused function
  utf8.c: mark file-local function static
  submodule.c: mark file-local function static
  quote.c: mark file-local function static
  remote-curl.c: mark file-local function static
  read-cache.c: mark file-local functions static
  parse-options.c: mark file-local function static
  entry.c: mark file-local function static
  http.c: mark file-local functions static
  pretty.c: mark file-local function static
  builtin-rev-list.c: mark file-local function static
  bisect.c: mark file-local function static

30 files changed:
bisect.c
bisect.h
blob.c
blob.h
builtin-rev-list.c
cache.h
commit.h
date.c
entry.c
git-compat-util.h
http.c
http.h
mailmap.c
mailmap.h
object.c
object.h
parse-options.c
parse-options.h
pretty.c
quote.c
quote.h
read-cache.c
remote-curl.c
sha1_file.c
strbuf.c
strbuf.h
submodule.c
symlinks.c
utf8.c
utf8.h

index 3d04d2a0bb1d3e2cc59d0747c838ba3f981a0b54..6dc27ee7a6090e56d5b0f2072a72553d3b3e3b87 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -593,7 +593,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
  * is increased by one between each call, but that should not matter
  * for this application.
  */
-int get_prn(int count) {
+static int get_prn(int count) {
        count = count * 1103515245 + 12345;
        return ((unsigned)(count/65536) % PRN_MODULO);
 }
index 82f8fc1910a42c5c90ad3312d9aa8f35ef2b992f..0862ce56d76e9b08ab913e6a472fac590974340e 100644 (file)
--- a/bisect.h
+++ b/bisect.h
@@ -27,8 +27,6 @@ struct rev_list_info {
        const char *header_prefix;
 };
 
-extern int show_bisect_vars(struct rev_list_info *info, int reaches, int all);
-
 extern int bisect_next_all(const char *prefix);
 
 extern int estimate_bisect_steps(int all);
diff --git a/blob.c b/blob.c
index bd7d078e1ae5fe4ce0a16fda62a2c1743237941b..ae320bd8fa22aaaef8144bd6bc35c20d1e85e4f4 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -23,24 +23,3 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
        item->object.parsed = 1;
        return 0;
 }
-
-int parse_blob(struct blob *item)
-{
-        enum object_type type;
-        void *buffer;
-        unsigned long size;
-       int ret;
-
-        if (item->object.parsed)
-                return 0;
-        buffer = read_sha1_file(item->object.sha1, &type, &size);
-        if (!buffer)
-                return error("Could not read %s",
-                             sha1_to_hex(item->object.sha1));
-        if (type != OBJ_BLOB)
-                return error("Object %s not a blob",
-                             sha1_to_hex(item->object.sha1));
-       ret = parse_blob_buffer(item, buffer, size);
-       free(buffer);
-       return ret;
-}
diff --git a/blob.h b/blob.h
index ea5d9e9f8b63be2c7048d19ee53feb06b0795c80..59b394eea38494d5dfa525e28ca949e5a03efcf5 100644 (file)
--- a/blob.h
+++ b/blob.h
@@ -13,6 +13,13 @@ struct blob *lookup_blob(const unsigned char *sha1);
 
 int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
 
-int parse_blob(struct blob *item);
+/**
+ * Blobs do not contain references to other objects and do not have
+ * structured data that needs parsing. However, code may use the
+ * "parsed" bit in the struct object for a blob to determine whether
+ * its content has been found to actually be available, so
+ * parse_blob_buffer() is used (by object.c) to flag that the object
+ * has been read successfully from the database.
+ **/
 
 #endif /* BLOB_H */
index cd97ded4d249b3beb5179150a283e8be43b9ba44..c924b3a2c76c1f9a7f5531504825ed1b5456d41a 100644 (file)
@@ -253,7 +253,7 @@ static void print_var_int(const char *var, int val)
        printf("%s=%d\n", var, val);
 }
 
-int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
+static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
 {
        int cnt, flags = info->bisect_show_flags;
        char hex[41] = "";
diff --git a/cache.h b/cache.h
index cf36c8160e8027aa608da4baf59e2d9f04f0ccdd..caeafb229245afe5be081684094ef81f6a6a8b6b 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -451,7 +451,6 @@ extern int index_name_pos(const struct index_state *, const char *name, int name
 #define ADD_CACHE_JUST_APPEND 8                /* Append only; tree.c::read_tree() */
 #define ADD_CACHE_NEW_ONLY 16          /* Do not replace existing ones */
 extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
-extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
 extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
 extern int remove_index_entry_at(struct index_state *, int pos);
 extern void remove_marked_cache_entries(struct index_state *istate);
@@ -481,9 +480,6 @@ extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_obje
 extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
 extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
 
-/* "careful lstat()" */
-extern int check_path(const char *path, int len, struct stat *st, int skiplen);
-
 #define REFRESH_REALLY         0x0001  /* ignore_valid */
 #define REFRESH_UNMERGED       0x0002  /* allow unmerged */
 #define REFRESH_QUIET          0x0004  /* be quiet about it */
@@ -627,7 +623,6 @@ static inline void hashclr(unsigned char *hash)
 {
        memset(hash, 0, 20);
 }
-extern int is_empty_blob_sha1(const unsigned char *sha1);
 
 #define EMPTY_TREE_SHA1_HEX \
        "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
@@ -697,7 +692,6 @@ extern int has_sha1_pack(const unsigned char *sha1);
 extern int has_sha1_file(const unsigned char *sha1);
 extern int has_loose_object_nonlocal(const unsigned char *sha1);
 
-extern int has_pack_file(const unsigned char *sha1);
 extern int has_pack_index(const unsigned char *sha1);
 
 extern const signed char hexval_table[256];
@@ -798,8 +792,6 @@ extern int has_symlink_leading_path(const char *name, int len);
 extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
 extern int has_symlink_or_noent_leading_path(const char *name, int len);
 extern int has_dirs_only_path(const char *name, int len, int prefix_len);
-extern void invalidate_lstat_cache(const char *name, int len);
-extern void clear_lstat_cache(void);
 extern void schedule_dir_for_removal(const char *name, int len);
 extern void remove_scheduled_dirs(void);
 
index e5332efcfc9449e0f3af4d6c49be63adfeb138b1..24128d7a2a0007d5aee2543624f0297d77860ea6 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -73,7 +73,6 @@ struct pretty_print_context
        struct reflog_walk_info *reflog_info;
 };
 
-extern int non_ascii(int);
 extern int has_non_ascii(const char *text);
 struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
 extern char *reencode_commit_message(const struct commit *commit,
diff --git a/date.c b/date.c
index 5d05ef61cfb140f004702a5ed614afa755c50670..45f3684ceee465170a520ecf5f25dcaa0e5ed84e 100644 (file)
--- a/date.c
+++ b/date.c
@@ -9,7 +9,7 @@
 /*
  * This is like mktime, but without normalization of tm_wday and tm_yday.
  */
-time_t tm_to_time_t(const struct tm *tm)
+static time_t tm_to_time_t(const struct tm *tm)
 {
        static const int mdays[] = {
            0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
diff --git a/entry.c b/entry.c
index 9d5b232781c6760930c354c1792ad6b924f8a72d..004182c99d27a6a5825d2429f9104fc7a8f1dc80 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -179,7 +179,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
  * This is like 'lstat()', except it refuses to follow symlinks
  * in the path, after skipping "skiplen".
  */
-int check_path(const char *path, int len, struct stat *st, int skiplen)
+static int check_path(const char *path, int len, struct stat *st, int skiplen)
 {
        const char *slash = path + len;
 
index a979e41c15e90a07323cef04dbd05b82f1aa4b15..60c8432f854f345b77b469d64dd1429cee74d30d 100644 (file)
@@ -199,7 +199,6 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
 
 extern int prefixcmp(const char *str, const char *prefix);
-extern time_t tm_to_time_t(const struct tm *tm);
 
 static inline const char *skip_prefix(const char *str, const char *prefix)
 {
diff --git a/http.c b/http.c
index 5c3efb96d92be775b1ab2debed2920363bbe7355..deab59551dad9a0d2c2e86d75071fa561e4cbf1a 100644 (file)
--- a/http.c
+++ b/http.c
@@ -651,7 +651,7 @@ static void closedown_active_slot(struct active_request_slot *slot)
        slot->in_use = 0;
 }
 
-void release_active_slot(struct active_request_slot *slot)
+static void release_active_slot(struct active_request_slot *slot)
 {
        closedown_active_slot(slot);
        if (slot->curl && curl_session_count > min_curl_sessions) {
@@ -834,7 +834,13 @@ int http_get_strbuf(const char *url, struct strbuf *result, int options)
        return http_request(url, result, HTTP_REQUEST_STRBUF, options);
 }
 
-int http_get_file(const char *url, const char *filename, int options)
+/*
+ * Downloads an url and stores the result in the given file.
+ *
+ * If a previous interrupted download is detected (i.e. a previous temporary
+ * file is still around) the download is resumed.
+ */
+static int http_get_file(const char *url, const char *filename, int options)
 {
        int ret;
        struct strbuf tmpfile = STRBUF_INIT;
diff --git a/http.h b/http.h
index f828e1d8067aeff3036c14a1c43e333902e46bd6..5c9441c10ce708be426afe7424d63dcbb68a49e2 100644 (file)
--- a/http.h
+++ b/http.h
@@ -81,7 +81,6 @@ 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 void release_active_slot(struct active_request_slot *slot);
 
 #ifdef USE_CURL_MULTI
 extern void fill_active_slots(void);
@@ -135,14 +134,6 @@ extern char *get_remote_object_url(const char *url, const char *hex,
  */
 int http_get_strbuf(const char *url, struct strbuf *result, int options);
 
-/*
- * Downloads an url and stores the result in the given file.
- *
- * If a previous interrupted download is detected (i.e. a previous temporary
- * file is still around) the download is resumed.
- */
-int http_get_file(const char *url, const char *filename, int options);
-
 /*
  * Prints an error message using error() containing url and curl_errorstr,
  * and returns ret.
index f167c005bf9039f44d21ef5f32ab27db7784d642..b68c1fec9c2ca69f313bc3fa16461c6c9150c53d 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
@@ -243,8 +243,3 @@ int map_user(struct string_list *map,
        debug_mm("map_user:  --\n");
        return 0;
 }
-
-int map_email(struct string_list *map, const char *email, char *name, int maxlen)
-{
-       return map_user(map, (char *)email, 0, name, maxlen);
-}
index 4b2ca3a7de972c10f214b38a25be522abcbbafd0..d5c3664322023d6552cb24006d833aa08224ff6f 100644 (file)
--- a/mailmap.h
+++ b/mailmap.h
@@ -4,7 +4,6 @@
 int read_mailmap(struct string_list *map, char **repo_abbrev);
 void clear_mailmap(struct string_list *map);
 
-int map_email(struct string_list *mailmap, const char *email, char *name, int maxlen);
 int map_user(struct string_list *mailmap,
             char *email, int maxlen_email, char *name, int maxlen_name);
 
index fe8eaaf19f71b48d9acba83594d918fc4875f5c4..3ca92c4c4def46af10556dbe9b3f48774b9a4a35 100644 (file)
--- a/object.c
+++ b/object.c
@@ -217,27 +217,6 @@ struct object_list *object_list_insert(struct object *item,
         return new_list;
 }
 
-void object_list_append(struct object *item,
-                       struct object_list **list_p)
-{
-       while (*list_p) {
-               list_p = &((*list_p)->next);
-       }
-       *list_p = xmalloc(sizeof(struct object_list));
-       (*list_p)->next = NULL;
-       (*list_p)->item = item;
-}
-
-unsigned object_list_length(struct object_list *list)
-{
-       unsigned ret = 0;
-       while (list) {
-               list = list->next;
-               ret++;
-       }
-       return ret;
-}
-
 int object_list_contains(struct object_list *list, struct object *obj)
 {
        while (list) {
index 89dd0c47a6c86fd3a63370c84e574e799830e1d3..82877c831ca7fe39abbb98805f5801bdc6fcac9c 100644 (file)
--- a/object.h
+++ b/object.h
@@ -72,11 +72,6 @@ struct object *lookup_unknown_object(const unsigned  char *sha1);
 struct object_list *object_list_insert(struct object *item,
                                       struct object_list **list_p);
 
-void object_list_append(struct object *item,
-                       struct object_list **list_p);
-
-unsigned object_list_length(struct object_list *list);
-
 int object_list_contains(struct object_list *list, struct object *obj);
 
 /* Object array handling .. */
index 10ec21fb89788e19e6d8d99b29da9801bb406dd3..d218122af5c2c0cddd857fce0ae5064bf32f6387 100644 (file)
@@ -3,6 +3,9 @@
 #include "cache.h"
 #include "commit.h"
 
+static int parse_options_usage(const char * const *usagestr,
+                              const struct option *opts);
+
 #define OPT_SHORT 1
 #define OPT_UNSET 2
 
@@ -560,8 +563,8 @@ void usage_msg_opt(const char *msg,
        usage_with_options(usagestr, options);
 }
 
-int parse_options_usage(const char * const *usagestr,
-                       const struct option *opts)
+static int parse_options_usage(const char * const *usagestr,
+                              const struct option *opts)
 {
        return usage_with_options_internal(usagestr, opts, 0);
 }
index 91c1500661be825fea7b751230e2ac3f8b95fab4..0c996916b6044989f0e2945881c7c12f7292d5c1 100644 (file)
@@ -173,9 +173,6 @@ struct parse_opt_ctx_t {
        const char *prefix;
 };
 
-extern int parse_options_usage(const char * const *usagestr,
-                              const struct option *opts);
-
 extern void parse_options_start(struct parse_opt_ctx_t *ctx,
                                int argc, const char **argv, const char *prefix,
                                int flags);
index 8f5bd1ab7f119715564fb13cb74de3937d1a3774..9001379a9dd93818e962ae73cdf85dc178804256 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -83,7 +83,7 @@ static int get_one_line(const char *msg)
 }
 
 /* High bit set, or ISO-2022-INT */
-int non_ascii(int ch)
+static int non_ascii(int ch)
 {
        return !isascii(ch) || ch == '\033';
 }
diff --git a/quote.c b/quote.c
index 848d174cc56be32483ba6c73f9b06bc398ed6437..acb6bf929f3e5807139fa7852f739e6ff5a50722 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -72,7 +72,7 @@ void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
        }
 }
 
-char *sq_dequote_step(char *arg, char **next)
+static char *sq_dequote_step(char *arg, char **next)
 {
        char *dst = arg;
        char *src = arg;
diff --git a/quote.h b/quote.h
index 66730f2bff3cee42bc7c670e2a6d7da240db1d08..f83eb233c4b153c4c073b3ccd5bf2f5dd926b739 100644 (file)
--- a/quote.h
+++ b/quote.h
@@ -45,7 +45,6 @@ extern char *sq_dequote(char *);
  * next argument that should be passed as first parameter. When there
  * is no more argument to be dequoted, "next" is updated to point to NULL.
  */
-extern char *sq_dequote_step(char *arg, char **next);
 extern int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc);
 
 extern int unquote_c_style(struct strbuf *, const char *quoted, const char **endp);
index d214abab163e30c0328eac0bd9a65749c271d173..f4512967b8393e7934812e667d42a97f4d67ba8c 100644 (file)
@@ -15,6 +15,8 @@
 #include "revision.h"
 #include "blob.h"
 
+static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really);
+
 /* Index extensions.
  *
  * The first letter should be 'A'..'Z' for extensions that are not
@@ -156,7 +158,7 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
        return 0;
 }
 
-int is_empty_blob_sha1(const unsigned char *sha1)
+static int is_empty_blob_sha1(const unsigned char *sha1)
 {
        static const unsigned char empty_blob_sha1[20] = {
                0xe6,0x9d,0xe2,0x9b,0xb2,0xd1,0xd6,0x43,0x4b,0x8b,
@@ -1152,7 +1154,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
        return has_errors;
 }
 
-struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
+static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
 {
        return refresh_cache_ent(&the_index, ce, really, NULL);
 }
index 70fdceade5b0d1f13be2f9f8bba3a310d0af8182..136100695994049f2e9d6357cb25dd5a9d73ae28 100644 (file)
@@ -317,7 +317,7 @@ static size_t rpc_out(void *ptr, size_t eltsize,
 }
 
 #ifndef NO_CURL_IOCTL
-curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
+static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
 {
        struct rpc_state *rpc = clientp;
 
index 63981fb3fd9cfa6cca4126eba5a964b449c62444..7086760dbedac89075f53ebbe1539b6ebbaa9b06 100644 (file)
@@ -2458,14 +2458,6 @@ int has_pack_index(const unsigned char *sha1)
        return 1;
 }
 
-int has_pack_file(const unsigned char *sha1)
-{
-       struct stat st;
-       if (stat(sha1_pack_name(sha1), &st))
-               return 0;
-       return 1;
-}
-
 int has_sha1_pack(const unsigned char *sha1)
 {
        struct pack_entry e;
index a6153dca278abe957254fa091fdcd8eb13b90b25..3fa81b33656a5d2d4887b949fd103920173d37a7 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -91,13 +91,6 @@ void strbuf_ltrim(struct strbuf *sb)
        sb->buf[sb->len] = '\0';
 }
 
-void strbuf_tolower(struct strbuf *sb)
-{
-       int i;
-       for (i = 0; i < sb->len; i++)
-               sb->buf[i] = tolower(sb->buf[i]);
-}
-
 struct strbuf **strbuf_split(const struct strbuf *sb, int delim)
 {
        int alloc = 2, pos = 0;
index fa07ecf094bd3ef8997958fde29199f8fb6421b9..b37f06a34b75a14dccf99a034b683f702cb4724e 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -81,7 +81,6 @@ extern void strbuf_trim(struct strbuf *);
 extern void strbuf_rtrim(struct strbuf *);
 extern void strbuf_ltrim(struct strbuf *);
 extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
-extern void strbuf_tolower(struct strbuf *);
 
 extern struct strbuf **strbuf_split(const struct strbuf *, int delim);
 extern void strbuf_list_free(struct strbuf **);
index 86aad653b7c113106e365a9d4e4c38b3e7737457..3007f7d5a6279c14a7c29efdc752dbbc41218c76 100644 (file)
@@ -5,7 +5,7 @@
 #include "commit.h"
 #include "revision.h"
 
-int add_submodule_odb(const char *path)
+static int add_submodule_odb(const char *path)
 {
        struct strbuf objects_directory = STRBUF_INIT;
        struct alternate_object_database *alt_odb;
index 7b0a86d35776e8695423c13403c9f4fa3465017d..88601200114f857a57214a9bf0d02ffd39a83504 100644 (file)
@@ -179,37 +179,6 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
        return ret_flags;
 }
 
-/*
- * Invalidate the given 'name' from the cache, if 'name' matches
- * completely with the cache.
- */
-void invalidate_lstat_cache(const char *name, int len)
-{
-       int match_len, previous_slash;
-       struct cache_def *cache = &default_cache;       /* FIXME */
-
-       match_len = longest_path_match(name, len, cache->path, cache->len,
-                                      &previous_slash);
-       if (len == match_len) {
-               if ((cache->track_flags & FL_DIR) && previous_slash > 0) {
-                       cache->path[previous_slash] = '\0';
-                       cache->len = previous_slash;
-                       cache->flags = FL_DIR;
-               } else {
-                       reset_lstat_cache(cache);
-               }
-       }
-}
-
-/*
- * Completely clear the contents of the cache
- */
-void clear_lstat_cache(void)
-{
-       struct cache_def *cache = &default_cache;       /* FIXME */
-       reset_lstat_cache(cache);
-}
-
 #define USE_ONLY_LSTAT  0
 
 /*
diff --git a/utf8.c b/utf8.c
index 7ddff23fa77fbadf7723bca03d24ad5b8f2baca2..ab326ac83e0d9e81b06abff58b00a98341adcd36 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -163,7 +163,7 @@ static int git_wcwidth(ucs_char_t ch)
  * If the string was not a valid UTF-8, *start pointer is set to NULL
  * and the return value is undefined.
  */
-ucs_char_t pick_one_utf8_char(const char **start, size_t *remainder_p)
+static ucs_char_t pick_one_utf8_char(const char **start, size_t *remainder_p)
 {
        unsigned char *s = (unsigned char *)*start;
        ucs_char_t ch;
diff --git a/utf8.h b/utf8.h
index ae30ae4c6e501e4766db93c94253fd404cd29357..c9738d83d991d89bbdd4c5a6442fcad2fdaaa4df 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -3,7 +3,6 @@
 
 typedef unsigned int ucs_char_t;  /* assuming 32bit int */
 
-ucs_char_t pick_one_utf8_char(const char **start, size_t *remainder_p);
 int utf8_width(const char **start, size_t *remainder_p);
 int utf8_strwidth(const char *string);
 int is_utf8(const char *text);