diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-18 14:37:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-18 14:37:46 -0700 |
commit | 06e211acc61c52a2e1709ea8b62a0b0f6dcb492b (patch) | |
tree | f69ccce2499e864ed3c0a6c71c7aec4b5d3a61f6 | |
parent | 8db3865936550fe239b11a44ed52230c3c3eb223 (diff) | |
parent | 250f2492a408be1ed79c563f304a0d43752d032c (diff) | |
download | git-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.txt | 3 | ||||
-rw-r--r-- | builtin.h | 2 | ||||
-rw-r--r-- | builtin/notes.c | 7 | ||||
-rw-r--r-- | cache.h | 6 | ||||
-rw-r--r-- | commit.c | 7 | ||||
-rw-r--r-- | commit.h | 1 | ||||
-rw-r--r-- | diff.c | 2 | ||||
-rw-r--r-- | diff.h | 1 | ||||
-rw-r--r-- | graph.c | 32 | ||||
-rw-r--r-- | graph.h | 27 | ||||
-rw-r--r-- | ident.c | 4 | ||||
-rw-r--r-- | notes.c | 14 | ||||
-rw-r--r-- | notes.h | 14 | ||||
-rw-r--r-- | read-cache.c | 2 | ||||
-rw-r--r-- | rerere.c | 2 | ||||
-rw-r--r-- | rerere.h | 1 | ||||
-rw-r--r-- | sequencer.c | 2 | ||||
-rw-r--r-- | sequencer.h | 3 | ||||
-rw-r--r-- | sha1-array.c | 2 | ||||
-rw-r--r-- | sha1-array.h | 1 | ||||
-rw-r--r-- | strbuf.c | 13 | ||||
-rw-r--r-- | strbuf.h | 4 | ||||
-rw-r--r-- | symlinks.c | 7 | ||||
-rw-r--r-- | trace.c | 2 | ||||
-rw-r--r-- | wt-status.c | 4 | ||||
-rw-r--r-- | wt-status.h | 2 |
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 @@ -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; @@ -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); @@ -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; @@ -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); @@ -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; @@ -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 *); @@ -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: @@ -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 @@ -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)); @@ -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; @@ -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; @@ -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); @@ -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); @@ -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; @@ -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) & @@ -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 */ |