summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c956395)
raw | patch | inline | side by side (parent: c956395)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 8 Jul 2007 07:25:59 +0000 (00:25 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 8 Jul 2007 07:25:59 +0000 (00:25 -0700) |
This would hopefully make it easier to maintain. Initially we
would have "java" and "tex" defined, as they are the only ones
we already have.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
would have "java" and "tex" defined, as they are the only ones
we already have.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history |
index b8473f58fbde20516bcfa1e0c1dcb2de16be819f..cd6b0c4e0bb5efad828fa29e92e8729418401080 100644 (file)
--- a/diff.c
+++ b/diff.c
return NULL;
}
+static struct builtin_funcname_pattern {
+ const char *name;
+ const char *pattern;
+} builtin_funcname_pattern[] = {
+ { "java", "!^[ ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
+ "new\\|return\\|switch\\|throw\\|while\\)\n"
+ "^[ ]*\\(\\([ ]*"
+ "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
+ "[ ]*([^;]*$\\)" },
+ { "tex", "^\\(\\\\\\(sub\\)*section{.*\\)$" },
+};
+
static const char *diff_funcname_pattern(struct diff_filespec *one)
{
const char *ident, *pattern;
+ int i;
diff_filespec_check_attr(one);
ident = one->funcname_pattern_ident;
* And define built-in fallback patterns here. Note that
* these can be overriden by the user's config settings.
*/
- if (!strcmp(ident, "java"))
- return "!^[ ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
- "new\\|return\\|switch\\|throw\\|while\\)\n"
- "^[ ]*\\(\\([ ]*"
- "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
- "[ ]*([^;]*$\\)";
+ for (i = 0; i < ARRAY_SIZE(builtin_funcname_pattern); i++)
+ if (!strcmp(ident, builtin_funcname_pattern[i].name))
+ return builtin_funcname_pattern[i].pattern;
return NULL;
}