summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-27 19:19:24 -0500
committerJune McEnroe <june@causal.agency>2020-12-27 19:21:11 -0500
commit75f30adedad2f43ab7db2731477890e274494b29 (patch)
treef6f91cb77f59a80e63d5e16e851f4621571c36ed
parentRemove cgit/git submodule (diff)
downloadsrc-75f30adedad2f43ab7db2731477890e274494b29.tar.gz
src-75f30adedad2f43ab7db2731477890e274494b29.zip
Remove dependency on memrchr
Diffstat (limited to '')
-rw-r--r--www/git.causal.agency/cgit/ui-shared.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/www/git.causal.agency/cgit/ui-shared.c b/www/git.causal.agency/cgit/ui-shared.c
index d2358f29..a2951023 100644
--- a/www/git.causal.agency/cgit/ui-shared.c
+++ b/www/git.causal.agency/cgit/ui-shared.c
@@ -1200,9 +1200,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);