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

Re: [libvirt] [TCK PATCHv3] block devices: allow specification of size for safety



Jim Meyering wrote:
> However, I find it more readable to group the two $device-setting
> statements together:
>
>        my $device = $self->config("host_block_devices/[$devindex]/path", undef);
>        $device ||= $self->config("host_block_devices/[$devindex]", undef);

Taking Dan's correction into account, you might want to write it like this:

    my $device = ($self->config("host_block_devices/[$devindex]/path", undef)
                  || $self->config("host_block_devices/[$devindex]", undef)
                  || return undef);

or perhaps, more technically correct, in case the config value is "0":

    my $device = ($self->config("host_block_devices/[$devindex]/path", undef)
                  || $self->config("host_block_devices/[$devindex]", undef));
    defined $device
        or return undef;


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