Commit 4ed7e80c99d049eb6f7c4d432e28a22908da4ca2

Stefan Sperling 2018-05-20T11:59:33

mark many functions and structs static in got.c and tog.c

diff --git a/got/got.c b/got/got.c
index a413459..4849992 100644
--- a/got/got.c
+++ b/got/got.c
@@ -45,17 +45,19 @@ struct cmd {
 	const char	 *cmd_descr;
 };
 
-__dead void	usage(void);
-__dead void	usage_checkout(void);
-__dead void	usage_log(void);
-__dead void	usage_diff(void);
-
-const struct got_error*		cmd_checkout(int, char *[]);
-const struct got_error*		cmd_log(int, char *[]);
-const struct got_error*		cmd_diff(int, char *[]);
-const struct got_error*		cmd_status(int, char *[]);
+__dead static void	usage(void);
+__dead static void	usage_checkout(void);
+__dead static void	usage_log(void);
+__dead static void	usage_diff(void);
+
+static const struct got_error*		cmd_checkout(int, char *[]);
+static const struct got_error*		cmd_log(int, char *[]);
+static const struct got_error*		cmd_diff(int, char *[]);
+#ifdef notyet
+static const struct got_error*		cmd_status(int, char *[]);
+#endif
 
-struct cmd got_commands[] = {
+static struct cmd got_commands[] = {
 	{ "checkout",	cmd_checkout,	usage_checkout,
 	    "check out a new work tree from a repository" },
 	{ "log",	cmd_log,	usage_log,
@@ -120,7 +122,7 @@ main(int argc, char *argv[])
 	return 1;
 }
 
-__dead void
+__dead static void
 usage(void)
 {
 	int i;
@@ -134,7 +136,7 @@ usage(void)
 	exit(1);
 }
 
-__dead void
+__dead static void
 usage_checkout(void)
 {
 	fprintf(stderr, "usage: %s checkout [-p prefix] repository-path "
@@ -153,7 +155,7 @@ checkout_progress(void *arg, const char *path)
 	printf("A  %s/%s\n", worktree_path, path);
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_checkout(int argc, char *argv[])
 {
 	const struct got_error *error = NULL;
@@ -427,7 +429,7 @@ print_commits(struct got_object *root_obj, struct got_object_id *root_id,
 	return err;
 }
 
-__dead void
+__dead static void
 usage_log(void)
 {
 	fprintf(stderr, "usage: %s log [-p] [-c commit] [ -l N ] "
@@ -435,7 +437,7 @@ usage_log(void)
 	exit(1);
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_log(int argc, char *argv[])
 {
 	const struct got_error *error;
@@ -521,7 +523,7 @@ cmd_log(int argc, char *argv[])
 	return error;
 }
 
-__dead void
+__dead static void
 usage_diff(void)
 {
 	fprintf(stderr, "usage: %s diff [repository-path] object1 object2\n",
@@ -529,7 +531,7 @@ usage_diff(void)
 	exit(1);
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_diff(int argc, char *argv[])
 {
 	const struct got_error *error;
@@ -630,7 +632,7 @@ done:
 }
 
 #ifdef notyet
-const struct got_error *
+static const struct got_error *
 cmd_status(int argc __unused, char *argv[] __unused)
 {
 	git_repository *repo = NULL;
diff --git a/tog/tog.c b/tog/tog.c
index 35144a6..963fa3b 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -51,16 +51,16 @@ struct tog_cmd {
 	const char *descr;
 };
 
-__dead void	usage(void);
-__dead void	usage_log(void);
-__dead void	usage_diff(void);
-__dead void	usage_blame(void);
+__dead static void	usage(void);
+__dead static void	usage_log(void);
+__dead static void	usage_diff(void);
+__dead static void	usage_blame(void);
 
-const struct got_error*	cmd_log(int, char *[]);
-const struct got_error*	cmd_diff(int, char *[]);
-const struct got_error*	cmd_blame(int, char *[]);
+static const struct got_error*	cmd_log(int, char *[]);
+static const struct got_error*	cmd_diff(int, char *[]);
+static const struct got_error*	cmd_blame(int, char *[]);
 
-struct tog_cmd tog_commands[] = {
+static struct tog_cmd tog_commands[] = {
 	{ "log",	cmd_log,	usage_log,
 	    "show repository history" },
 	{ "diff",	cmd_diff,	usage_diff,
@@ -74,7 +74,7 @@ static struct tog_view {
 	PANEL *panel;
 } tog_log_view, tog_diff_view;
 
-__dead void
+__dead static void
 usage_log(void)
 {
 	endwin();
@@ -657,7 +657,7 @@ done:
 	return err;
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_log(int argc, char *argv[])
 {
 	const struct got_error *error;
@@ -723,7 +723,7 @@ cmd_log(int argc, char *argv[])
 	return error;
 }
 
-__dead void
+__dead static void
 usage_diff(void)
 {
 	endwin();
@@ -732,7 +732,7 @@ usage_diff(void)
 	exit(1);
 }
 
-const struct got_error *
+static const struct got_error *
 draw_diff(FILE *f, int *first_displayed_line, int *last_displayed_line,
     int *eof, int max_lines)
 {
@@ -774,7 +774,7 @@ draw_diff(FILE *f, int *first_displayed_line, int *last_displayed_line,
 	return NULL;
 }
 
-const struct got_error *
+static const struct got_error *
 show_diff_view(struct got_object *obj1, struct got_object *obj2,
     struct got_repository *repo)
 {
@@ -849,7 +849,7 @@ show_diff_view(struct got_object *obj1, struct got_object *obj2,
 	return err;
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_diff(int argc, char *argv[])
 {
 	const struct got_error *error = NULL;
@@ -915,7 +915,7 @@ done:
 	return error;
 }
 
-__dead void
+__dead static void
 usage_blame(void)
 {
 	endwin();
@@ -924,7 +924,7 @@ usage_blame(void)
 	exit(1);
 }
 
-const struct got_error *
+static const struct got_error *
 cmd_blame(int argc, char *argv[])
 {
 	return got_error(GOT_ERR_NOT_IMPL);
@@ -942,7 +942,7 @@ init_curses(void)
 	curs_set(0);
 }
 
-__dead void
+__dead static void
 usage(void)
 {
 	int i;