From 68d6d6eb402d7e39c89ce43ca37e6c16b941890c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 21 Feb 2015 20:53:09 +0100 Subject: [PATCH] pretty: use starts_with() to check for a prefix Simplify the code and avoid duplication by using starts_with() instead of strlen() and strncmp() to check if a line starts with "encoding ". Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- pretty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pretty.c b/pretty.c index 31fc76b2fd..af0f57ac83 100644 --- a/pretty.c +++ b/pretty.c @@ -586,7 +586,7 @@ static char *replace_encoding_header(char *buf, const char *encoding) char *cp = buf; /* guess if there is an encoding header before a \n\n */ - while (strncmp(cp, "encoding ", strlen("encoding "))) { + while (!starts_with(cp, "encoding ")) { cp = strchr(cp, '\n'); if (!cp || *++cp == '\n') return buf; -- 2.11.4.GIT