|
diff --git a/shared.c b/shared.c index 6fd70a8..5757d0c 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -35,28 +35,43 @@ char *cgit_repo_owner = NULL; |
35 | |
35 | |
36 | int cgit_query_has_symref = 0; |
36 | int cgit_query_has_symref = 0; |
37 | int cgit_query_has_sha1 = 0; |
37 | int cgit_query_has_sha1 = 0; |
38 | |
38 | |
39 | char *cgit_querystring = NULL; |
39 | char *cgit_querystring = NULL; |
40 | char *cgit_query_repo = NULL; |
40 | char *cgit_query_repo = NULL; |
41 | char *cgit_query_page = NULL; |
41 | char *cgit_query_page = NULL; |
42 | char *cgit_query_head = NULL; |
42 | char *cgit_query_head = NULL; |
43 | char *cgit_query_search = NULL; |
43 | char *cgit_query_search = NULL; |
44 | char *cgit_query_sha1 = NULL; |
44 | char *cgit_query_sha1 = NULL; |
45 | char *cgit_query_sha2 = NULL; |
45 | char *cgit_query_sha2 = NULL; |
46 | char *cgit_query_path = NULL; |
46 | char *cgit_query_path = NULL; |
| |
47 | char *cgit_query_name = NULL; |
47 | int cgit_query_ofs = 0; |
48 | int cgit_query_ofs = 0; |
48 | |
49 | |
49 | int htmlfd = 0; |
50 | int htmlfd = 0; |
50 | |
51 | |
| |
52 | int chk_zero(int result, char *msg) |
| |
53 | { |
| |
54 | if (result != 0) |
| |
55 | die("%s: %s", msg, strerror(errno)); |
| |
56 | return result; |
| |
57 | } |
| |
58 | |
| |
59 | int chk_positive(int result, char *msg) |
| |
60 | { |
| |
61 | if (result <= 0) |
| |
62 | die("%s: %s", msg, strerror(errno)); |
| |
63 | return result; |
| |
64 | } |
| |
65 | |
51 | struct repoinfo *add_repo(const char *url) |
66 | struct repoinfo *add_repo(const char *url) |
52 | { |
67 | { |
53 | struct repoinfo *ret; |
68 | struct repoinfo *ret; |
54 | |
69 | |
55 | if (++cgit_repolist.count > cgit_repolist.length) { |
70 | if (++cgit_repolist.count > cgit_repolist.length) { |
56 | if (cgit_repolist.length == 0) |
71 | if (cgit_repolist.length == 0) |
57 | cgit_repolist.length = 8; |
72 | cgit_repolist.length = 8; |
58 | else |
73 | else |
59 | cgit_repolist.length *= 2; |
74 | cgit_repolist.length *= 2; |
60 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
75 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
61 | cgit_repolist.length * |
76 | cgit_repolist.length * |
62 | sizeof(struct repoinfo)); |
77 | sizeof(struct repoinfo)); |
@@ -131,24 +146,26 @@ void cgit_querystring_cb(const char *name, const char *value) |
131 | cgit_query_head = xstrdup(value); |
146 | cgit_query_head = xstrdup(value); |
132 | cgit_query_has_symref = 1; |
147 | cgit_query_has_symref = 1; |
133 | } else if (!strcmp(name, "id")) { |
148 | } else if (!strcmp(name, "id")) { |
134 | cgit_query_sha1 = xstrdup(value); |
149 | cgit_query_sha1 = xstrdup(value); |
135 | cgit_query_has_sha1 = 1; |
150 | cgit_query_has_sha1 = 1; |
136 | } else if (!strcmp(name, "id2")) { |
151 | } else if (!strcmp(name, "id2")) { |
137 | cgit_query_sha2 = xstrdup(value); |
152 | cgit_query_sha2 = xstrdup(value); |
138 | cgit_query_has_sha1 = 1; |
153 | cgit_query_has_sha1 = 1; |
139 | } else if (!strcmp(name, "ofs")) { |
154 | } else if (!strcmp(name, "ofs")) { |
140 | cgit_query_ofs = atoi(value); |
155 | cgit_query_ofs = atoi(value); |
141 | } else if (!strcmp(name, "path")) { |
156 | } else if (!strcmp(name, "path")) { |
142 | cgit_query_path = xstrdup(value); |
157 | cgit_query_path = xstrdup(value); |
| |
158 | } else if (!strcmp(name, "name")) { |
| |
159 | cgit_query_name = xstrdup(value); |
143 | } |
160 | } |
144 | } |
161 | } |
145 | |
162 | |
146 | void *cgit_free_commitinfo(struct commitinfo *info) |
163 | void *cgit_free_commitinfo(struct commitinfo *info) |
147 | { |
164 | { |
148 | free(info->author); |
165 | free(info->author); |
149 | free(info->author_email); |
166 | free(info->author_email); |
150 | free(info->committer); |
167 | free(info->committer); |
151 | free(info->committer_email); |
168 | free(info->committer_email); |
152 | free(info->subject); |
169 | free(info->subject); |
153 | free(info); |
170 | free(info); |
154 | return NULL; |
171 | return NULL; |
|