diff options
author | Lukas Fleischer <cgit@cryptocrack.de> | 2014-01-16 05:53:15 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-17 08:44:54 (JST) |
commit | f60ffa143cca61e9729ac71033e1a556cf422871 (patch) | |
tree | ff9122fef2779ddea8e37806cc66dc67b63df99f /ui-clone.c | |
parent | a431326e8fab8153905fbde036dd3c9fb4cc8eaa (diff) | |
download | cgit-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-clone.c')
-rw-r--r-- | ui-clone.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -29,22 +29,22 @@ static int print_ref_info(const char *refname, const unsigned char *sha1, | |||
29 | return 0; | 29 | return 0; |
30 | } | 30 | } |
31 | 31 | ||
32 | static void print_pack_info(struct cgit_context *ctx) | 32 | static void print_pack_info(void) |
33 | { | 33 | { |
34 | struct packed_git *pack; | 34 | struct packed_git *pack; |
35 | int ofs; | 35 | int ofs; |
36 | 36 | ||
37 | ctx->page.mimetype = "text/plain"; | 37 | ctx.page.mimetype = "text/plain"; |
38 | ctx->page.filename = "objects/info/packs"; | 38 | ctx.page.filename = "objects/info/packs"; |
39 | cgit_print_http_headers(ctx); | 39 | cgit_print_http_headers(); |
40 | ofs = strlen(ctx->repo->path) + strlen("/objects/pack/"); | 40 | ofs = strlen(ctx.repo->path) + strlen("/objects/pack/"); |
41 | prepare_packed_git(); | 41 | prepare_packed_git(); |
42 | for (pack = packed_git; pack; pack = pack->next) | 42 | for (pack = packed_git; pack; pack = pack->next) |
43 | if (pack->pack_local) | 43 | if (pack->pack_local) |
44 | htmlf("P %s\n", pack->pack_name + ofs); | 44 | htmlf("P %s\n", pack->pack_name + ofs); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void send_file(struct cgit_context *ctx, char *path) | 47 | static void send_file(char *path) |
48 | { | 48 | { |
49 | struct stat st; | 49 | struct stat st; |
50 | 50 | ||
@@ -61,41 +61,41 @@ static void send_file(struct cgit_context *ctx, char *path) | |||
61 | } | 61 | } |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | ctx->page.mimetype = "application/octet-stream"; | 64 | ctx.page.mimetype = "application/octet-stream"; |
65 | ctx->page.filename = path; | 65 | ctx.page.filename = path; |
66 | if (prefixcmp(ctx->repo->path, path)) | 66 | if (prefixcmp(ctx.repo->path, path)) |
67 | ctx->page.filename += strlen(ctx->repo->path) + 1; | 67 | ctx.page.filename += strlen(ctx.repo->path) + 1; |
68 | cgit_print_http_headers(ctx); | 68 | cgit_print_http_headers(); |
69 | html_include(path); | 69 | html_include(path); |
70 | } | 70 | } |
71 | 71 | ||
72 | void cgit_clone_info(struct cgit_context *ctx) | 72 | void cgit_clone_info(void) |
73 | { | 73 | { |
74 | if (!ctx->qry.path || strcmp(ctx->qry.path, "refs")) | 74 | if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) |
75 | return; | 75 | return; |
76 | 76 | ||
77 | ctx->page.mimetype = "text/plain"; | 77 | ctx.page.mimetype = "text/plain"; |
78 | ctx->page.filename = "info/refs"; | 78 | ctx.page.filename = "info/refs"; |
79 | cgit_print_http_headers(ctx); | 79 | cgit_print_http_headers(); |
80 | for_each_ref(print_ref_info, ctx); | 80 | for_each_ref(print_ref_info, NULL); |
81 | } | 81 | } |
82 | 82 | ||
83 | void cgit_clone_objects(struct cgit_context *ctx) | 83 | void cgit_clone_objects(void) |
84 | { | 84 | { |
85 | if (!ctx->qry.path) { | 85 | if (!ctx.qry.path) { |
86 | html_status(400, "Bad request", 0); | 86 | html_status(400, "Bad request", 0); |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | 89 | ||
90 | if (!strcmp(ctx->qry.path, "info/packs")) { | 90 | if (!strcmp(ctx.qry.path, "info/packs")) { |
91 | print_pack_info(ctx); | 91 | print_pack_info(); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||
95 | send_file(ctx, git_path("objects/%s", ctx->qry.path)); | 95 | send_file(git_path("objects/%s", ctx.qry.path)); |
96 | } | 96 | } |
97 | 97 | ||
98 | void cgit_clone_head(struct cgit_context *ctx) | 98 | void cgit_clone_head(void) |
99 | { | 99 | { |
100 | send_file(ctx, git_path("%s", "HEAD")); | 100 | send_file(git_path("%s", "HEAD")); |
101 | } | 101 | } |