git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] userdiff: allow * between cpp funcname words
@ 2011-12-06 16:35 Thomas Rast
  2011-12-06 19:02 ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Rast @ 2011-12-06 16:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The cpp pattern, used for C and C++, would not match the start of a
declaration such as

  static char *prepare_index(int argc,

because it did not allow for * anywhere between the various words that
constitute the modifiers, type and function name.  Fix it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

This is a really sneaky one-character bug that I cannot believe went
unnoticed for so long, seeing as there are plenty of instances within
git itself where it matters.


 userdiff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/userdiff.c b/userdiff.c
index 7c983c1..76109da 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -118,7 +118,7 @@
 	 /* Jump targets or access declarations */
 	 "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n"
 	 /* C/++ functions/methods at top level */
-	 "^([A-Za-z_][A-Za-z_0-9]*([ \t]+[A-Za-z_][A-Za-z_0-9]*([ \t]*::[ \t]*[^[:space:]]+)?){1,}[ \t]*\\([^;]*)$\n"
+	 "^([A-Za-z_][A-Za-z_0-9]*([ \t*]+[A-Za-z_][A-Za-z_0-9]*([ \t]*::[ \t]*[^[:space:]]+)?){1,}[ \t]*\\([^;]*)$\n"
 	 /* compound type at top level */
 	 "^((struct|class|enum)[^;]*)$",
 	 /* -- */
-- 
1.7.8.424.gcb840

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

end of thread, other threads:[~2011-12-07 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 16:35 [PATCH] userdiff: allow * between cpp funcname words Thomas Rast
2011-12-06 19:02 ` Jeff King
2011-12-06 20:17   ` Thomas Rast
2011-12-06 20:19     ` Jeff King
2011-12-06 20:52       ` Johannes Sixt
2011-12-06 21:07         ` René Scharfe
2011-12-06 21:15     ` Junio C Hamano
2011-12-07  8:04       ` Thomas Rast
2011-12-07 21:13         ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).