summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--ui-shared.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/cgit.c b/cgit.c
index e46c00a..9305d0a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -239,49 +239,49 @@ static void querystring_cb(const char *name, const char *value)
} else if (!strcmp(name, "path")) {
ctx.qry.path = trim_end(value, '/');
} else if (!strcmp(name, "name")) {
ctx.qry.name = xstrdup(value);
} else if (!strcmp(name, "mimetype")) {
ctx.qry.mimetype = xstrdup(value);
} else if (!strcmp(name, "s")){
ctx.qry.sort = xstrdup(value);
} else if (!strcmp(name, "showmsg")) {
ctx.qry.showmsg = atoi(value);
} else if (!strcmp(name, "period")) {
ctx.qry.period = xstrdup(value);
} else if (!strcmp(name, "ss")) {
ctx.qry.ssdiff = atoi(value);
}
}
char *xstrdupn(const char *str)
{
return (str ? xstrdup(str) : NULL);
}
static void prepare_context(struct cgit_context *ctx)
{
- memset(ctx, 0, sizeof(ctx));
+ memset(ctx, 0, sizeof(*ctx));
ctx->cfg.agefile = "info/web/last-modified";
ctx->cfg.nocache = 0;
ctx->cfg.cache_size = 0;
ctx->cfg.cache_dynamic_ttl = 5;
ctx->cfg.cache_max_create_time = 5;
ctx->cfg.cache_repo_ttl = 5;
ctx->cfg.cache_root = CGIT_CACHE_ROOT;
ctx->cfg.cache_root_ttl = 5;
ctx->cfg.cache_scanrc_ttl = 15;
ctx->cfg.cache_static_ttl = -1;
ctx->cfg.css = "/cgit.css";
ctx->cfg.logo = "/cgit.png";
ctx->cfg.local_time = 0;
ctx->cfg.enable_tree_linenumbers = 1;
ctx->cfg.max_repo_count = 50;
ctx->cfg.max_commit_count = 50;
ctx->cfg.max_lock_attempts = 5;
ctx->cfg.max_msg_len = 80;
ctx->cfg.max_repodesc_len = 80;
ctx->cfg.max_blob_size = 0;
ctx->cfg.max_stats = 0;
ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
ctx->cfg.renamelimit = -1;
ctx->cfg.robots = "index, nofollow";
diff --git a/ui-shared.c b/ui-shared.c
index 08ea003..8827fff 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -225,49 +225,49 @@ static char *repolink(char *title, char *class, char *page, char *head,
html("/");
if (page) {
html_url_arg(page);
html("/");
if (path)
html_url_arg(path);
}
delim = "&";
}
if (head && strcmp(head, ctx.repo->defbranch)) {
html(delim);
html("h=");
html_url_arg(head);
delim = "&";
}
return fmt("%s", delim);
}
static void reporevlink(char *page, char *name, char *title, char *class,
char *head, char *rev, char *path)
{
char *delim;
delim = repolink(title, class, page, head, path);
- if (rev && strcmp(rev, ctx.qry.head)) {
+ if (rev && ctx.qry.head != NULL && strcmp(rev, ctx.qry.head)) {
html(delim);
html("id=");
html_url_arg(rev);
}
html("'>");
html_txt(name);
html("</a>");
}
void cgit_summary_link(char *name, char *title, char *class, char *head)
{
reporevlink(NULL, name, title, class, head, NULL, NULL);
}
void cgit_tag_link(char *name, char *title, char *class, char *head,
char *rev)
{
reporevlink("tag", name, title, class, head, rev, NULL);
}
void cgit_tree_link(char *name, char *title, char *class, char *head,
char *rev, char *path)
{
reporevlink("tree", name, title, class, head, rev, path);
@@ -342,49 +342,49 @@ void cgit_commit_link(char *name, char *title, char *class, char *head,
html("'>");
html_txt(name);
html("</a>");
}
void cgit_refs_link(char *name, char *title, char *class, char *head,
char *rev, char *path)
{
reporevlink("refs", name, title, class, head, rev, path);
}
void cgit_snapshot_link(char *name, char *title, char *class, char *head,
char *rev, char *archivename)
{
reporevlink("snapshot", name, title, class, head, rev, archivename);
}
void cgit_diff_link(char *name, char *title, char *class, char *head,
char *new_rev, char *old_rev, char *path,
int toggle_ssdiff)
{
char *delim;
delim = repolink(title, class, "diff", head, path);
- if (new_rev && strcmp(new_rev, ctx.qry.head)) {
+ if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) {
html(delim);
html("id=");
html_url_arg(new_rev);
delim = "&amp;";
}
if (old_rev) {
html(delim);
html("id2=");
html_url_arg(old_rev);
delim = "&amp;";
}
if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) {
html(delim);
html("ss=1");
}
html("'>");
html_txt(name);
html("</a>");
}
void cgit_patch_link(char *name, char *title, char *class, char *head,
char *rev)
{
reporevlink("patch", name, title, class, head, rev, NULL);