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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
008d5d005d
commit
68d6d6eb40
2
pretty.c
2
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;
|
||||
|
Loading…
Reference in New Issue
Block a user