diff options
| -rw-r--r-- | parsing.c | 18 | 
1 files changed, 7 insertions, 11 deletions
| @@ -69,13 +69,12 @@ static char *substr(const char *head, const char *tail) | |||
| 69 | return buf; | 69 | return buf; | 
| 70 | } | 70 | } | 
| 71 | 71 | ||
| 72 | static const char *parse_user(const char *t, char **name, char **email, unsigned long *date) | 72 | static void parse_user(const char *t, char **name, char **email, unsigned long *date) | 
| 73 | { | 73 | { | 
| 74 | const char *line_end = strchrnul(t, '\n'); | ||
| 75 | struct ident_split ident; | 74 | struct ident_split ident; | 
| 76 | unsigned email_len; | 75 | unsigned email_len; | 
| 77 | 76 | ||
| 78 | if (!split_ident_line(&ident, t, line_end - t)) { | 77 | if (!split_ident_line(&ident, t, strchrnul(t, '\n') - t)) { | 
| 79 | *name = substr(ident.name_begin, ident.name_end); | 78 | *name = substr(ident.name_begin, ident.name_end); | 
| 80 | 79 | ||
| 81 | email_len = ident.mail_end - ident.mail_begin; | 80 | email_len = ident.mail_end - ident.mail_begin; | 
| @@ -85,11 +84,6 @@ static const char *parse_user(const char *t, char **name, char **email, unsigned | |||
| 85 | if (ident.date_begin) | 84 | if (ident.date_begin) | 
| 86 | *date = strtoul(ident.date_begin, NULL, 10); | 85 | *date = strtoul(ident.date_begin, NULL, 10); | 
| 87 | } | 86 | } | 
| 88 | |||
| 89 | if (*line_end) | ||
| 90 | return line_end + 1; | ||
| 91 | else | ||
| 92 | return line_end; | ||
| 93 | } | 87 | } | 
| 94 | 88 | ||
| 95 | #ifdef NO_ICONV | 89 | #ifdef NO_ICONV | 
| @@ -152,13 +146,15 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
| 152 | p += sha1hex_len + 1; | 146 | p += sha1hex_len + 1; | 
| 153 | 147 | ||
| 154 | if (p && skip_prefix(p, "author ", &p)) { | 148 | if (p && skip_prefix(p, "author ", &p)) { | 
| 155 | p = parse_user(p, &ret->author, &ret->author_email, | 149 | parse_user(p, &ret->author, &ret->author_email, | 
| 156 | &ret->author_date); | 150 | &ret->author_date); | 
| 151 | p = next_header_line(p); | ||
| 157 | } | 152 | } | 
| 158 | 153 | ||
| 159 | if (p && skip_prefix(p, "committer ", &p)) { | 154 | if (p && skip_prefix(p, "committer ", &p)) { | 
| 160 | p = parse_user(p, &ret->committer, &ret->committer_email, | 155 | parse_user(p, &ret->committer, &ret->committer_email, | 
| 161 | &ret->committer_date); | 156 | &ret->committer_date); | 
| 157 | p = next_header_line(p); | ||
| 162 | } | 158 | } | 
| 163 | 159 | ||
| 164 | if (p && skip_prefix(p, "encoding ", &p)) { | 160 | if (p && skip_prefix(p, "encoding ", &p)) { | 
| @@ -211,7 +207,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag) | |||
| 211 | 207 | ||
| 212 | for (p = data; !end_of_header(p); p = next_header_line(p)) { | 208 | for (p = data; !end_of_header(p); p = next_header_line(p)) { | 
| 213 | if (skip_prefix(p, "tagger ", &p)) { | 209 | if (skip_prefix(p, "tagger ", &p)) { | 
| 214 | p = parse_user(p, &ret->tagger, &ret->tagger_email, | 210 | parse_user(p, &ret->tagger, &ret->tagger_email, | 
| 215 | &ret->tagger_date); | 211 | &ret->tagger_date); | 
| 216 | } | 212 | } | 
| 217 | } | 213 | } | 
