]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-shared.c
ui-stats.c: set parent pointer to NULL after freeing it
[cgit.git] / ui-shared.c
index 070971f53a5805db13c83a20474a65fdfcec8e24..9dde0a39912899c821ff80c318489c86cde8b25b 100644 (file)
@@ -128,7 +128,7 @@ const char *cgit_repobasename(const char *reponame)
        /* strip trailing slashes */
        while (p && rvbuf[p] == '/') rvbuf[p--] = 0;
        /* strip trailing .git */
-       if (p >= 3 && !prefixcmp(&rvbuf[p-3], ".git")) {
+       if (p >= 3 && starts_with(&rvbuf[p-3], ".git")) {
                p -= 3; rvbuf[p--] = 0;
        }
        /* strip more trailing slashes if any */
@@ -596,6 +596,8 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format)
                return;
        time(&now);
        secs = now - t;
+       if (secs < 0)
+               secs = 0;
 
        if (secs > max_relative && max_relative >= 0) {
                cgit_print_date(t, format, ctx.cfg.local_time);
@@ -859,6 +861,10 @@ void cgit_print_pageheader(void)
 
        html("<table class='tabs'><tr><td>\n");
        if (ctx.env.authenticated && ctx.repo) {
+               if (ctx.repo->readme.nr)
+                       reporevlink("about", "about", NULL,
+                                   hc("about"), ctx.qry.head, NULL,
+                                   NULL);
                cgit_summary_link("summary", NULL, hc("summary"),
                                  ctx.qry.head);
                cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head,
@@ -875,10 +881,6 @@ void cgit_print_pageheader(void)
                if (ctx.repo->max_stats)
                        cgit_stats_link("stats", NULL, hc("stats"),
                                        ctx.qry.head, ctx.qry.vpath);
-               if (ctx.repo->readme.nr)
-                       reporevlink("about", "about", NULL,
-                                   hc("about"), ctx.qry.head, NULL,
-                                   NULL);
                html("</td><td class='form'>");
                html("<form class='right' method='get' action='");
                if (ctx.cfg.virtual_root)