Re: [PATCH v2 07/10] fsck.c: call parse_msg_type() early in fsck_set_msg_type()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> There's no reason to defer the calling of parse_msg_type() until after
> we've checked if the "id < 0". This is not a hot codepath, and
> parse_msg_type() itself may die on invalid input.

That explains why this change can be done, but does not justify why
it is a good change.  Unlike all the previous steps, I would rather
say this is borderline needless churn.

Let's keep reading as the picture may change as we touch more code
around this area.

Thanks.


>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  fsck.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fsck.c b/fsck.c
> index 00e0fef21ca..7c53080ad48 100644
> --- a/fsck.c
> +++ b/fsck.c
> @@ -203,11 +203,10 @@ void fsck_set_msg_type(struct fsck_options *options,
>  		const char *msg_id_str, const char *msg_type_str)
>  {
>  	int msg_id = parse_msg_id(msg_id_str);
> -	enum fsck_msg_type msg_type;
> +	enum fsck_msg_type msg_type = parse_msg_type(msg_type_str);
>  
>  	if (msg_id < 0)
>  		die("Unhandled message id: %s", msg_id_str);
> -	msg_type = parse_msg_type(msg_type_str);
>  
>  	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);




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux