summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/pretty.c b/pretty.c
index 6e266dd..e1e2cad 100644
--- a/pretty.c
+++ b/pretty.c
@@ -393,8 +393,8 @@ static void add_rfc2047(struct strbuf *sb, const char *line, size_t len,
strbuf_addstr(sb, "?=");
}
-static const char *show_ident_date(const struct ident_split *ident,
- enum date_mode mode)
+const char *show_ident_date(const struct ident_split *ident,
+ enum date_mode mode)
{
unsigned long date = 0;
long tz = 0;
@@ -555,14 +555,13 @@ static char *get_header(const struct commit *commit, const char *msg,
const char *line = msg;
while (line) {
- const char *eol = strchr(line, '\n'), *next;
+ const char *eol = strchrnul(line, '\n'), *next;
if (line == eol)
return NULL;
- if (!eol) {
+ if (!*eol) {
warning("malformed commit (header is missing newline): %s",
sha1_to_hex(commit->object.sha1));
- eol = line + strlen(line);
next = NULL;
} else
next = eol + 1;