]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.h
shared.c: add strbuf_ensure_end
[ps-cgit] / cgit.h
diff --git a/cgit.h b/cgit.h
index f3d2556949ddce9d698ae6231b887328cc83f6db..3e9d55bec6418ceac8e768ba919b3d66b91dd209 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -11,6 +11,7 @@
 #include <tag.h>
 #include <diff.h>
 #include <diffcore.h>
+#include <argv-array.h>
 #include <refs.h>
 #include <revision.h>
 #include <log-tree.h>
@@ -189,7 +190,7 @@ struct cgit_config {
        char *script_name;
        char *section;
        char *repository_sort;
-       char *virtual_root;
+       char *virtual_root;     /* Always ends with '/'. */
        char *strict_export;
        int cache_size;
        int cache_dynamic_ttl;
@@ -244,26 +245,26 @@ struct cgit_page {
        time_t modified;
        time_t expires;
        size_t size;
-       char *mimetype;
-       char *charset;
-       char *filename;
-       char *etag;
-       char *title;
+       const char *mimetype;
+       const char *charset;
+       const char *filename;
+       const char *etag;
+       const char *title;
        int status;
-       char *statusmsg;
+       const char *statusmsg;
 };
 
 struct cgit_environment {
-       char *cgit_config;
-       char *http_host;
-       char *https;
-       char *no_http;
-       char *path_info;
-       char *query_string;
-       char *request_method;
-       char *script_name;
-       char *server_name;
-       char *server_port;
+       const char *cgit_config;
+       const char *http_host;
+       const char *https;
+       const char *no_http;
+       const char *path_info;
+       const char *query_string;
+       const char *request_method;
+       const char *script_name;
+       const char *server_name;
+       const char *server_port;
 };
 
 struct cgit_context {
@@ -274,6 +275,8 @@ struct cgit_context {
        struct cgit_page page;
 };
 
+typedef int (*write_archive_fn_t)(const char *, const char *);
+
 struct cgit_snapshot_format {
        const char *suffix;
        const char *mimetype;
@@ -297,10 +300,14 @@ extern int chk_positive(int result, char *msg);
 extern int chk_non_negative(int result, char *msg);
 
 extern char *trim_end(const char *str, char c);
+extern char *ensure_end(const char *str, char c);
 extern char *strlpart(char *txt, int maxlen);
 extern char *strrpart(char *txt, int maxlen);
 
+extern void strbuf_ensure_end(struct strbuf *sb, char c);
+
 extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
+extern void cgit_free_reflist_inner(struct reflist *list);
 extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
                        int flags, void *cb_data);
 
@@ -322,6 +329,9 @@ extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
 __attribute__((format (printf,1,2)))
 extern char *fmt(const char *format,...);
 
+__attribute__((format (printf,1,2)))
+extern char *fmtalloc(const char *format,...);
+
 extern struct commitinfo *cgit_parse_commit(struct commit *commit);
 extern struct taginfo *cgit_parse_tag(struct tag *tag);
 extern void cgit_parse_url(const char *url);