Skip to content

Commit

Permalink
*.[ch]: remove extern from function declarations using spatch
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Denton-L authored and gitster committed May 5, 2019
1 parent ffac537 commit 5545442
Show file tree
Hide file tree
Showing 70 changed files with 885 additions and 885 deletions.
2 changes: 1 addition & 1 deletion advice.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int git_default_advice_config(const char *var, const char *value);
__attribute__((format (printf, 1, 2)))
void advise(const char *advice, ...);
int error_resolve_conflict(const char *me);
extern void NORETURN die_resolve_conflict(const char *me);
void NORETURN die_resolve_conflict(const char *me);
void NORETURN die_conclude_merge(void);
void detach_advice(const char *new_name);

Expand Down
14 changes: 7 additions & 7 deletions archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct archiver_args {

/* main api */

extern int write_archive(int argc, const char **argv, const char *prefix,
int write_archive(int argc, const char **argv, const char *prefix,
struct repository *repo,
const char *name_hint, int remote);

Expand All @@ -39,19 +39,19 @@ struct archiver {
unsigned flags;
void *data;
};
extern void register_archiver(struct archiver *);
void register_archiver(struct archiver *);

extern void init_tar_archiver(void);
extern void init_zip_archiver(void);
extern void init_archivers(void);
void init_tar_archiver(void);
void init_zip_archiver(void);
void init_archivers(void);

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

extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
extern void *object_file_to_archive(const struct archiver_args *args,
int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
void *object_file_to_archive(const struct archiver_args *args,
const char *path, const struct object_id *oid,
unsigned int mode, enum object_type *type,
unsigned long *sizep);
Expand Down
12 changes: 6 additions & 6 deletions bisect.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ struct repository;
* Otherwise, it will be either all non-SAMETREE commits or the single
* best commit, as chosen by `find_all`.
*/
extern void find_bisection(struct commit_list **list, int *reaches, int *all,
void find_bisection(struct commit_list **list, int *reaches, int *all,
int find_all);

extern struct commit_list *filter_skipped(struct commit_list *list,
struct commit_list *filter_skipped(struct commit_list *list,
struct commit_list **tried,
int show_all,
int *count,
Expand All @@ -31,14 +31,14 @@ struct rev_list_info {
const char *header_prefix;
};

extern int bisect_next_all(struct repository *r,
int bisect_next_all(struct repository *r,
const char *prefix,
int no_checkout);

extern int estimate_bisect_steps(int all);
int estimate_bisect_steps(int all);

extern void read_bisect_terms(const char **bad, const char **good);
void read_bisect_terms(const char **bad, const char **good);

extern int bisect_clean_state(void);
int bisect_clean_state(void);

#endif
2 changes: 1 addition & 1 deletion blame.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ struct blame_entry *blame_entry_prepend(struct blame_entry *head,
long start, long end,
struct blame_origin *o);

extern struct blame_origin *get_blame_suspects(struct commit *commit);
struct blame_origin *get_blame_suspects(struct commit *commit);

#endif /* BLAME_H */
12 changes: 6 additions & 6 deletions branch.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ void create_branch(struct repository *r,
* Return 1 if the named branch already exists; return 0 otherwise.
* Fill ref with the full refname for the branch.
*/
extern int validate_branchname(const char *name, struct strbuf *ref);
int validate_branchname(const char *name, struct strbuf *ref);

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

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

/*
* Read branch description
*/
extern int read_branch_desc(struct strbuf *, const char *branch_name);
int read_branch_desc(struct strbuf *, const char *branch_name);

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

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

#endif
Loading

0 comments on commit 5545442

Please sign in to comment.