aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
authorLukas Fleischer2013-03-03 16:55:21 +0100
committerJason A. Donenfeld2013-03-04 09:12:55 -0500
commitbfe576624541febd6005ad6a4633680369a7dc34 (patch)
tree187d73cd827928f1b62b4a557f8a8721e4b929a3 /ui-tree.c
parentc4b8db3f0973bc63d60806d197b55dc2901870f0 (diff)
downloadcgit-bfe576624541febd6005ad6a4633680369a7dc34.tar.gz
cgit-bfe576624541febd6005ad6a4633680369a7dc34.tar.bz2
cgit-bfe576624541febd6005ad6a4633680369a7dc34.zip
ui-tree.c: Drop the header variable
Instead, use the value of the state variable to determine whether the footer needs to be drawn. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 8c87571..26f06e3 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -13,7 +13,6 @@
13 13
14char *curr_rev; 14char *curr_rev;
15char *match_path; 15char *match_path;
16int header = 0;
17static int state; 16static int state;
18 17
19static void print_text_buffer(const char *name, char *buf, unsigned long size) 18static void print_text_buffer(const char *name, char *buf, unsigned long size)
@@ -189,15 +188,11 @@ static void ls_head()
189 html("<th class='right'>Size</th>"); 188 html("<th class='right'>Size</th>");
190 html("<th/>"); 189 html("<th/>");
191 html("</tr>\n"); 190 html("</tr>\n");
192 header = 1;
193} 191}
194 192
195static void ls_tail() 193static void ls_tail()
196{ 194{
197 if (!header)
198 return;
199 html("</table>\n"); 195 html("</table>\n");
200 header = 0;
201} 196}
202 197
203static void ls_tree(const unsigned char *sha1, char *path) 198static void ls_tree(const unsigned char *sha1, char *path)
@@ -286,5 +281,6 @@ void cgit_print_tree(const char *rev, char *path)
286 match_path = path; 281 match_path = path;
287 state = 0; 282 state = 0;
288 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); 283 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
289 ls_tail(); 284 if (state == 1)
285 ls_tail();
290} 286}