[haiku-commits] Re: r42459 - haiku/trunk/src/system/boot/platform/openfirmware

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Jul 2011 00:02:52 +0200

kallisti5@xxxxxxxxxxx wrote:
> -     if ((length = of_getprop(root, "device_type", buffer, 
> sizeof(buffer) - 1))
> -                     == OF_FAILED)
> -             return;
> +
> +     // TODO : Probe other OpenFirmware platforms and set gMachine as 
> needed
> +
> +     int length = of_getprop(root, "device_type", buffer, 
> sizeof(buffer) - 1);

Did you intentionally remove the error checking?

>       if (!strcasecmp("chrp", buffer))
>               gMachine = MACHINE_CHRP;
> -     else if (!strcasecmp("bootrom", buffer))
> +     else //(bootrom) + QEMU

That doesn't look like cleanup.

> -     if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 
> 1))
> -                     == OF_FAILED)
> -             return;
> +             
> +     length = of_getprop(root, "model", buffer, sizeof(buffer) - 1);

Same here.

> +     length = of_getprop(root, "name", buffer, sizeof(buffer) - 1);
> +     buffer[length] = '\0';

Or here. Error checking doesn't seem to be important in 2011 anymore?

> +     if (gMachine & MACHINE_QEMU)
> +             dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n");
> +     else if (gMachine & MACHINE_PEGASOS)

Coding style: use ((a & b) != 0)

Bye,
   Axel.


Other related posts: