aboutsummaryrefslogtreecommitdiffstats
path: root/parsing.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2008-02-16 21:56:09 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2008-02-16 21:56:09 (JST)
commitd1f3bbe9d22029f45a77bb938c176ccc0c827d46 (patch)
tree3f1741c012763cbc5485f31377abdd9241fbac6b /parsing.c
parentb228d4ff82a65fdcd4a7364759fe36a0bdda5978 (diff)
downloadcgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.zip
cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.tar.gz
Move cgit_repo into cgit_context
This removes the global variable which is used to keep track of the currently selected repository, and adds a new variable in the cgit_context structure. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'parsing.c')
-rw-r--r--parsing.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/parsing.c b/parsing.c
index 8cf56a4..027f06b 100644
--- a/parsing.c
+++ b/parsing.c
@@ -143,27 +143,27 @@ void cgit_parse_url(const char *url)
143{ 143{
144 char *cmd, *p; 144 char *cmd, *p;
145 145
146 cgit_repo = NULL; 146 ctx.repo = NULL;
147 if (!url || url[0] == '\0') 147 if (!url || url[0] == '\0')
148 return; 148 return;
149 149
150 cgit_repo = cgit_get_repoinfo(url); 150 ctx.repo = cgit_get_repoinfo(url);
151 if (cgit_repo) { 151 if (ctx.repo) {
152 ctx.qry.repo = cgit_repo->url; 152 ctx.qry.repo = ctx.repo->url;
153 return; 153 return;
154 } 154 }
155 155
156 cmd = strchr(url, '/'); 156 cmd = strchr(url, '/');
157 while (!cgit_repo && cmd) { 157 while (!ctx.repo && cmd) {
158 cmd[0] = '\0'; 158 cmd[0] = '\0';
159 cgit_repo = cgit_get_repoinfo(url); 159 ctx.repo = cgit_get_repoinfo(url);
160 if (cgit_repo == NULL) { 160 if (ctx.repo == NULL) {
161 cmd[0] = '/'; 161 cmd[0] = '/';
162 cmd = strchr(cmd + 1, '/'); 162 cmd = strchr(cmd + 1, '/');
163 continue; 163 continue;
164 } 164 }
165 165
166 ctx.qry.repo = cgit_repo->url; 166 ctx.qry.repo = ctx.repo->url;
167 p = strchr(cmd + 1, '/'); 167 p = strchr(cmd + 1, '/');
168 if (p) { 168 if (p) {
169 p[0] = '\0'; 169 p[0] = '\0';