Browse code

Use static where appropriate in fzy.c

John Hawthorn authored on 07/11/2015 10:00:43
Showing 1 changed files

  • fzy.c index 7eb8bd3..409c2a5 100644
... ...
@@ -11,14 +11,14 @@
11 11
 
12 12
 #include "config.h"
13 13
 
14
-int flag_show_scores = 0;
14
+static int flag_show_scores = 0;
15 15
 
16
-size_t num_lines = 10;
17
-size_t scrolloff = 1;
16
+static size_t num_lines = 10;
17
+static size_t scrolloff = 1;
18 18
 
19
-const char *prompt = "> ";
19
+static const char *prompt = "> ";
20 20
 
21
-void read_choices(choices_t *c) {
21
+static void read_choices(choices_t *c) {
22 22
 	const char *line;
23 23
 	char buf[4096];
24 24
 	while (fgets(buf, sizeof buf, stdin)) {
... ...
@@ -35,10 +35,10 @@ void read_choices(choices_t *c) {
35 35
 }
36 36
 
37 37
 #define SEARCH_SIZE_MAX 4096
38
-size_t search_size;
39
-char search[SEARCH_SIZE_MAX + 1] = {0};
38
+static size_t search_size;
39
+static char search[SEARCH_SIZE_MAX + 1] = {0};
40 40
 
41
-void clear(tty_t *tty) {
41
+static void clear(tty_t *tty) {
42 42
 	tty_setcol(tty, 0);
43 43
 	size_t line = 0;
44 44
 	while (line++ < num_lines) {
... ...
@@ -48,7 +48,7 @@ void clear(tty_t *tty) {
48 48
 	tty_flush(tty);
49 49
 }
50 50
 
51
-void draw_match(tty_t *tty, const char *choice, int selected) {
51
+static void draw_match(tty_t *tty, const char *choice, int selected) {
52 52
 	int n = strlen(search);
53 53
 	size_t positions[n + 1];
54 54
 	for (int i = 0; i < n + 1; i++)
... ...
@@ -81,7 +81,7 @@ void draw_match(tty_t *tty, const char *choice, int selected) {
81 81
 	tty_setnormal(tty);
82 82
 }
83 83
 
84
-void draw(tty_t *tty, choices_t *choices) {
84
+static void draw(tty_t *tty, choices_t *choices) {
85 85
 	size_t start = 0;
86 86
 	size_t current_selection = choices->selection;
87 87
 	if (current_selection + scrolloff >= num_lines) {
... ...
@@ -106,7 +106,7 @@ void draw(tty_t *tty, choices_t *choices) {
106 106
 	tty_flush(tty);
107 107
 }
108 108
 
109
-void emit(choices_t *choices) {
109
+static void emit(choices_t *choices) {
110 110
 	const char *selection = choices_get(choices, choices->selection);
111 111
 	if (selection) {
112 112
 		/* output the selected result */
... ...
@@ -119,7 +119,7 @@ void emit(choices_t *choices) {
119 119
 	exit(EXIT_SUCCESS);
120 120
 }
121 121
 
122
-void run(tty_t *tty, choices_t *choices) {
122
+static void run(tty_t *tty, choices_t *choices) {
123 123
 	choices_search(choices, search);
124 124
 	char ch;
125 125
 	do {
... ...
@@ -189,7 +189,7 @@ static const char *usage_str =
189 189
     " -h, --help     Display this help and exit\n"
190 190
     " -v, --version  Output version information and exit\n";
191 191
 
192
-void usage(const char *argv0) {
192
+static void usage(const char *argv0) {
193 193
 	fprintf(stderr, usage_str, argv0);
194 194
 }
195 195