summaryrefslogtreecommitdiffabout
path: root/shared.c
Side-by-side diff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/shared.c b/shared.c
index 76d26dd..9f7d6a5 100644
--- a/shared.c
+++ b/shared.c
@@ -12,3 +12,2 @@ struct cgit_repolist cgit_repolist;
struct cgit_context ctx;
-int cgit_cmd;
@@ -62,2 +61,3 @@ struct cgit_repo *cgit_add_repo(const char *url)
ret->enable_remote_branches = ctx.cfg.enable_remote_branches;
+ ret->enable_subject_links = ctx.cfg.enable_subject_links;
ret->max_stats = ctx.cfg.max_stats;
@@ -265,3 +265,4 @@ int cgit_diff_files(const unsigned char *old_sha1,
const unsigned char *new_sha1, unsigned long *old_size,
- unsigned long *new_size, int *binary, linediff_fn fn)
+ unsigned long *new_size, int *binary, int context,
+ linediff_fn fn)
{
@@ -281,2 +282,6 @@ int cgit_diff_files(const unsigned char *old_sha1,
*binary = 1;
+ if (file1.size)
+ free(file1.ptr);
+ if (file2.size)
+ free(file2.ptr);
return 0;
@@ -288,3 +293,3 @@ int cgit_diff_files(const unsigned char *old_sha1,
diff_params.flags = XDF_NEED_MINIMAL;
- emit_params.ctxlen = 3;
+ emit_params.ctxlen = context > 0 ? context : 3;
emit_params.flags = XDL_EMIT_FUNCNAMES;
@@ -293,2 +298,6 @@ int cgit_diff_files(const unsigned char *old_sha1,
xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb);
+ if (file1.size)
+ free(file1.ptr);
+ if (file2.size)
+ free(file2.ptr);
return 0;