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
@@ -132,100 +132,108 @@ struct cgit_config { | |||
132 | char *clone_prefix; | 132 | char *clone_prefix; |
133 | char *css; | 133 | char *css; |
134 | char *index_header; | 134 | char *index_header; |
135 | char *index_info; | 135 | char *index_info; |
136 | char *logo; | 136 | char *logo; |
137 | char *logo_link; | 137 | char *logo_link; |
138 | char *module_link; | 138 | char *module_link; |
139 | char *repo_group; | 139 | char *repo_group; |
140 | char *robots; | 140 | char *robots; |
141 | char *root_title; | 141 | char *root_title; |
142 | char *script_name; | 142 | char *script_name; |
143 | char *virtual_root; | 143 | char *virtual_root; |
144 | int cache_dynamic_ttl; | 144 | int cache_dynamic_ttl; |
145 | int cache_max_create_time; | 145 | int cache_max_create_time; |
146 | int cache_repo_ttl; | 146 | int cache_repo_ttl; |
147 | int cache_root_ttl; | 147 | int cache_root_ttl; |
148 | int cache_static_ttl; | 148 | int cache_static_ttl; |
149 | int enable_index_links; | 149 | int enable_index_links; |
150 | int enable_log_filecount; | 150 | int enable_log_filecount; |
151 | int enable_log_linecount; | 151 | int enable_log_linecount; |
152 | int max_commit_count; | 152 | int max_commit_count; |
153 | int max_lock_attempts; | 153 | int max_lock_attempts; |
154 | int max_msg_len; | 154 | int max_msg_len; |
155 | int max_repodesc_len; | 155 | int max_repodesc_len; |
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, |
208 | const unsigned char *new_sha1, | 216 | const unsigned char *new_sha1, |
209 | linediff_fn fn); | 217 | linediff_fn fn); |
210 | 218 | ||
211 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 219 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
212 | const unsigned char *new_sha1, | 220 | const unsigned char *new_sha1, |
213 | filepair_fn fn, const char *prefix); | 221 | filepair_fn fn, const char *prefix); |
214 | 222 | ||
215 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 223 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
216 | 224 | ||
217 | extern char *fmt(const char *format,...); | 225 | extern char *fmt(const char *format,...); |
218 | 226 | ||
219 | extern int cgit_read_config(const char *filename, configfn fn); | 227 | extern int cgit_read_config(const char *filename, configfn fn); |
220 | extern int cgit_parse_query(char *txt, configfn fn); | 228 | extern int cgit_parse_query(char *txt, configfn fn); |
221 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 229 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
222 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 230 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
223 | extern void cgit_parse_url(const char *url); | 231 | extern void cgit_parse_url(const char *url); |
224 | 232 | ||
225 | extern char *cache_safe_filename(const char *unsafe); | 233 | extern char *cache_safe_filename(const char *unsafe); |
226 | extern int cache_lock(struct cacheitem *item); | 234 | extern int cache_lock(struct cacheitem *item); |
227 | extern int cache_unlock(struct cacheitem *item); | 235 | extern int cache_unlock(struct cacheitem *item); |
228 | extern int cache_cancel_lock(struct cacheitem *item); | 236 | extern int cache_cancel_lock(struct cacheitem *item); |
229 | extern int cache_exist(struct cacheitem *item); | 237 | extern int cache_exist(struct cacheitem *item); |
230 | extern int cache_expired(struct cacheitem *item); | 238 | extern int cache_expired(struct cacheitem *item); |
231 | 239 | ||