Skip to content

Commit 06e211a

Browse files
committed
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
2 parents 8db3865 + 250f249 commit 06e211a

26 files changed

+69
-96
lines changed

Documentation/technical/api-sha1-array.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ Functions
2525
the array (but note that some operations below may lose this
2626
ordering).
2727

28-
`sha1_array_sort`::
29-
Sort the elements in the array.
30-
3128
`sha1_array_lookup`::
3229
Perform a binary search of the array for a specific sha1.
3330
If found, returns the offset (in number of elements) of the

builtin.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ struct fmt_merge_msg_opts {
2121

2222
extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
2323
struct fmt_merge_msg_opts *);
24-
extern void commit_notes(struct notes_tree *t, const char *msg);
2524

2625
struct notes_rewrite_cfg {
2726
struct notes_tree **trees;
@@ -33,7 +32,6 @@ struct notes_rewrite_cfg {
3332
int mode_from_env;
3433
};
3534

36-
combine_notes_fn parse_combine_notes_fn(const char *v);
3735
struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
3836
int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
3937
const unsigned char *from_obj, const unsigned char *to_obj);

builtin/notes.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include "string-list.h"
2020
#include "notes-merge.h"
2121

22+
static void commit_notes(struct notes_tree *t, const char *msg);
23+
static combine_notes_fn parse_combine_notes_fn(const char *v);
24+
2225
static const char * const git_notes_usage[] = {
2326
N_("git notes [--ref <notes_ref>] [list [<object>]]"),
2427
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
288291
return parse_reuse_arg(opt, arg, unset);
289292
}
290293

291-
void commit_notes(struct notes_tree *t, const char *msg)
294+
static void commit_notes(struct notes_tree *t, const char *msg)
292295
{
293296
struct strbuf buf = STRBUF_INIT;
294297
unsigned char commit_sha1[20];
@@ -312,7 +315,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
312315
strbuf_release(&buf);
313316
}
314317

315-
combine_notes_fn parse_combine_notes_fn(const char *v)
318+
static combine_notes_fn parse_combine_notes_fn(const char *v)
316319
{
317320
if (!strcasecmp(v, "overwrite"))
318321
return combine_notes_overwrite;

cache.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ extern int discard_index(struct index_state *);
442442
extern int unmerged_index(const struct index_state *);
443443
extern int verify_path(const char *path);
444444
extern struct cache_entry *index_name_exists(struct index_state *istate, const char *name, int namelen, int igncase);
445-
extern int index_name_stage_pos(const struct index_state *, const char *name, int namelen, int stage);
446445
extern int index_name_pos(const struct index_state *, const char *name, int namelen);
447446
#define ADD_CACHE_OK_TO_ADD 1 /* Ok to add */
448447
#define ADD_CACHE_OK_TO_REPLACE 2 /* Ok to replace file/directory */
@@ -902,9 +901,7 @@ extern const char *git_author_info(int);
902901
extern const char *git_committer_info(int);
903902
extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int);
904903
extern const char *fmt_name(const char *name, const char *email);
905-
extern const char *ident_default_name(void);
906904
extern const char *ident_default_email(void);
907-
extern const char *ident_default_date(void);
908905
extern const char *git_editor(void);
909906
extern const char *git_pager(int stdout_is_tty);
910907
extern int git_ident_config(const char *, const char *, void *);
@@ -947,9 +944,7 @@ struct cache_def {
947944
extern int has_symlink_leading_path(const char *name, int len);
948945
extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
949946
extern int check_leading_path(const char *name, int len);
950-
extern int threaded_check_leading_path(struct cache_def *cache, const char *name, int len);
951947
extern int has_dirs_only_path(const char *name, int len, int prefix_len);
952-
extern int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len);
953948
extern void schedule_dir_for_removal(const char *name, int len);
954949
extern void remove_scheduled_dirs(void);
955950

@@ -1208,7 +1203,6 @@ extern void alloc_report(void);
12081203
/* trace.c */
12091204
__attribute__((format (printf, 1, 2)))
12101205
extern void trace_printf(const char *format, ...);
1211-
extern void trace_vprintf(const char *key, const char *format, va_list ap);
12121206
__attribute__((format (printf, 2, 3)))
12131207
extern void trace_argv_printf(const char **argv, const char *format, ...);
12141208
extern void trace_repo_setup(const char *prefix);

commit.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "gpg-interface.h"
1010
#include "mergesort.h"
1111

12+
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
13+
1214
int save_commit_buffer = 1;
1315

1416
const char *commit_type = "commit";
@@ -1073,8 +1075,9 @@ static int excluded_header_field(const char *field, size_t len, const char **exc
10731075
return 0;
10741076
}
10751077

1076-
struct commit_extra_header *read_commit_extra_header_lines(const char *buffer, size_t size,
1077-
const char **exclude)
1078+
static struct commit_extra_header *read_commit_extra_header_lines(
1079+
const char *buffer, size_t size,
1080+
const char **exclude)
10781081
{
10791082
struct commit_extra_header *extra = NULL, **tail = &extra, *it = NULL;
10801083
const char *line, *next, *eof, *eob;

commit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ extern int commit_tree_extended(const struct strbuf *msg, unsigned char *tree,
204204
struct commit_extra_header *);
205205

206206
extern struct commit_extra_header *read_commit_extra_headers(struct commit *, const char **);
207-
extern struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
208207

209208
extern void free_commit_extra_headers(struct commit_extra_header *extra);
210209

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
static int diff_detect_rename_default;
2626
static int diff_rename_limit_default = 400;
2727
static int diff_suppress_blank_empty;
28-
int diff_use_color_default = -1;
28+
static int diff_use_color_default = -1;
2929
static const char *diff_word_regex_cfg;
3030
static const char *external_diff_cmd_cfg;
3131
int diff_auto_refresh_index = 1;

diff.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ extern int parse_long_opt(const char *opt, const char **argv,
243243

244244
extern int git_diff_basic_config(const char *var, const char *value, void *cb);
245245
extern int git_diff_ui_config(const char *var, const char *value, void *cb);
246-
extern int diff_use_color_default;
247246
extern void diff_setup(struct diff_options *);
248247
extern int diff_opt_parse(struct diff_options *, const char **, int);
249248
extern void diff_setup_done(struct diff_options *);

graph.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@
77

88
/* Internal API */
99

10+
/*
11+
* Output the next line for a graph.
12+
* This formats the next graph line into the specified strbuf. It is not
13+
* terminated with a newline.
14+
*
15+
* Returns 1 if the line includes the current commit, and 0 otherwise.
16+
* graph_next_line() will return 1 exactly once for each time
17+
* graph_update() is called.
18+
*/
19+
static int graph_next_line(struct git_graph *graph, struct strbuf *sb);
20+
21+
/*
22+
* Set up a custom scheme for column colors.
23+
*
24+
* The default column color scheme inserts ANSI color escapes to colorize
25+
* the graph. The various color escapes are stored in an array of strings
26+
* where each entry corresponds to a color, except for the last entry,
27+
* which denotes the escape for resetting the color back to the default.
28+
* When generating the graph, strings from this array are inserted before
29+
* and after the various column characters.
30+
*
31+
* This function allows you to enable a custom array of color escapes.
32+
* The 'colors_max' argument is the index of the last "reset" entry.
33+
*
34+
* This functions must be called BEFORE graph_init() is called.
35+
*/
36+
static void graph_set_column_colors(const char **colors, unsigned short colors_max);
37+
1038
/*
1139
* Output a padding line in the graph.
1240
* This is similar to graph_next_line(). However, it is guaranteed to
@@ -62,7 +90,7 @@ enum graph_state {
6290
static const char **column_colors;
6391
static unsigned short column_colors_max;
6492

65-
void graph_set_column_colors(const char **colors, unsigned short colors_max)
93+
static void graph_set_column_colors(const char **colors, unsigned short colors_max)
6694
{
6795
column_colors = colors;
6896
column_colors_max = colors_max;
@@ -1116,7 +1144,7 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf
11161144
graph_update_state(graph, GRAPH_PADDING);
11171145
}
11181146

1119-
int graph_next_line(struct git_graph *graph, struct strbuf *sb)
1147+
static int graph_next_line(struct git_graph *graph, struct strbuf *sb)
11201148
{
11211149
switch (graph->state) {
11221150
case GRAPH_PADDING:

graph.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,6 @@
44
/* A graph is a pointer to this opaque structure */
55
struct git_graph;
66

7-
/*
8-
* Set up a custom scheme for column colors.
9-
*
10-
* The default column color scheme inserts ANSI color escapes to colorize
11-
* the graph. The various color escapes are stored in an array of strings
12-
* where each entry corresponds to a color, except for the last entry,
13-
* which denotes the escape for resetting the color back to the default.
14-
* When generating the graph, strings from this array are inserted before
15-
* and after the various column characters.
16-
*
17-
* This function allows you to enable a custom array of color escapes.
18-
* The 'colors_max' argument is the index of the last "reset" entry.
19-
*
20-
* This functions must be called BEFORE graph_init() is called.
21-
*/
22-
void graph_set_column_colors(const char **colors, unsigned short colors_max);
237

248
/*
259
* Create a new struct git_graph.
@@ -49,17 +33,6 @@ void graph_update(struct git_graph *graph, struct commit *commit);
4933
*/
5034
int graph_is_commit_finished(struct git_graph const *graph);
5135

52-
/*
53-
* Output the next line for a graph.
54-
* This formats the next graph line into the specified strbuf. It is not
55-
* terminated with a newline.
56-
*
57-
* Returns 1 if the line includes the current commit, and 0 otherwise.
58-
* graph_next_line() will return 1 exactly once for each time
59-
* graph_update() is called.
60-
*/
61-
int graph_next_line(struct git_graph *graph, struct strbuf *sb);
62-
6336

6437
/*
6538
* graph_show_*: helper functions for printing to stdout

0 commit comments

Comments
 (0)