]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck.c: rename variables in fsck_set_msg_type() for less confusion
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sun, 28 Mar 2021 13:15:36 +0000 (15:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Mar 2021 02:03:10 +0000 (19:03 -0700)
Rename variables in a function added in 0282f4dced0 (fsck: offer a
function to demote fsck errors to warnings, 2015-06-22).

It was needlessly confusing that it took a "msg_type" argument, but
then later declared another "msg_type" of a different type.

Let's rename that to "severity", and rename "id" to "msg_id" and
"msg_id" to "msg_id_str" etc. This will make a follow-up change
smaller.

While I'm at it properly indent the fsck_set_msg_type() argument list.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c
fsck.h

diff --git a/fsck.c b/fsck.c
index 5dfb99665ae6ce5fbbdaf95b3ef46f7013ca654e..7cc722a25cd3abfc69e37af6b5da76664c77d475 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -203,27 +203,27 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type)
 }
 
 void fsck_set_msg_type(struct fsck_options *options,
-               const char *msg_id, const char *msg_type)
+                      const char *msg_id_str, const char *msg_type_str)
 {
-       int id = parse_msg_id(msg_id), type;
+       int msg_id = parse_msg_id(msg_id_str), msg_type;
 
-       if (id < 0)
-               die("Unhandled message id: %s", msg_id);
-       type = parse_msg_type(msg_type);
+       if (msg_id < 0)
+               die("Unhandled message id: %s", msg_id_str);
+       msg_type = parse_msg_type(msg_type_str);
 
-       if (type != FSCK_ERROR && msg_id_info[id].msg_type == FSCK_FATAL)
-               die("Cannot demote %s to %s", msg_id, msg_type);
+       if (msg_type != FSCK_ERROR && msg_id_info[msg_id].msg_type == FSCK_FATAL)
+               die("Cannot demote %s to %s", msg_id_str, msg_type_str);
 
        if (!options->msg_type) {
                int i;
-               int *msg_type;
-               ALLOC_ARRAY(msg_type, FSCK_MSG_MAX);
+               int *severity;
+               ALLOC_ARRAY(severity, FSCK_MSG_MAX);
                for (i = 0; i < FSCK_MSG_MAX; i++)
-                       msg_type[i] = fsck_msg_type(i, options);
-               options->msg_type = msg_type;
+                       severity[i] = fsck_msg_type(i, options);
+               options->msg_type = severity;
        }
 
-       options->msg_type[id] = type;
+       options->msg_type[msg_id] = msg_type;
 }
 
 void fsck_set_msg_types(struct fsck_options *options, const char *values)
diff --git a/fsck.h b/fsck.h
index f20f1259e844b937de910943fd2f96d4c2b4718f..30a3acabc50739f6be60b1e76ea7760da262a0f2 100644 (file)
--- a/fsck.h
+++ b/fsck.h
@@ -11,7 +11,7 @@ struct fsck_options;
 struct object;
 
 void fsck_set_msg_type(struct fsck_options *options,
-               const char *msg_id, const char *msg_type);
+                      const char *msg_id, const char *msg_type);
 void fsck_set_msg_types(struct fsck_options *options, const char *values);
 int is_valid_msg_type(const char *msg_id, const char *msg_type);