diff options
Diffstat (limited to 'source/ui-plain.c')
| -rw-r--r-- | source/ui-plain.c | 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 5 insertions, 6 deletions
diff --git a/source/ui-plain.c b/source/ui-plain.c index 6b45637..959b1bf 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -15,10 +15,8 @@ #include "ui-plain.h" #include "ui-shared.h" -/* - * A listing is opened by the entry that matched and closed only once the walk - * is over, so the end of the page has to tell the three cases apart. - */ +// A listing is opened by the entry that matched and closed only once the walk +// is over, so the end of the page has to tell the three cases apart. enum response { RESPONSE_NONE, RESPONSE_BLOB, @@ -133,9 +131,9 @@ static void print_dir(const char *base, int baselen, const char *path) // cgit_plain_link is asked for with a null path. fullpath[len - 1] = 0; slash = strrchr(fullpath, '/'); - if (slash) + if (slash) { *(slash + 1) = 0; - else { + } else { free(fullpath); fullpath = NULL; } @@ -199,6 +197,7 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base, static int dir_prefix_len(const char *path) { const char *slash = strrchr(path, '/'); + if (slash) return slash - path + 1; return 0; |
