aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--ui-shared.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 9f7625c..df52a9b 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -1247,17 +1247,6 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
strbuf_release(&filename);
}
-/* Locate the last '/' within the first len bytes of path, or NULL if
- * there is none. Avoids memrchr(), which is a GNU extension.
- */
-static const char *find_last_slash(const char *path, size_t len)
-{
- while (len > 0)
- if (path[--len] == '/')
- return path + len;
- return NULL;
-}
-
void cgit_set_title_from_path(const char *path)
{
struct strbuf sb = STRBUF_INIT;
@@ -1266,7 +1255,7 @@ void cgit_set_title_from_path(const char *path)
if (!path)
return;
- for (last_slash = path + strlen(path); (slash = find_last_slash(path, last_slash - path)) != NULL; last_slash = slash) {
+ for (last_slash = path + strlen(path); (slash = memrchr(path, '/', last_slash - path)) != NULL; last_slash = slash) {
strbuf_add(&sb, slash + 1, last_slash - slash - 1);
strbuf_addstr(&sb, " \xc2\xab ");
}