From d14d77fe95c3b6224b40df9b101dded0deea913c Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 16 Feb 2008 11:53:40 +0100 Subject: Introduce struct cgit_context This struct will hold all the cgit runtime information currently found in a multitude of global variables. The first cleanup removes all querystring-related variables. Signed-off-by: Lars Hjemli --- ui-patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-patch.c') diff --git a/ui-patch.c b/ui-patch.c index e7a010a..1da0a27 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -76,7 +76,7 @@ void cgit_print_patch(char *hex, struct cacheitem *item) char *patchname; if (!hex) - hex = cgit_query_head; + hex = ctx.qry.head; if (get_sha1(hex, sha1)) { cgit_print_error(fmt("Bad object id: %s", hex)); -- cgit v1.2.1 From b1f9b9c1459cb9a30ebf80721aff6ef788d1f891 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 23 Feb 2008 22:45:33 +0100 Subject: Introduce html.h All html-functions can be quite easily separated from the rest of cgit, so lets do it; the only issue was html_filemode which uses some git-defined macros so the function is moved into ui-shared.c::cgit_print_filemode(). Signed-off-by: Lars Hjemli --- ui-patch.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ui-patch.c') diff --git a/ui-patch.c b/ui-patch.c index 1da0a27..d93426b 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -7,6 +7,7 @@ */ #include "cgit.h" +#include "html.h" static void print_line(char *line, int len) { -- cgit v1.2.1 From f3c1a187fe2bc33f8423cd535d5045899699995b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 00:51:19 +0100 Subject: Add struct cgit_page to cgit_context This struct is used when generating http headers, and as such is another small step towards the goal of the whole cleanup series; to invoke each page/view function with a function pointer. Signed-off-by: Lars Hjemli --- ui-patch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui-patch.c') diff --git a/ui-patch.c b/ui-patch.c index d93426b..a77f3f6 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -92,7 +92,9 @@ void cgit_print_patch(char *hex, struct cacheitem *item) hashcpy(old_sha1, commit->parents->item->object.sha1); patchname = fmt("%s.patch", sha1_to_hex(sha1)); - cgit_print_snapshot_start("text/plain", patchname, item); + ctx.page.mimetype = "text/plain"; + ctx.page.filename = patchname; + cgit_print_http_headers(&ctx); htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); htmlf("From: %s%s\n", info->author, info->author_email); html("Date: "); -- cgit v1.2.1 From b608e88adb6f77328288afb6dd0eddf674fc9b5b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 01:00:36 +0100 Subject: Remove obsolete cacheitem parameter to ui-functions This parameter hasn't been used for a very long time... Signed-off-by: Lars Hjemli --- ui-patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-patch.c') diff --git a/ui-patch.c b/ui-patch.c index a77f3f6..68ebb15 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -69,7 +69,7 @@ static void filepair_cb(struct diff_filepair *pair) html("Error running diff"); } -void cgit_print_patch(char *hex, struct cacheitem *item) +void cgit_print_patch(char *hex) { struct commit *commit; struct commitinfo *info; -- cgit v1.2.1 From a4d1ca1dc6ff8171694d9e2280b6075a1beced0c Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 16:50:57 +0100 Subject: Add ui-shared.h This is finally a proper headerfile for the shared ui-functions which used to reside in cgit.h Signed-off-by: Lars Hjemli --- ui-patch.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ui-patch.c') diff --git a/ui-patch.c b/ui-patch.c index 68ebb15..36bfae4 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -8,6 +8,7 @@ #include "cgit.h" #include "html.h" +#include "ui-shared.h" static void print_line(char *line, int len) { -- cgit v1.2.1