]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-refs.c
global: make 'char *path' const where possible
[cgit.git] / ui-refs.c
index 5b4530e5410fd159534e03051ce86471c0992bf3..456f610df41cef1e8b3ebdfd02fd44204a3461d4 100644 (file)
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -90,40 +90,6 @@ static void print_tag_header(void)
             "<th class='left' colspan='2'>Age</th></tr>\n");
 }
 
-static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
-{
-       const struct cgit_snapshot_format* f;
-       struct strbuf filename = STRBUF_INIT;
-       const char *basename;
-       int free_ref = 0;
-
-       if (!ref || strlen(ref) < 1)
-               return;
-
-       basename = cgit_repobasename(repo->url);
-       if (!starts_with(ref, basename)) {
-               if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]))
-                       ref++;
-               if (isdigit(ref[0])) {
-                       ref = fmtalloc("%s-%s", basename, ref);
-                       free_ref = 1;
-               }
-       }
-
-       for (f = cgit_snapshot_formats; f->suffix; f++) {
-               if (!(repo->snapshots & f->bit))
-                       continue;
-               strbuf_reset(&filename);
-               strbuf_addf(&filename, "%s%s", ref, f->suffix);
-               cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL, filename.buf);
-               html("&nbsp;&nbsp;");
-       }
-
-       if (free_ref)
-               free((char *)ref);
-       strbuf_release(&filename);
-}
-
 static int print_tag(struct refinfo *ref)
 {
        struct tag *tag = NULL;
@@ -143,7 +109,7 @@ static int print_tag(struct refinfo *ref)
        cgit_tag_link(name, NULL, NULL, name);
        html("</td><td>");
        if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT))
-               print_tag_downloads(ctx.repo, name);
+               cgit_print_snapshot_links(ctx.repo, name, "&nbsp;&nbsp;");
        else
                cgit_object_link(obj);
        html("</td><td>");
@@ -170,7 +136,7 @@ static int print_tag(struct refinfo *ref)
        return 0;
 }
 
-static void print_refs_link(char *path)
+static void print_refs_link(const char *path)
 {
        html("<tr class='nohover'><td colspan='5'>");
        cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path);