summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-12-05 18:10:28 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-12-05 18:10:28 (UTC)
commit14b4e108a73b09ce9b6df2c7f2e417305ad68cf4 (patch) (unidiff)
treed31fe76c70e7149708e78e67fbd61bc2b31f816a
parent7115f7d257b5e3fb5d5d7ad6299214506fb35042 (diff)
downloadcgit-14b4e108a73b09ce9b6df2c7f2e417305ad68cf4.zip
cgit-14b4e108a73b09ce9b6df2c7f2e417305ad68cf4.tar.gz
cgit-14b4e108a73b09ce9b6df2c7f2e417305ad68cf4.tar.bz2
parsing.c: enable builds with NO_ICONV defined
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--parsing.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/parsing.c b/parsing.c
index c8f3048..f3f3b15 100644
--- a/parsing.c
+++ b/parsing.c
@@ -83,46 +83,50 @@ char *parse_user(char *t, char **name, char **email, unsigned long *date)
83 } else if (mode == 2 && *p == '\n') { 83 } else if (mode == 2 && *p == '\n') {
84 *email = substr(t, p); 84 *email = substr(t, p);
85 p++; 85 p++;
86 break; 86 break;
87 } else if (mode == 3 && isdigit(*p)) { 87 } else if (mode == 3 && isdigit(*p)) {
88 *date = atol(p); 88 *date = atol(p);
89 mode++; 89 mode++;
90 } else if (*p == '\n') { 90 } else if (*p == '\n') {
91 p++; 91 p++;
92 break; 92 break;
93 } 93 }
94 p++; 94 p++;
95 } 95 }
96 return p; 96 return p;
97} 97}
98 98
99#ifdef NO_ICONV
100#define reencode(a, b, c)
101#else
99const char *reencode(char **txt, const char *src_enc, const char *dst_enc) 102const char *reencode(char **txt, const char *src_enc, const char *dst_enc)
100{ 103{
101 char *tmp; 104 char *tmp;
102 105
103 if (!txt || !*txt || !src_enc || !dst_enc) 106 if (!txt || !*txt || !src_enc || !dst_enc)
104 return *txt; 107 return *txt;
105 108
106 tmp = reencode_string(*txt, src_enc, dst_enc); 109 tmp = reencode_string(*txt, src_enc, dst_enc);
107 if (tmp) { 110 if (tmp) {
108 free(*txt); 111 free(*txt);
109 *txt = tmp; 112 *txt = tmp;
110 } 113 }
111 return *txt; 114 return *txt;
112} 115}
116#endif
113 117
114struct commitinfo *cgit_parse_commit(struct commit *commit) 118struct commitinfo *cgit_parse_commit(struct commit *commit)
115{ 119{
116 struct commitinfo *ret; 120 struct commitinfo *ret;
117 char *p = commit->buffer, *t = commit->buffer; 121 char *p = commit->buffer, *t = commit->buffer;
118 122
119 ret = xmalloc(sizeof(*ret)); 123 ret = xmalloc(sizeof(*ret));
120 ret->commit = commit; 124 ret->commit = commit;
121 ret->author = NULL; 125 ret->author = NULL;
122 ret->author_email = NULL; 126 ret->author_email = NULL;
123 ret->committer = NULL; 127 ret->committer = NULL;
124 ret->committer_email = NULL; 128 ret->committer_email = NULL;
125 ret->subject = NULL; 129 ret->subject = NULL;
126 ret->msg = NULL; 130 ret->msg = NULL;
127 ret->msg_encoding = NULL; 131 ret->msg_encoding = NULL;
128 132