Skip to content

Commit f1abc2d

Browse files
avargitster
authored andcommitted
fsck.c: rename variables in fsck_set_msg_type() for less confusion
Rename variables in a function added in 0282f4d (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a1aad71 commit f1abc2d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

fsck.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,27 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type)
203203
}
204204

205205
void fsck_set_msg_type(struct fsck_options *options,
206-
const char *msg_id, const char *msg_type)
206+
const char *msg_id_str, const char *msg_type_str)
207207
{
208-
int id = parse_msg_id(msg_id), type;
208+
int msg_id = parse_msg_id(msg_id_str), msg_type;
209209

210-
if (id < 0)
211-
die("Unhandled message id: %s", msg_id);
212-
type = parse_msg_type(msg_type);
210+
if (msg_id < 0)
211+
die("Unhandled message id: %s", msg_id_str);
212+
msg_type = parse_msg_type(msg_type_str);
213213

214-
if (type != FSCK_ERROR && msg_id_info[id].msg_type == FSCK_FATAL)
215-
die("Cannot demote %s to %s", msg_id, msg_type);
214+
if (msg_type != FSCK_ERROR && msg_id_info[msg_id].msg_type == FSCK_FATAL)
215+
die("Cannot demote %s to %s", msg_id_str, msg_type_str);
216216

217217
if (!options->msg_type) {
218218
int i;
219-
int *msg_type;
220-
ALLOC_ARRAY(msg_type, FSCK_MSG_MAX);
219+
int *severity;
220+
ALLOC_ARRAY(severity, FSCK_MSG_MAX);
221221
for (i = 0; i < FSCK_MSG_MAX; i++)
222-
msg_type[i] = fsck_msg_type(i, options);
223-
options->msg_type = msg_type;
222+
severity[i] = fsck_msg_type(i, options);
223+
options->msg_type = severity;
224224
}
225225

226-
options->msg_type[id] = type;
226+
options->msg_type[msg_id] = msg_type;
227227
}
228228

229229
void fsck_set_msg_types(struct fsck_options *options, const char *values)

fsck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct fsck_options;
1111
struct object;
1212

1313
void fsck_set_msg_type(struct fsck_options *options,
14-
const char *msg_id, const char *msg_type);
14+
const char *msg_id, const char *msg_type);
1515
void fsck_set_msg_types(struct fsck_options *options, const char *values);
1616
int is_valid_msg_type(const char *msg_id, const char *msg_type);
1717

0 commit comments

Comments
 (0)