Skip to content

Commit 68d6d6e

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 008d5d0 commit 68d6d6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pretty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static char *replace_encoding_header(char *buf, const char *encoding)
586586
char *cp = buf;
587587

588588
/* guess if there is an encoding header before a \n\n */
589-
while (strncmp(cp, "encoding ", strlen("encoding "))) {
589+
while (!starts_with(cp, "encoding ")) {
590590
cp = strchr(cp, '\n');
591591
if (!cp || *++cp == '\n')
592592
return buf;

0 commit comments

Comments
 (0)