diff options
author | Lukas Fleischer | 2013-03-03 16:49:47 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2013-03-04 09:12:55 -0500 |
commit | c4b8db3f0973bc63d60806d197b55dc2901870f0 (patch) | |
tree | bc817b4d410ac59b7e3c2fe01352630f82b393ef | |
parent | fb5a37317de9532509b9c398916c0290212ae233 (diff) | |
download | cgit-c4b8db3f0973bc63d60806d197b55dc2901870f0.tar.gz cgit-c4b8db3f0973bc63d60806d197b55dc2901870f0.tar.bz2 cgit-c4b8db3f0973bc63d60806d197b55dc2901870f0.zip |
ui-tree.c: Declare the state variable globally
This allows for removing the header variable in a following patch. We
can use the state variable to check whether the tail needs to be printed
instead.
Note that the state variable will be moved into a context structure
later.
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r-- | ui-tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -14,6 +14,7 @@ | |||
14 | char *curr_rev; | 14 | char *curr_rev; |
15 | char *match_path; | 15 | char *match_path; |
16 | int header = 0; | 16 | int header = 0; |
17 | static int state; | ||
17 | 18 | ||
18 | static void print_text_buffer(const char *name, char *buf, unsigned long size) | 19 | static void print_text_buffer(const char *name, char *buf, unsigned long size) |
19 | { | 20 | { |
@@ -223,7 +224,6 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | |||
223 | const char *pathname, unsigned mode, int stage, | 224 | const char *pathname, unsigned mode, int stage, |
224 | void *cbdata) | 225 | void *cbdata) |
225 | { | 226 | { |
226 | static int state; | ||
227 | static char buffer[PATH_MAX]; | 227 | static char buffer[PATH_MAX]; |
228 | 228 | ||
229 | if (state == 0) { | 229 | if (state == 0) { |
@@ -284,6 +284,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
284 | } | 284 | } |
285 | 285 | ||
286 | match_path = path; | 286 | match_path = path; |
287 | state = 0; | ||
287 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); | 288 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); |
288 | ls_tail(); | 289 | ls_tail(); |
289 | } | 290 | } |