aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-18 14:37:46 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-18 14:37:46 -0700
commit06e211acc61c52a2e1709ea8b62a0b0f6dcb492b (patch)
treef69ccce2499e864ed3c0a6c71c7aec4b5d3a61f6
parent8db3865936550fe239b11a44ed52230c3c3eb223 (diff)
parent250f2492a408be1ed79c563f304a0d43752d032c (diff)
downloadgit-06e211acc61c52a2e1709ea8b62a0b0f6dcb492b.tar.gz
git-06e211acc61c52a2e1709ea8b62a0b0f6dcb492b.tar.xz
Merge branch 'jc/make-static'
Turn many file-scope private symbols to static to reduce the global namespace contamination. * jc/make-static: sequencer.c: mark a private file-scope symbol as static ident.c: mark private file-scope symbols as static trace.c: mark a private file-scope symbol as static wt-status.c: mark a private file-scope symbol as static read-cache.c: mark a private file-scope symbol as static strbuf.c: mark a private file-scope symbol as static sha1-array.c: mark a private file-scope symbol as static symlinks.c: mark private file-scope symbols as static notes.c: mark a private file-scope symbol as static rerere.c: mark private file-scope symbols as static graph.c: mark private file-scope symbols as static diff.c: mark a private file-scope symbol as static commit.c: mark a file-scope private symbol as static builtin/notes.c: mark file-scope private symbols as static
-rw-r--r--Documentation/technical/api-sha1-array.txt3
-rw-r--r--builtin.h2
-rw-r--r--builtin/notes.c7
-rw-r--r--cache.h6
-rw-r--r--commit.c7
-rw-r--r--commit.h1
-rw-r--r--diff.c2
-rw-r--r--diff.h1
-rw-r--r--graph.c32
-rw-r--r--graph.h27
-rw-r--r--ident.c4
-rw-r--r--notes.c14
-rw-r--r--notes.h14
-rw-r--r--read-cache.c2
-rw-r--r--rerere.c2
-rw-r--r--rerere.h1
-rw-r--r--sequencer.c2
-rw-r--r--sequencer.h3
-rw-r--r--sha1-array.c2
-rw-r--r--sha1-array.h1
-rw-r--r--strbuf.c13
-rw-r--r--strbuf.h4
-rw-r--r--symlinks.c7
-rw-r--r--trace.c2
-rw-r--r--wt-status.c4
-rw-r--r--wt-status.h2
26 files changed, 69 insertions, 96 deletions
diff --git a/Documentation/technical/api-sha1-array.txt b/Documentation/technical/api-sha1-array.txt
index 4a4bae810..45d1c517c 100644
--- a/Documentation/technical/api-sha1-array.txt
+++ b/Documentation/technical/api-sha1-array.txt
@@ -25,9 +25,6 @@ Functions
the array (but note that some operations below may lose this
ordering).
-`sha1_array_sort`::
- Sort the elements in the array.
-
`sha1_array_lookup`::
Perform a binary search of the array for a specific sha1.
If found, returns the offset (in number of elements) of the
diff --git a/builtin.h b/builtin.h
index 8e377522f..95116b853 100644
--- a/builtin.h
+++ b/builtin.h
@@ -21,7 +21,6 @@ struct fmt_merge_msg_opts {
extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
struct fmt_merge_msg_opts *);
-extern void commit_notes(struct notes_tree *t, const char *msg);
struct notes_rewrite_cfg {
struct notes_tree **trees;
@@ -33,7 +32,6 @@ struct notes_rewrite_cfg {
int mode_from_env;
};
-combine_notes_fn parse_combine_notes_fn(const char *v);
struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
const unsigned char *from_obj, const unsigned char *to_obj);
diff --git a/builtin/notes.c b/builtin/notes.c
index 554c80167..453457adb 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -19,6 +19,9 @@
#include "string-list.h"
#include "notes-merge.h"
+static void commit_notes(struct notes_tree *t, const char *msg);
+static combine_notes_fn parse_combine_notes_fn(const char *v);
+
static const char * const git_notes_usage[] = {
N_("git notes [--ref <notes_ref>] [list [<object>]]"),
N_("git notes [--ref <notes_ref>] add [-f] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
@@ -288,7 +291,7 @@ static int parse_reedit_arg(const struct option *opt, const char *arg, int unset
return parse_reuse_arg(opt, arg, unset);
}
-void commit_notes(struct notes_tree *t, const char *msg)
+static void commit_notes(struct notes_tree *t, const char *msg)
{
struct strbuf buf = STRBUF_INIT;
unsigned char commit_sha1[20];
@@ -312,7 +315,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
strbuf_release(&buf);
}
-combine_notes_fn parse_combine_notes_fn(const char *v)
+static combine_notes_fn parse_combine_notes_fn(const char *v)
{
if (!strcasecmp(v, "overwrite"))
return combine_notes_overwrite;
diff --git a/cache.h b/cache.h
index eb4a0316d..a58df84bd 100644
--- a/cache.h
+++ b/cache.h
@@ -442,7 +442,6 @@ extern int discard_index(struct index_state *);
extern int unmerged_index(const struct index_state *);
extern int verify_path(const char *path);
extern struct cache_entry *index_name_exists(struct index_state *istate, const char *name, int namelen, int igncase);
-extern int index_name_stage_pos(const struct index_state *, const char *name, int namelen, int stage);
extern int index_name_pos(const struct index_state *, const char *name, int namelen);
#define ADD_CACHE_OK_TO_ADD 1 /* Ok to add */
#define ADD_CACHE_OK_TO_REPLACE 2 /* Ok to replace file/directory */
@@ -902,9 +901,7 @@ extern const char *git_author_info(int);
extern const char *git_committer_info(int);
extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int);
extern const char *fmt_name(const char *name, const char *email);
-extern const char *ident_default_name(void);
extern const char *ident_default_email(void);
-extern const char *ident_default_date(void);
extern const char *git_editor(void);
extern const char *git_pager(int stdout_is_tty);
extern int git_ident_config(const char *, const char *, void *);
@@ -947,9 +944,7 @@ struct cache_def {
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 check_leading_path(const char *name, int len);
-extern int threaded_check_leading_path(struct cache_def *cache, const char *name, int len);
extern int has_dirs_only_path(const char *name, int len, int prefix_len);
-extern int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len);
extern void schedule_dir_for_removal(const char *name, int len);
extern void remove_scheduled_dirs(void);
@@ -1208,7 +1203,6 @@ extern void alloc_report(void);
/* trace.c */
__attribute__((format (printf, 1, 2)))
extern void trace_printf(const char *format, ...);
-extern void trace_vprintf(const char *key, const char *format, va_list ap);
__attribute__((format (printf, 2, 3)))
extern void trace_argv_printf(const char **argv, const char *format, ...);
extern void trace_repo_setup(const char *prefix);
diff --git a/commit.c b/commit.c
index 0ea441d13..02467676a 100644
--- a/commit.c
+++ b/commit.c
@@ -9,6 +9,8 @@
#include "gpg-interface.h"
#include "mergesort.h"
+static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
+
int save_commit_buffer = 1;
const char *commit_type = "commit";
@@ -1073,8 +1075,9 @@ static int excluded_header_field(const char *field, size_t len, const char **exc
return 0;
}
-struct commit_extra_header *read_commit_extra_header_lines(const char *buffer, size_t size,
- const char **exclude)
+static struct commit_extra_header *read_commit_extra_header_lines(
+ const char *buffer, size_t size,
+ const char **exclude)
{
struct commit_extra_header *extra = NULL, **tail = &extra, *it = NULL;
const char *line, *next, *eof, *eob;
diff --git a/commit.h b/commit.h
index 6edce8767..9f2131318 100644
--- a/commit.h
+++ b/commit.h
@@ -204,7 +204,6 @@ extern int commit_tree_extended(const struct strbuf *msg, unsigned char *tree,
struct commit_extra_header *);
extern struct commit_extra_header *read_commit_extra_headers(struct commit *, const char **);
-extern struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
extern void free_commit_extra_headers(struct commit_extra_header *extra);
diff --git a/diff.c b/diff.c
index 32142dba6..35d3f0738 100644
--- a/diff.c
+++ b/diff.c
@@ -25,7 +25,7 @@
static int diff_detect_rename_default;
static int diff_rename_limit_default = 400;
static int diff_suppress_blank_empty;
-int diff_use_color_default = -1;
+static int diff_use_color_default = -1;
static const char *diff_word_regex_cfg;
static const char *external_diff_cmd_cfg;
int diff_auto_refresh_index = 1;
diff --git a/diff.h b/diff.h
index e25addb80..a658f85f2 100644
--- a/diff.h
+++ b/diff.h
@@ -243,7 +243,6 @@ extern int parse_long_opt(const char *opt, const char **argv,
extern int git_diff_basic_config(const char *var, const char *value, void *cb);
extern int git_diff_ui_config(const char *var, const char *value, void *cb);
-extern int diff_use_color_default;
extern void diff_setup(struct diff_options *);
extern int diff_opt_parse(struct diff_options *, const char **, int);
extern void diff_setup_done(struct diff_options *);
diff --git a/graph.c b/graph.c
index 7e0a099f8..e864fe2c6 100644
--- a/graph.c
+++ b/graph.c
@@ -8,6 +8,34 @@
/* Internal API */
/*
+ * Output the next line for a graph.
+ * This formats the next graph line into the specified strbuf. It is not
+ * terminated with a newline.
+ *
+ * Returns 1 if the line includes the current commit, and 0 otherwise.
+ * graph_next_line() will return 1 exactly once for each time
+ * graph_update() is called.
+ */
+static int graph_next_line(struct git_graph *graph, struct strbuf *sb);
+
+/*
+ * Set up a custom scheme for column colors.
+ *
+ * The default column color scheme inserts ANSI color escapes to colorize
+ * the graph. The various color escapes are stored in an array of strings
+ * where each entry corresponds to a color, except for the last entry,
+ * which denotes the escape for resetting the color back to the default.
+ * When generating the graph, strings from this array are inserted before
+ * and after the various column characters.
+ *
+ * This function allows you to enable a custom array of color escapes.
+ * The 'colors_max' argument is the index of the last "reset" entry.
+ *
+ * This functions must be called BEFORE graph_init() is called.
+ */
+static void graph_set_column_colors(const char **colors, unsigned short colors_max);
+
+/*
* Output a padding line in the graph.
* This is similar to graph_next_line(). However, it is guaranteed to
* never print the current commit line. Instead, if the commit line is
@@ -62,7 +90,7 @@ enum graph_state {
static const char **column_colors;
static unsigned short column_colors_max;
-void graph_set_column_colors(const char **colors, unsigned short colors_max)
+static void graph_set_column_colors(const char **colors, unsigned short colors_max)
{
column_colors = colors;
column_colors_max = colors_max;
@@ -1116,7 +1144,7 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf
graph_update_state(graph, GRAPH_PADDING);
}
-int graph_next_line(struct git_graph *graph, struct strbuf *sb)
+static int graph_next_line(struct git_graph *graph, struct strbuf *sb)
{
switch (graph->state) {
case GRAPH_PADDING:
diff --git a/graph.h b/graph.h
index aff960c7e..19b0f6631 100644
--- a/graph.h
+++ b/graph.h
@@ -4,22 +4,6 @@
/* A graph is a pointer to this opaque structure */
struct git_graph;
-/*
- * Set up a custom scheme for column colors.
- *
- * The default column color scheme inserts ANSI color escapes to colorize
- * the graph. The various color escapes are stored in an array of strings
- * where each entry corresponds to a color, except for the last entry,
- * which denotes the escape for resetting the color back to the default.
- * When generating the graph, strings from this array are inserted before
- * and after the various column characters.
- *
- * This function allows you to enable a custom array of color escapes.
- * The 'colors_max' argument is the index of the last "reset" entry.
- *
- * This functions must be called BEFORE graph_init() is called.
- */
-void graph_set_column_colors(const char **colors, unsigned short colors_max);
/*
* Create a new struct git_graph.
@@ -49,17 +33,6 @@ void graph_update(struct git_graph *graph, struct commit *commit);
*/
int graph_is_commit_finished(struct git_graph const *graph);
-/*
- * Output the next line for a graph.
- * This formats the next graph line into the specified strbuf. It is not
- * terminated with a newline.
- *
- * Returns 1 if the line includes the current commit, and 0 otherwise.
- * graph_next_line() will return 1 exactly once for each time
- * graph_update() is called.
- */
-int graph_next_line(struct git_graph *graph, struct strbuf *sb);
-
/*
* graph_show_*: helper functions for printing to stdout
diff --git a/ident.c b/ident.c
index 484e0a980..a4bf206e2 100644
--- a/ident.c
+++ b/ident.c
@@ -93,7 +93,7 @@ static void copy_email(const struct passwd *pw, struct strbuf *email)
add_domainname(email);
}
-const char *ident_default_name(void)
+static const char *ident_default_name(void)
{
if (!git_default_name.len) {
copy_gecos(xgetpwuid_self(), &git_default_name);
@@ -117,7 +117,7 @@ const char *ident_default_email(void)
return git_default_email.buf;
}
-const char *ident_default_date(void)
+static const char *ident_default_date(void)
{
if (!git_default_date[0])
datestamp(git_default_date, sizeof(git_default_date));
diff --git a/notes.c b/notes.c
index 93e9868d5..bc454e1ea 100644
--- a/notes.c
+++ b/notes.c
@@ -1196,8 +1196,18 @@ void free_notes(struct notes_tree *t)
memset(t, 0, sizeof(struct notes_tree));
}
-void format_note(struct notes_tree *t, const unsigned char *object_sha1,
- struct strbuf *sb, const char *output_encoding, int flags)
+/*
+ * Fill the given strbuf with the notes associated with the given object.
+ *
+ * If the given notes_tree structure is not initialized, it will be auto-
+ * initialized to the default value (see documentation for init_notes() above).
+ * If the given notes_tree is NULL, the internal/default notes_tree will be
+ * used instead.
+ *
+ * 'flags' is a bitwise combination of the flags for format_display_notes.
+ */
+static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
+ struct strbuf *sb, const char *output_encoding, int flags)
{
static const char utf8[] = "utf-8";
const unsigned char *sha1;
diff --git a/notes.h b/notes.h
index c716694b9..3592b19d2 100644
--- a/notes.h
+++ b/notes.h
@@ -241,20 +241,6 @@ void free_notes(struct notes_tree *t);
#define NOTES_SHOW_HEADER 1
#define NOTES_INDENT 2
-/*
- * Fill the given strbuf with the notes associated with the given object.
- *
- * If the given notes_tree structure is not initialized, it will be auto-
- * initialized to the default value (see documentation for init_notes() above).
- * If the given notes_tree is NULL, the internal/default notes_tree will be
- * used instead.
- *
- * 'flags' is a bitwise combination of the above formatting flags.
- */
-void format_note(struct notes_tree *t, const unsigned char *object_sha1,
- struct strbuf *sb, const char *output_encoding, int flags);
-
-
struct string_list;
struct display_notes_opt {
diff --git a/read-cache.c b/read-cache.c
index 79e3bbe02..fda78bc35 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -424,7 +424,7 @@ int cache_name_compare(const char *name1, int len1, const char *name2, int len2)
return cache_name_stage_compare(name1, len1, 0, name2, len2, 0);
}
-int index_name_stage_pos(const struct index_state *istate, const char *name, int namelen, int stage)
+static int index_name_stage_pos(const struct index_state *istate, const char *name, int namelen, int stage)
{
int first, last;
diff --git a/rerere.c b/rerere.c
index b57a34daa..a6a5cd57b 100644
--- a/rerere.c
+++ b/rerere.c
@@ -25,7 +25,7 @@ const char *rerere_path(const char *hex, const char *file)
return git_path("rr-cache/%s/%s", hex, file);
}
-int has_rerere_resolution(const char *hex)
+static int has_rerere_resolution(const char *hex)
{
struct stat st;
return !stat(rerere_path(hex, "postimage"), &st);
diff --git a/rerere.h b/rerere.h
index fcd8bc10b..156d2aad8 100644
--- a/rerere.h
+++ b/rerere.h
@@ -16,7 +16,6 @@ extern void *RERERE_RESOLVED;
extern int setup_rerere(struct string_list *, int);
extern int rerere(int);
extern const char *rerere_path(const char *hex, const char *file);
-extern int has_rerere_resolution(const char *hex);
extern int rerere_forget(const char **);
extern int rerere_remaining(struct string_list *);
extern void rerere_clear(struct string_list *);
diff --git a/sequencer.c b/sequencer.c
index dbef5cea0..e3723d209 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -19,7 +19,7 @@
const char sign_off_header[] = "Signed-off-by: ";
-void remove_sequencer_state(void)
+static void remove_sequencer_state(void)
{
struct strbuf seq_dir = STRBUF_INIT;
diff --git a/sequencer.h b/sequencer.h
index 60287b8da..9d57d5752 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -44,9 +44,6 @@ struct replay_opts {
struct rev_info *revs;
};
-/* Removes SEQ_DIR. */
-extern void remove_sequencer_state(void);
-
int sequencer_pick_revisions(struct replay_opts *opts);
extern const char sign_off_header[];
diff --git a/sha1-array.c b/sha1-array.c
index b2f47f98f..6f4a2246c 100644
--- a/sha1-array.c
+++ b/sha1-array.c
@@ -14,7 +14,7 @@ static int void_hashcmp(const void *a, const void *b)
return hashcmp(a, b);
}
-void sha1_array_sort(struct sha1_array *array)
+static void sha1_array_sort(struct sha1_array *array)
{
qsort(array->sha1, array->nr, sizeof(*array->sha1), void_hashcmp);
array->sorted = 1;
diff --git a/sha1-array.h b/sha1-array.h
index 4499b5dad..72bb33bec 100644
--- a/sha1-array.h
+++ b/sha1-array.h
@@ -11,7 +11,6 @@ struct sha1_array {
#define SHA1_ARRAY_INIT { NULL, 0, 0, 0 }
void sha1_array_append(struct sha1_array *array, const unsigned char *sha1);
-void sha1_array_sort(struct sha1_array *array);
int sha1_array_lookup(struct sha1_array *array, const unsigned char *sha1);
void sha1_array_clear(struct sha1_array *array);
diff --git a/strbuf.c b/strbuf.c
index ec8826671..0510f76c2 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -445,8 +445,8 @@ static int is_rfc3986_unreserved(char ch)
ch == '-' || ch == '_' || ch == '.' || ch == '~';
}
-void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
- int reserved)
+static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
+ int reserved)
{
strbuf_grow(sb, len);
while (len--) {
@@ -465,15 +465,6 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
strbuf_add_urlencode(sb, s, strlen(s), reserved);
}
-void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- strbuf_vaddf(sb, fmt, ap);
- va_end(ap);
- strbuf_addch(sb, '\n');
-}
-
int printf_ln(const char *fmt, ...)
{
int ret;
diff --git a/strbuf.h b/strbuf.h
index b888d405d..be941ee48 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -99,8 +99,6 @@ __attribute__((format (printf,2,3)))
extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
__attribute__((format (printf,2,0)))
extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);
-__attribute__((format (printf,2,3)))
-extern void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...);
extern void strbuf_add_lines(struct strbuf *sb, const char *prefix, const char *buf, size_t size);
@@ -126,8 +124,6 @@ extern int launch_editor(const char *path, struct strbuf *buffer, const char *co
extern int strbuf_branchname(struct strbuf *sb, const char *name);
extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
-extern void strbuf_add_urlencode(struct strbuf *, const char *, size_t,
- int reserved);
extern void strbuf_addstr_urlencode(struct strbuf *, const char *,
int reserved);
diff --git a/symlinks.c b/symlinks.c
index 290036744..c2b41a850 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -1,5 +1,8 @@
#include "cache.h"
+static int threaded_check_leading_path(struct cache_def *cache, const char *name, int len);
+static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len);
+
/*
* Returns the length (on a path component basis) of the longest
* common prefix match of 'name_a' and 'name_b'.
@@ -231,7 +234,7 @@ int check_leading_path(const char *name, int len)
* Return path length if leading path exists and is neither a
* directory nor a symlink.
*/
-int threaded_check_leading_path(struct cache_def *cache, const char *name, int len)
+static int threaded_check_leading_path(struct cache_def *cache, const char *name, int len)
{
int flags;
int match_len = lstat_cache_matchlen(cache, name, len, &flags,
@@ -263,7 +266,7 @@ int has_dirs_only_path(const char *name, int len, int prefix_len)
* 'prefix_len', thus we then allow for symlinks in the prefix part as
* long as those points to real existing directories.
*/
-int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len)
+static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len)
{
return lstat_cache(cache, name, len,
FL_DIR|FL_FULLPATH, prefix_len) &
diff --git a/trace.c b/trace.c
index d95341693..5ec0e3bd1 100644
--- a/trace.c
+++ b/trace.c
@@ -62,7 +62,7 @@ static int get_trace_fd(const char *key, int *need_close)
static const char err_msg[] = "Could not trace into fd given by "
"GIT_TRACE environment variable";
-void trace_vprintf(const char *key, const char *fmt, va_list ap)
+static void trace_vprintf(const char *key, const char *fmt, va_list ap)
{
struct strbuf buf = STRBUF_INIT;
diff --git a/wt-status.c b/wt-status.c
index 4eeaf2396..2a9658bad 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -100,8 +100,8 @@ void status_printf(struct wt_status *s, const char *color,
va_end(ap);
}
-void status_printf_more(struct wt_status *s, const char *color,
- const char *fmt, ...)
+static void status_printf_more(struct wt_status *s, const char *color,
+ const char *fmt, ...)
{
va_list ap;
diff --git a/wt-status.h b/wt-status.h
index f8fc58cc0..236b41fd3 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -92,7 +92,5 @@ void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, .
;
void status_printf(struct wt_status *s, const char *color, const char *fmt, ...)
;
-void status_printf_more(struct wt_status *s, const char *color, const char *fmt, ...)
- __attribute__((format(printf, 3, 4)));
#endif /* STATUS_H */