diff options
| author | 2013-03-04 00:55:21 (JST) | |
|---|---|---|
| committer | 2013-03-04 23:12:55 (JST) | |
| commit | bfe576624541febd6005ad6a4633680369a7dc34 (patch) | |
| tree | 187d73cd827928f1b62b4a557f8a8721e4b929a3 | |
| parent | c4b8db3f0973bc63d60806d197b55dc2901870f0 (diff) | |
| download | cgit-bfe576624541febd6005ad6a4633680369a7dc34.zip cgit-bfe576624541febd6005ad6a4633680369a7dc34.tar.gz | |
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>
| -rw-r--r-- | ui-tree.c | 8 |
1 files changed, 2 insertions, 6 deletions
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | char *curr_rev; | 14 | char *curr_rev; |
| 15 | char *match_path; | 15 | char *match_path; |
| 16 | int header = 0; | ||
| 17 | static int state; | 16 | static int state; |
| 18 | 17 | ||
| 19 | static void print_text_buffer(const char *name, char *buf, unsigned long size) | 18 | static 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 | ||
| 195 | static void ls_tail() | 193 | static 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 | ||
| 203 | static void ls_tree(const unsigned char *sha1, char *path) | 198 | static 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 | } |
