refs.c: SSE2 optimizations for check_refname_component
[gitweb.git] / pretty.c
index 6e266ddf2749ab1b2388f72e3a1101e98fa656cc..e1e2cad36d6d2d2773f05c6e69b0013ed8d01240 100644 (file)
--- 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;