1 commit 93d8ef8f1de4385c565049e1ccd7fdd25e6c14d7
2 Author: John Keeping <john@keeping.me.uk>
3 Date: Sun Jul 27 11:56:18 2014 +0100
5 parsing.c: make commit buffer const
7 This will be required in order to incorporate the changes to commit
8 buffer handling in Git 2.0.2.
10 Signed-off-by: John Keeping <john@keeping.me.uk>
12 diff --git a/parsing.c b/parsing.c
13 index 073f46f..edb3416 100644
16 @@ -69,9 +69,9 @@ static char *substr(const char *head, const char *tail)
20 -static char *parse_user(char *t, char **name, char **email, unsigned long *date)
21 +static const char *parse_user(const char *t, char **name, char **email, unsigned long *date)
28 @@ -132,7 +132,7 @@ static const char *reencode(char **txt, const char *src_enc, const char *dst_enc
29 struct commitinfo *cgit_parse_commit(struct commit *commit)
31 struct commitinfo *ret;
32 - char *p = commit->buffer, *t;
33 + const char *p = commit->buffer, *t;
35 ret = xmalloc(sizeof(*ret));
37 @@ -223,7 +223,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag)
39 enum object_type type;
45 data = read_sha1_file(tag->object.sha1, &type, &size);
46 commit 865afe0eb1b5e6485fe0f65472e6635266e393b1
47 Author: John Keeping <john@keeping.me.uk>
48 Date: Sun Jul 27 11:56:19 2014 +0100
52 This is slightly more involved than just bumping the version number
53 because it pulls in a change to convert the commit buffer to a slab,
54 removing the "buffer" field from "struct commit". All sites that access
55 "commit->buffer" have been changed to use the new functions provided for
58 Signed-off-by: John Keeping <john@keeping.me.uk>
60 diff --git a/Makefile b/Makefile
61 index bf8be02..93b525a 100644
64 @@ -14,7 +14,7 @@ htmldir = $(docdir)
66 mandir = $(prefix)/share/man
67 SHA1_HEADER = <openssl/sha.h>
70 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
73 diff --git a/parsing.c b/parsing.c
74 index edb3416..3dbd122 100644
77 @@ -132,7 +132,8 @@ static const char *reencode(char **txt, const char *src_enc, const char *dst_enc
78 struct commitinfo *cgit_parse_commit(struct commit *commit)
80 struct commitinfo *ret;
81 - const char *p = commit->buffer, *t;
82 + const char *p = get_cached_commit_buffer(commit, NULL);
85 ret = xmalloc(sizeof(*ret));
87 diff --git a/ui-atom.c b/ui-atom.c
88 index b22d745..e2b39ee 100644
91 @@ -133,8 +133,7 @@ void cgit_print_atom(char *tip, char *path, int max_count)
93 while ((commit = get_revision(&rev)) != NULL) {
94 add_entry(commit, host);
95 - free(commit->buffer);
96 - commit->buffer = NULL;
97 + free_commit_buffer(commit);
98 free_commit_list(commit->parents);
99 commit->parents = NULL;
101 diff --git a/ui-log.c b/ui-log.c
102 index b5846e4..bcdb666 100644
105 @@ -388,16 +388,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
108 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
109 - free(commit->buffer);
110 - commit->buffer = NULL;
111 + free_commit_buffer(commit);
112 free_commit_list(commit->parents);
113 commit->parents = NULL;
116 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
117 print_commit(commit, &rev);
118 - free(commit->buffer);
119 - commit->buffer = NULL;
120 + free_commit_buffer(commit);
121 free_commit_list(commit->parents);
122 commit->parents = NULL;
124 diff --git a/ui-stats.c b/ui-stats.c
125 index bc27308..6f13c32 100644
128 @@ -244,7 +244,7 @@ static struct string_list collect_stats(struct cgit_period *period)
129 memset(&authors, 0, sizeof(authors));
130 while ((commit = get_revision(&rev)) != NULL) {
131 add_commit(&authors, commit, period);
132 - free(commit->buffer);
133 + free_commit_buffer(commit);
134 free_commit_list(commit->parents);