const char *cgit_version = CGIT_VERSION;
-void add_mimetype(const char *name, const char *value)
+static void add_mimetype(const char *name, const char *value)
{
struct string_list_item *item;
item->util = xstrdup(value);
}
-struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
+static struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
{
struct cgit_filter *f;
int args_size = 0;
static void process_cached_repolist(const char *path);
-void repo_config(struct cgit_repo *repo, const char *name, const char *value)
+static void repo_config(struct cgit_repo *repo, const char *name, const char *value)
{
struct string_list_item *item;
}
}
-void config_cb(const char *name, const char *value)
+static void config_cb(const char *name, const char *value)
{
if (!strcmp(name, "section") || !strcmp(name, "repo.group"))
ctx.cfg.section = xstrdup(value);
ctx.qry.name = xstrdup(value);
} else if (!strcmp(name, "mimetype")) {
ctx.qry.mimetype = xstrdup(value);
- } else if (!strcmp(name, "s")){
+ } else if (!strcmp(name, "s")) {
ctx.qry.sort = xstrdup(value);
} else if (!strcmp(name, "showmsg")) {
ctx.qry.showmsg = atoi(value);
}
}
-char *xstrdupn(const char *str)
+static char *xstrdupn(const char *str)
{
return (str ? xstrdup(str) : NULL);
}
int match;
};
-int find_current_ref(const char *refname, const unsigned char *sha1,
- int flags, void *cb_data)
+static int find_current_ref(const char *refname, const unsigned char *sha1,
+ int flags, void *cb_data)
{
struct refmatch *info;
return info->match;
}
-char *find_default_branch(struct cgit_repo *repo)
+static void free_refmatch_inner(struct refmatch *info)
+{
+ if (info->first_ref)
+ free(info->first_ref);
+}
+
+static char *find_default_branch(struct cgit_repo *repo)
{
struct refmatch info;
char *ref;
ref = info.first_ref;
if (ref)
ref = xstrdup(ref);
+ free_refmatch_inner(&info);
+
return ref;
}
-static char *guess_defbranch(const char *repo_path)
+static char *guess_defbranch(void)
{
const char *ref;
unsigned char sha1[20];
ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc);
if (!ctx->repo->defbranch)
- ctx->repo->defbranch = guess_defbranch(ctx->repo->path);
+ ctx->repo->defbranch = guess_defbranch();
if (!ctx->qry.head) {
ctx->qry.nohead = 1;
cgit_print_docend();
}
-int cmp_repos(const void *a, const void *b)
+static int cmp_repos(const void *a, const void *b)
{
const struct cgit_repo *ra = a, *rb = b;
return strcmp(ra->url, rb->url);
}
-char *build_snapshot_setting(int bitmap)
+static char *build_snapshot_setting(int bitmap)
{
const struct cgit_snapshot_format *f;
char *result = xstrdup("");
return result;
}
-char *get_first_line(char *txt)
+static char *get_first_line(char *txt)
{
char *t = xstrdup(txt);
char *p = strchr(t, '\n');
return t;
}
-void print_repo(FILE *f, struct cgit_repo *repo)
+static void print_repo(FILE *f, struct cgit_repo *repo)
{
fprintf(f, "repo.url=%s\n", repo->url);
fprintf(f, "repo.name=%s\n", repo->name);
fprintf(f, "\n");
}
-void print_repolist(FILE *f, struct cgit_repolist *list, int start)
+static void print_repolist(FILE *f, struct cgit_repolist *list, int start)
{
int i;
- for(i = start; i < list->count; i++)
+ for (i = start; i < list->count; i++)
print_repo(f, &list->repos[i]);
}