From 0e3994fa97e9876b571531444b97ae6e63fd744d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 3 Jun 2005 01:37:54 -0700 Subject: [PATCH] diff: Clean up diff_scoreopt_parse(). This cleans up diff_scoreopt_parse() function that is used to parse the fractional notation -B, -C and -M option takes. The callers are modified to check for errors and complain. Earlier they silently ignored malformed input and falled back on the default. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- diff-tree.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'diff-tree.c') diff --git a/diff-tree.c b/diff-tree.c index c3a5617c57..3881c23ca3 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -459,16 +459,19 @@ int main(int argc, const char **argv) } if (!strncmp(arg, "-M", 2)) { detect_rename = DIFF_DETECT_RENAME; - diff_score_opt = diff_scoreopt_parse(arg); + if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_tree_usage); continue; } if (!strncmp(arg, "-C", 2)) { detect_rename = DIFF_DETECT_COPY; - diff_score_opt = diff_scoreopt_parse(arg); + if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_tree_usage); continue; } if (!strncmp(arg, "-B", 2)) { - diff_break_opt = diff_scoreopt_parse(arg); + if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1) + usage(diff_tree_usage); continue; } if (!strcmp(arg, "-z")) { -- cgit v1.2.1