From fcd939903b9ab222ebcb9f6effc2e7f642e6071c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 27 Dec 2020 19:19:24 -0500 Subject: Remove dependency on memrchr Not available on macOS. --- ui-shared.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui-shared.c b/ui-shared.c index 6fae72d..fdc4c91 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1251,9 +1251,12 @@ void cgit_set_title_from_path(const char *path) if (!path) return; - for (last_slash = path + strlen(path); (slash = memrchr(path, '/', last_slash - path)) != NULL; last_slash = slash) { + last_slash = path + strlen(path); + for (slash = last_slash; slash > path; --slash) { + if (*slash != '/') continue; strbuf_add(&sb, slash + 1, last_slash - slash - 1); strbuf_addstr(&sb, " \xc2\xab "); + last_slash = slash; } strbuf_add(&sb, path, last_slash - path); strbuf_addf(&sb, " - %s", ctx.page.title); -- cgit 1.5.1