diff options
context:
space:
mode:
Diffstat (limited to 'source/scan-tree.c')
-rw-r--r--source/scan-tree.c21
1 file changed, 11 insertions, 10 deletions
diff --git a/source/scan-tree.c b/source/scan-tree.c
index 7e626bf..89f65c9 100644
--- a/source/scan-tree.c
+++ b/source/scan-tree.c
@@ -12,6 +12,11 @@
#include "html.h"
#include <config.h>
+// The description git puts in every freshly created repository.
+static const char *default_git_desc = "Unnamed repository; edit this file 'description' to name the repository.";
+
+static struct cgit_repo *repo;
+
/* return 1 if path contains a objects/ directory and a HEAD file */
static int is_git_dir(const char *path)
{
@@ -46,18 +51,14 @@ out:
return result;
}
-// The description git puts in every freshly created repository.
-static const char *default_git_desc = "Unnamed repository; edit this file 'description' to name the repository.";
-
-static struct cgit_repo *repo;
-
static void scan_tree_repo_config(const char *name, const char *value)
{
cgit_repo_config(repo, name, value);
}
static int gitconfig_config(const char *key, const char *value,
- const __attribute__((unused)) struct config_context *ctx, void *cb)
+ const __attribute__((unused)) struct config_context *cfg_ctx,
+ void *cb)
{
const char *name;
@@ -139,7 +140,7 @@ static void add_repo(const char *base, struct strbuf *path)
strip_suffix_mem(repo->url, &urllen, "/");
repo->url[urllen] = '\0';
}
- repo->path = strdup_first_line(path->buf);
+ repo->path = cgit_strdup_first_line(path->buf);
while (!repo->owner) {
if ((pwd = getpwuid(st.st_uid)) == NULL) {
fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n",
@@ -149,13 +150,13 @@ static void add_repo(const char *base, struct strbuf *path)
if (pwd->pw_gecos)
if ((p = strchr(pwd->pw_gecos, ',')))
*p = '\0';
- repo->owner = strdup_first_line(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name);
+ repo->owner = cgit_strdup_first_line(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name);
}
if (repo->desc == cgit_default_repo_desc || !repo->desc) {
strbuf_addstr(path, "description");
if (!stat(path->buf, &st))
- read_first_line(path->buf, &repo->desc, &size);
+ cgit_read_first_line(path->buf, &repo->desc, &size);
strbuf_setlen(path, pathlen);
// Git writes this line into every repository it creates, so it
// describes nothing. Treat it as no description at all rather
@@ -179,7 +180,7 @@ static void add_repo(const char *base, struct strbuf *path)
}
if (slash && !n) {
*slash = '\0';
- repo->section = strdup_first_line(rel.buf);
+ repo->section = cgit_strdup_first_line(rel.buf);
*slash = '/';
if (starts_with(repo->name, repo->section)) {
repo->name += strlen(repo->section);