diff: use extended regexp to find hunk headers
Using ERE elements such as "|" (alternation) by backquoting in BRE is a GNU extension and should not be done in portable programs. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 19, 2008 at 23:52 UTC
1883a0d3b7ad7c9de1ac790bda6f1a6181237439
1 file changed
+3
-3
diff.c
+3
-3
@@ -1406,7 +1406,7 @@ static const struct funcname_pattern_entry *funcname_pattern(const char *ident)
1406
static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
1407
{ "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
1408
REG_EXTENDED },
1409
- { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 },
1409
+ { "html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", REG_EXTENDED },
1410
{ "java",
1411
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
1412
"^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
@@ -1417,8 +1417,8 @@ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
1417
"|"
1418
"^(.*=[ \t]*(class|record).*)$",
1419
REG_EXTENDED },
1420
- { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 },
1421
- { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 },
1420
+ { "php", "^[\t ]*((function|class).*)", REG_EXTENDED },
1421
+ { "python", "^[ \t]*((class|def)[ \t].*)$", REG_EXTENDED },
1422
{ "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
1423
REG_EXTENDED },
1424
{ "tex",