All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] builtin/apply.c: use iswspace() to detect line-ending-like chars
@ 2014-03-20 19:39 George Papanikolaou
  2014-03-21  2:48 ` Eric Sunshine
  2014-03-21 11:14 ` Michael Haggerty
  0 siblings, 2 replies; 9+ messages in thread
From: George Papanikolaou @ 2014-03-20 19:39 UTC (permalink / raw)
  To: gitster; +Cc: git, George Papanikolaou

Removing the bloat of checking for both '\r' and '\n' with the prettier
iswspace() function which checks for other characters as well. (read: \f \t \v)
---

This is one more try to clean up this fuzzy_matchlines() function as part of a
microproject for GSOC. The rest more clarrified microprojects were taken.
I'm obviously planning on applying.

Thanks

Signed-of-by: George 'papanikge' Papanikolaou <g3orge.app@gmail.com>

 builtin/apply.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index b0d0986..912a53a 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -295,9 +295,9 @@ static int fuzzy_matchlines(const char *s1, size_t n1,
 	int result = 0;
 
 	/* ignore line endings */
-	while ((*last1 == '\r') || (*last1 == '\n'))
+	while (iswspace(*last1))
 		last1--;
-	while ((*last2 == '\r') || (*last2 == '\n'))
+	while (iswspace(*last2))
 		last2--;
 
 	/* skip leading whitespace */
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-03-26 18:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-20 19:39 [PATCH] builtin/apply.c: use iswspace() to detect line-ending-like chars George Papanikolaou
2014-03-21  2:48 ` Eric Sunshine
     [not found]   ` <CAByyCQBmCTfW0HBL04MMqwm+bDe4Rb6n+MfWdYUQ6M6yW_u=yw@mail.gmail.com>
2014-03-21 23:07     ` Eric Sunshine
     [not found]     ` <CAPig+cTct-42w5S=OUS_DQ2cD5X9nWa_eUVoFBGTT7nAEahi5g@mail.gmail.com>
2014-03-22  9:33       ` George Papanikolaou
2014-03-23  9:35         ` Eric Sunshine
2014-03-21 11:14 ` Michael Haggerty
2014-03-25  4:54   ` Junio C Hamano
2014-03-26 16:58     ` George Papanikolaou
2014-03-26 18:02       ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.