]> gitweb.ps.run Git - ps-cgit/commitdiff
Add commit->msg_encoding, allocate msg dynamicly.
authorJonathan Bastien-Filiatrault <joe@x2a.org>
Fri, 26 Oct 2007 22:09:06 +0000 (18:09 -0400)
committerJonathan Bastien-Filiatrault <joe@x2a.org>
Mon, 5 Nov 2007 23:13:30 +0000 (18:13 -0500)
cgit.h
parsing.c
shared.c
ui-shared.c

diff --git a/cgit.h b/cgit.h
index 163f355a022dab2dbbdb6f61b6040bacf3730c68..6c7a9414e62d0037fa58027a02b7e0b3b77af26f 100644 (file)
--- a/cgit.h
+++ b/cgit.h
 #define TM_MONTH (TM_YEAR / 12.0)
 
 
+/*
+ * Default encoding
+ */
+#define PAGE_ENCODING "UTF-8"
+
 typedef void (*configfn)(const char *name, const char *value);
 typedef void (*filepair_fn)(struct diff_filepair *pair);
 typedef void (*linediff_fn)(char *line, int len);
@@ -90,6 +95,7 @@ struct commitinfo {
        unsigned long committer_date;
        char *subject;
        char *msg;
+       char *msg_encoding;
 };
 
 struct taginfo {
index 30e7648958789fb72930c405d1ba8d8c5a382f27..0412a9cbe46b6c1f3c43489bbf23aee601f28c46 100644 (file)
--- a/parsing.c
+++ b/parsing.c
@@ -199,6 +199,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
        ret->committer_email = NULL;
        ret->subject = NULL;
        ret->msg = NULL;
+       ret->msg_encoding = NULL;
 
        if (p == NULL)
                return ret;
index e06df91bb8c74a617fa95d67e8b0737b4a1099cb..a04c4dc7eece8257c9d3145f72e4bea0e8b17148 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -265,6 +265,8 @@ void *cgit_free_commitinfo(struct commitinfo *info)
        free(info->committer);
        free(info->committer_email);
        free(info->subject);
+       free(info->msg);
+       free(info->msg_encoding);
        free(info);
        return NULL;
 }
index 72a7b44472ddb483b9bc6640d029380ac11afd8b..7c69f60f80a5a8dd495b73497132693297496a81 100644 (file)
@@ -352,7 +352,7 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
 
 void cgit_print_docstart(char *title, struct cacheitem *item)
 {
-       html("Content-Type: text/html; charset=utf-8\n");
+       html("Content-Type: text/html; charset=" PAGE_ENCODING "\n");
        htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
        htmlf("Expires: %s\n", http_date(item->st.st_mtime +
                                         ttl_seconds(item->ttl)));