From: René Scharfe Date: Sat, 21 Feb 2015 19:53:09 +0000 (+0100) Subject: pretty: use starts_with() to check for a prefix X-Git-Tag: v2.3.2~2^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/68d6d6eb402d7e39c89ce43ca37e6c16b941890c 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 --- 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;