author | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:00:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:00:27 (UTC) |
commit | f34478cbe0214a201e7ecef3e79ed6c957b7beee (patch) (unidiff) | |
tree | 1ee05da742488cab51a06e083d26b7b58d829b43 /cgit.h | |
parent | e0e4478e7b4812f822d60a13a33525f8e529e1e8 (diff) | |
download | cgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.zip cgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.tar.gz cgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.tar.bz2 |
Refactor snapshot support
The snapshot support needs to be split between output- and config-related
functions to get the layering between shared.c and ui-*.c right. There
is also some codestyle-issues which needs fixing to make the snapshot
functions more similar to the rest of the cgit code.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -156,52 +156,60 @@ struct cgit_config { | |||
156 | int nocache; | 156 | int nocache; |
157 | int renamelimit; | 157 | int renamelimit; |
158 | int snapshots; | 158 | int snapshots; |
159 | int summary_branches; | 159 | int summary_branches; |
160 | int summary_log; | 160 | int summary_log; |
161 | int summary_tags; | 161 | int summary_tags; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | struct cgit_page { | 164 | struct cgit_page { |
165 | time_t modified; | 165 | time_t modified; |
166 | time_t expires; | 166 | time_t expires; |
167 | char *mimetype; | 167 | char *mimetype; |
168 | char *charset; | 168 | char *charset; |
169 | char *filename; | 169 | char *filename; |
170 | char *title; | 170 | char *title; |
171 | }; | 171 | }; |
172 | 172 | ||
173 | struct cgit_context { | 173 | struct cgit_context { |
174 | struct cgit_query qry; | 174 | struct cgit_query qry; |
175 | struct cgit_config cfg; | 175 | struct cgit_config cfg; |
176 | struct cgit_repo *repo; | 176 | struct cgit_repo *repo; |
177 | struct cgit_page page; | 177 | struct cgit_page page; |
178 | }; | 178 | }; |
179 | 179 | ||
180 | struct cgit_snapshot_format { | ||
181 | const char *suffix; | ||
182 | const char *mimetype; | ||
183 | write_archive_fn_t write_func; | ||
184 | int bit; | ||
185 | }; | ||
186 | |||
180 | extern const char *cgit_version; | 187 | extern const char *cgit_version; |
181 | 188 | ||
182 | extern struct cgit_repolist cgit_repolist; | 189 | extern struct cgit_repolist cgit_repolist; |
183 | extern struct cgit_context ctx; | 190 | extern struct cgit_context ctx; |
191 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; | ||
184 | extern int cgit_cmd; | 192 | extern int cgit_cmd; |
185 | 193 | ||
186 | extern void cgit_prepare_context(struct cgit_context *ctx); | 194 | extern void cgit_prepare_context(struct cgit_context *ctx); |
187 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); | 195 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); |
188 | extern void cgit_global_config_cb(const char *name, const char *value); | 196 | extern void cgit_global_config_cb(const char *name, const char *value); |
189 | extern void cgit_repo_config_cb(const char *name, const char *value); | 197 | extern void cgit_repo_config_cb(const char *name, const char *value); |
190 | extern void cgit_querystring_cb(const char *name, const char *value); | 198 | extern void cgit_querystring_cb(const char *name, const char *value); |
191 | 199 | ||
192 | extern int chk_zero(int result, char *msg); | 200 | extern int chk_zero(int result, char *msg); |
193 | extern int chk_positive(int result, char *msg); | 201 | extern int chk_positive(int result, char *msg); |
194 | extern int chk_non_negative(int result, char *msg); | 202 | extern int chk_non_negative(int result, char *msg); |
195 | 203 | ||
196 | extern int hextoint(char c); | 204 | extern int hextoint(char c); |
197 | extern char *trim_end(const char *str, char c); | 205 | extern char *trim_end(const char *str, char c); |
198 | extern char *strlpart(char *txt, int maxlen); | 206 | extern char *strlpart(char *txt, int maxlen); |
199 | extern char *strrpart(char *txt, int maxlen); | 207 | extern char *strrpart(char *txt, int maxlen); |
200 | 208 | ||
201 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); | 209 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); |
202 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, | 210 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, |
203 | int flags, void *cb_data); | 211 | int flags, void *cb_data); |
204 | 212 | ||
205 | extern void *cgit_free_commitinfo(struct commitinfo *info); | 213 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
206 | 214 | ||
207 | extern int cgit_diff_files(const unsigned char *old_sha1, | 215 | extern int cgit_diff_files(const unsigned char *old_sha1, |