Commit 85de86a1 authored by Eric Sunshine's avatar Eric Sunshine Committed by Junio C Hamano

mailinfo: work around -Wstring-plus-int warning

The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by
default which complains about pointer arithmetic applied to a string
literal:

    builtin/mailinfo.c:303:24: warning:
        adding 'long' to a string does not append to the string
            return !memcmp(SAMPLE + (cp - line), cp, strlen(SAMPLE) ...
                           ~~~~~~~^~~~~~~~~~~~~
Signed-off-by: Eric Sunshine's avatarEric Sunshine <sunshine@sunshineco.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 2da1f366
...@@ -288,9 +288,10 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr) ...@@ -288,9 +288,10 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr)
line->buf[len] == ':' && isspace(line->buf[len + 1]); line->buf[len] == ':' && isspace(line->buf[len + 1]);
} }
#define SAMPLE "From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n"
static int is_format_patch_separator(const char *line, int len) static int is_format_patch_separator(const char *line, int len)
{ {
static const char SAMPLE[] =
"From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n";
const char *cp; const char *cp;
if (len != strlen(SAMPLE)) if (len != strlen(SAMPLE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment