aboutsummaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-18 13:51:18 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-18 13:51:18 -0700
commit6f75e48323bc3071495025fd14105e9dffa9e8dd (patch)
treefbb3b54f3877d21bc6a9ac6c284971581e18274b /pretty.c
parent884377c128925e7aa43eafebd8d4d0ba27dafe67 (diff)
parent2c5495f7b60d6ddcd6a411b48d2f6dbc4a24717a (diff)
downloadgit-6f75e48323bc3071495025fd14105e9dffa9e8dd.tar.gz
git-6f75e48323bc3071495025fd14105e9dffa9e8dd.tar.xz
Merge branch 'rm/strchrnul-not-strlen'
* rm/strchrnul-not-strlen: use strchrnul() in place of strchr() and strlen()
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pretty.c b/pretty.c
index 6e266ddf2..3c43db558 100644
--- a/pretty.c
+++ b/pretty.c
@@ -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;