diff options
author | June McEnroe | 2020-12-27 19:19:24 -0500 |
---|---|---|
committer | June McEnroe | 2022-02-13 11:46:08 -0500 |
commit | fa86ef6a3d5243ccd3bf679259a94ad46471b3cd (patch) | |
tree | edbadbb3bb9a9d279c6eabf212fa45011ad8cd3b | |
parent | Bump version (diff) | |
download | cgit-fa86ef6a3d5243ccd3bf679259a94ad46471b3cd.tar.gz cgit-fa86ef6a3d5243ccd3bf679259a94ad46471b3cd.zip |
Remove dependency on memrchr
Not available on macOS.
-rw-r--r-- | ui-shared.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c index d2358f2..a295102 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -1200,9 +1200,12 @@ void cgit_set_title_from_path(const char *path) | |||
1200 | if (!path) | 1200 | if (!path) |
1201 | return; | 1201 | return; |
1202 | 1202 | ||
1203 | for (last_slash = path + strlen(path); (slash = memrchr(path, '/', last_slash - path)) != NULL; last_slash = slash) { | 1203 | last_slash = path + strlen(path); |
1204 | for (slash = last_slash; slash > path; --slash) { | ||
1205 | if (*slash != '/') continue; | ||
1204 | strbuf_add(&sb, slash + 1, last_slash - slash - 1); | 1206 | strbuf_add(&sb, slash + 1, last_slash - slash - 1); |
1205 | strbuf_addstr(&sb, " \xc2\xab "); | 1207 | strbuf_addstr(&sb, " \xc2\xab "); |
1208 | last_slash = slash; | ||
1206 | } | 1209 | } |
1207 | strbuf_add(&sb, path, last_slash - path); | 1210 | strbuf_add(&sb, path, last_slash - path); |
1208 | strbuf_addf(&sb, " - %s", ctx.page.title); | 1211 | strbuf_addf(&sb, " - %s", ctx.page.title); |