aboutsummaryrefslogtreecommitdiffstats
path: root/ui-plain.c
diff options
context:
space:
mode:
authorGravatar Lukas Fleischer <cgit@cryptocrack.de>2014-01-16 05:53:15 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-17 08:44:54 (JST)
commitf60ffa143cca61e9729ac71033e1a556cf422871 (patch)
treeff9122fef2779ddea8e37806cc66dc67b63df99f /ui-plain.c
parenta431326e8fab8153905fbde036dd3c9fb4cc8eaa (diff)
downloadcgit-f60ffa143cca61e9729ac71033e1a556cf422871.zip
cgit-f60ffa143cca61e9729ac71033e1a556cf422871.tar.gz
Switch to exclusively using global ctx
Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_print_http_headers() * cgit_print_docstart() * cgit_print_pageheader() Remove context parameter from all commands Drop the context parameter from the following functions (and all static helpers used by them) and use the global context instead: * cgit_get_cmd() * All cgit command functions. * cgit_clone_info() * cgit_clone_objects() * cgit_clone_head() * cgit_print_plain() * cgit_show_stats() In initialization routines, use the global context variable instead of passing a pointer around locally. Remove callback data parameter for cache slots This is no longer needed since the context is always read from the global context variable. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'ui-plain.c')
-rw-r--r--ui-plain.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ui-plain.c b/ui-plain.c
index 68e0387..30fff89 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -103,7 +103,7 @@ static int print_object(const unsigned char *sha1, const char *path)
103 ctx.page.filename = path; 103 ctx.page.filename = path;
104 ctx.page.size = size; 104 ctx.page.size = size;
105 ctx.page.etag = sha1_to_hex(sha1); 105 ctx.page.etag = sha1_to_hex(sha1);
106 cgit_print_http_headers(&ctx); 106 cgit_print_http_headers();
107 html_raw(buf, size); 107 html_raw(buf, size);
108 /* If we allocated this, then casting away const is safe. */ 108 /* If we allocated this, then casting away const is safe. */
109 if (freemime) 109 if (freemime)
@@ -128,7 +128,7 @@ static void print_dir(const unsigned char *sha1, const char *base,
128 fullpath = buildpath(base, baselen, path); 128 fullpath = buildpath(base, baselen, path);
129 slash = (fullpath[0] == '/' ? "" : "/"); 129 slash = (fullpath[0] == '/' ? "" : "/");
130 ctx.page.etag = sha1_to_hex(sha1); 130 ctx.page.etag = sha1_to_hex(sha1);
131 cgit_print_http_headers(&ctx); 131 cgit_print_http_headers();
132 htmlf("<html><head><title>%s", slash); 132 htmlf("<html><head><title>%s", slash);
133 html_txt(fullpath); 133 html_txt(fullpath);
134 htmlf("</title></head>\n<body>\n<h2>%s", slash); 134 htmlf("</title></head>\n<body>\n<h2>%s", slash);
@@ -206,14 +206,14 @@ static int basedir_len(const char *path)
206 return 0; 206 return 0;
207} 207}
208 208
209void cgit_print_plain(struct cgit_context *ctx) 209void cgit_print_plain(void)
210{ 210{
211 const char *rev = ctx->qry.sha1; 211 const char *rev = ctx.qry.sha1;
212 unsigned char sha1[20]; 212 unsigned char sha1[20];
213 struct commit *commit; 213 struct commit *commit;
214 struct pathspec_item path_items = { 214 struct pathspec_item path_items = {
215 .match = ctx->qry.path, 215 .match = ctx.qry.path,
216 .len = ctx->qry.path ? strlen(ctx->qry.path) : 0 216 .len = ctx.qry.path ? strlen(ctx.qry.path) : 0
217 }; 217 };
218 struct pathspec paths = { 218 struct pathspec paths = {
219 .nr = 1, 219 .nr = 1,
@@ -224,7 +224,7 @@ void cgit_print_plain(struct cgit_context *ctx)
224 }; 224 };
225 225
226 if (!rev) 226 if (!rev)
227 rev = ctx->qry.head; 227 rev = ctx.qry.head;
228 228
229 if (get_sha1(rev, sha1)) { 229 if (get_sha1(rev, sha1)) {
230 html_status(404, "Not found", 0); 230 html_status(404, "Not found", 0);