On 11 September 2013 21:25, Brian C. Lane <[email protected]> wrote:
> From: "Brian C. Lane" <[email protected]>
> +static PedGeometry*
> +btrfs_probe (PedGeometry* geom)
> +{
...
> + if (geom->length < offset+1)
> + return 0;
> + if (!ped_geometry_read (geom, &buf, offset, 1))
> + return 0;
Should not these be NULL rather than 0?
> +
> + if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) {
> + return ped_geometry_new (geom->dev, geom->start,
> geom->length);
> + }
> + return NULL;
> +}
When already providing feedback on this code, I will also ask if this
test can be reversed,
so that the conceptual flow is
if (some_error_condition) {
handle_error
}
normal_code
e.g. "test exceptions, not the normal case"
BR Håkon Løvdal