blame: create scoreboard init function
authorJeff Smith <whydoubt@gmail.com>
Wed, 24 May 2017 05:15:29 +0000 (00:15 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 May 2017 04:08:22 +0000 (13:08 +0900)
Create function that initializes blame_scoreboard to default values.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c
index e3435201f43bfb64304376c05b9b4a95864039a6..f839571097659f1cdf6615035b71a9d919509cc6 100644 (file)
@@ -2537,6 +2537,13 @@ static int blame_move_callback(const struct option *option, const char *arg, int
        return 0;
 }
 
+void init_scoreboard(struct blame_scoreboard *sb)
+{
+       memset(sb, 0, sizeof(struct blame_scoreboard));
+       sb->move_score = BLAME_DEFAULT_MOVE_SCORE;
+       sb->copy_score = BLAME_DEFAULT_COPY_SCORE;
+}
+
 int cmd_blame(int argc, const char **argv, const char *prefix)
 {
        struct rev_info revs;
@@ -2747,10 +2754,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 
        revs.disable_stdin = 1;
        setup_revisions(argc, argv, &revs, NULL);
-       memset(&sb, 0, sizeof(sb));
-       sb.move_score = BLAME_DEFAULT_MOVE_SCORE;
-       sb.copy_score = BLAME_DEFAULT_COPY_SCORE;
 
+       init_scoreboard(&sb);
        sb.revs = &revs;
        sb.contents_from = contents_from;
        sb.reverse = reverse;