aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
authorGravatar Lukas Fleischer <cgit@cryptocrack.de>2013-03-04 00:49:47 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-03-04 23:12:55 (JST)
commitc4b8db3f0973bc63d60806d197b55dc2901870f0 (patch)
treebc817b4d410ac59b7e3c2fe01352630f82b393ef /ui-tree.c
parentfb5a37317de9532509b9c398916c0290212ae233 (diff)
downloadcgit-c4b8db3f0973bc63d60806d197b55dc2901870f0.zip
cgit-c4b8db3f0973bc63d60806d197b55dc2901870f0.tar.gz
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>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 305c951..8c87571 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -14,6 +14,7 @@
14char *curr_rev; 14char *curr_rev;
15char *match_path; 15char *match_path;
16int header = 0; 16int header = 0;
17static int state;
17 18
18static void print_text_buffer(const char *name, char *buf, unsigned long size) 19static 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}