Skip to content

Commit 5545442

Browse files
Denton-Lgitster
authored andcommitted
*.[ch]: remove extern from function declarations using spatch
There has been a push to remove extern from function declarations. Remove some instances of "extern" for function declarations which are caught by Coccinelle. Note that Coccinelle has some difficulty with processing functions with `__attribute__` or varargs so some `extern` declarations are left behind to be dealt with in a future patch. This was the Coccinelle patch used: @@ type T; identifier f; @@ - extern T f(...); and it was run with: $ git ls-files \*.{c,h} | grep -v ^compat/ | xargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place Files under `compat/` are intentionally excluded as some are directly copied from external sources and we should avoid churning them as much as possible. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ffac537 commit 5545442

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+885
-885
lines changed

advice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int git_default_advice_config(const char *var, const char *value);
3131
__attribute__((format (printf, 1, 2)))
3232
void advise(const char *advice, ...);
3333
int error_resolve_conflict(const char *me);
34-
extern void NORETURN die_resolve_conflict(const char *me);
34+
void NORETURN die_resolve_conflict(const char *me);
3535
void NORETURN die_conclude_merge(void);
3636
void detach_advice(const char *new_name);
3737

archive.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct archiver_args {
2323

2424
/* main api */
2525

26-
extern int write_archive(int argc, const char **argv, const char *prefix,
26+
int write_archive(int argc, const char **argv, const char *prefix,
2727
struct repository *repo,
2828
const char *name_hint, int remote);
2929

@@ -39,19 +39,19 @@ struct archiver {
3939
unsigned flags;
4040
void *data;
4141
};
42-
extern void register_archiver(struct archiver *);
42+
void register_archiver(struct archiver *);
4343

44-
extern void init_tar_archiver(void);
45-
extern void init_zip_archiver(void);
46-
extern void init_archivers(void);
44+
void init_tar_archiver(void);
45+
void init_zip_archiver(void);
46+
void init_archivers(void);
4747

4848
typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
4949
const struct object_id *oid,
5050
const char *path, size_t pathlen,
5151
unsigned int mode);
5252

53-
extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
54-
extern void *object_file_to_archive(const struct archiver_args *args,
53+
int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
54+
void *object_file_to_archive(const struct archiver_args *args,
5555
const char *path, const struct object_id *oid,
5656
unsigned int mode, enum object_type *type,
5757
unsigned long *sizep);

bisect.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ struct repository;
1111
* Otherwise, it will be either all non-SAMETREE commits or the single
1212
* best commit, as chosen by `find_all`.
1313
*/
14-
extern void find_bisection(struct commit_list **list, int *reaches, int *all,
14+
void find_bisection(struct commit_list **list, int *reaches, int *all,
1515
int find_all);
1616

17-
extern struct commit_list *filter_skipped(struct commit_list *list,
17+
struct commit_list *filter_skipped(struct commit_list *list,
1818
struct commit_list **tried,
1919
int show_all,
2020
int *count,
@@ -31,14 +31,14 @@ struct rev_list_info {
3131
const char *header_prefix;
3232
};
3333

34-
extern int bisect_next_all(struct repository *r,
34+
int bisect_next_all(struct repository *r,
3535
const char *prefix,
3636
int no_checkout);
3737

38-
extern int estimate_bisect_steps(int all);
38+
int estimate_bisect_steps(int all);
3939

40-
extern void read_bisect_terms(const char **bad, const char **good);
40+
void read_bisect_terms(const char **bad, const char **good);
4141

42-
extern int bisect_clean_state(void);
42+
int bisect_clean_state(void);
4343

4444
#endif

blame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,6 @@ struct blame_entry *blame_entry_prepend(struct blame_entry *head,
177177
long start, long end,
178178
struct blame_origin *o);
179179

180-
extern struct blame_origin *get_blame_suspects(struct commit *commit);
180+
struct blame_origin *get_blame_suspects(struct commit *commit);
181181

182182
#endif /* BLAME_H */

branch.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ void create_branch(struct repository *r,
5050
* Return 1 if the named branch already exists; return 0 otherwise.
5151
* Fill ref with the full refname for the branch.
5252
*/
53-
extern int validate_branchname(const char *name, struct strbuf *ref);
53+
int validate_branchname(const char *name, struct strbuf *ref);
5454

5555
/*
5656
* Check if a branch 'name' can be created as a new branch; die otherwise.
5757
* 'force' can be used when it is OK for the named branch already exists.
5858
* Return 1 if the named branch already exists; return 0 otherwise.
5959
* Fill ref with the full refname for the branch.
6060
*/
61-
extern int validate_new_branchname(const char *name, struct strbuf *ref, int force);
61+
int validate_new_branchname(const char *name, struct strbuf *ref, int force);
6262

6363
/*
6464
* Remove information about the state of working on the current
@@ -72,26 +72,26 @@ void remove_branch_state(struct repository *r);
7272
* Returns 0 on success.
7373
*/
7474
#define BRANCH_CONFIG_VERBOSE 01
75-
extern int install_branch_config(int flag, const char *local, const char *origin, const char *remote);
75+
int install_branch_config(int flag, const char *local, const char *origin, const char *remote);
7676

7777
/*
7878
* Read branch description
7979
*/
80-
extern int read_branch_desc(struct strbuf *, const char *branch_name);
80+
int read_branch_desc(struct strbuf *, const char *branch_name);
8181

8282
/*
8383
* Check if a branch is checked out in the main worktree or any linked
8484
* worktree and die (with a message describing its checkout location) if
8585
* it is.
8686
*/
87-
extern void die_if_checked_out(const char *branch, int ignore_current_worktree);
87+
void die_if_checked_out(const char *branch, int ignore_current_worktree);
8888

8989
/*
9090
* Update all per-worktree HEADs pointing at the old ref to point the new ref.
9191
* This will be used when renaming a branch. Returns 0 if successful, non-zero
9292
* otherwise.
9393
*/
94-
extern int replace_each_worktree_head_symref(const char *oldref, const char *newref,
94+
int replace_each_worktree_head_symref(const char *oldref, const char *newref,
9595
const char *logmsg);
9696

9797
#endif

0 commit comments

Comments
 (0)