]> gitweb.ps.run Git - ps-cgit/blobdiff - scan-tree.c
scan-tree.c: Remove unused macro
[ps-cgit] / scan-tree.c
index 2684b446961686c9d48f785fc990bcbcd76db8e6..29c8263a0f6feeea85545999adfeef41a8ab03ae 100644 (file)
@@ -148,14 +148,14 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
        }
 
        if (ctx.cfg.section_from_path) {
-               n  = ctx.cfg.section_from_path;
+               n = ctx.cfg.section_from_path;
                if (n > 0) {
-                       slash = rel.buf;
-                       while (slash && n && (slash = strchr(slash, '/')))
+                       slash = rel.buf - 1;
+                       while (slash && n && (slash = strchr(slash + 1, '/')))
                                n--;
                } else {
                        slash = rel.buf + rel.len;
-                       while (slash && n && (slash = xstrrchr(rel.buf, slash, '/')))
+                       while (slash && n && (slash = xstrrchr(rel.buf, slash - 1, '/')))
                                n++;
                }
                if (slash && !n) {
@@ -230,8 +230,6 @@ end:
        closedir(dir);
 }
 
-#define lastc(s) s[strlen(s) - 1]
-
 void scan_projects(const char *path, const char *projectsfile, repo_config_fn fn)
 {
        struct strbuf line = STRBUF_INIT;