summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-02-21 20:53:09 +0100
committerJunio C Hamano <gitster@pobox.com>2015-02-22 12:01:37 -0800
commit68d6d6eb402d7e39c89ce43ca37e6c16b941890c (patch)
tree43e5d53e4994466ddebbb8b52e16927bd65b9656 /pretty.c
parent008d5d005d862d9b0309af94dfc266e3b06bdf6d (diff)
downloadgit-68d6d6eb402d7e39c89ce43ca37e6c16b941890c.tar.gz
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>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c2
1 files changed, 1 insertions, 1 deletions
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;