Skip to content

Commit 85de86a

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2da1f36 commit 85de86a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/mailinfo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,10 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr)
288288
line->buf[len] == ':' && isspace(line->buf[len + 1]);
289289
}
290290

291-
#define SAMPLE "From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n"
292291
static int is_format_patch_separator(const char *line, int len)
293292
{
293+
static const char SAMPLE[] =
294+
"From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n";
294295
const char *cp;
295296

296297
if (len != strlen(SAMPLE))

0 commit comments

Comments
 (0)