Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
pretty: use starts_with() to check for a prefix
author
René Scharfe
<l.s.r@web.de>
Sat, 21 Feb 2015 19:53:09 +0000
(20:53 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 22 Feb 2015 20:01:37 +0000
(12:01 -0800)
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>
pretty.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
008d5d0
)
diff --git
a/pretty.c
b/pretty.c
index 31fc76b2fde8297298a7d9ffd38ea7f00eede2fa..af0f57ac831f7ed67883fc2d9125b72f1e90d7d7 100644
(file)
--- 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;