On Wed, Jul 30, 2008 at 09:11:22PM +0200, Felix Zielcke wrote:
> + else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9')
> + {
> + memcpy (grub_dev, os_dev + 5, 2);
> + memcpy (grub_dev + 2, os_dev + 8, 5);
> + grub_dev[7] = '\0';
> + }
This looks fine, but I'd suggest to avoid hardcoding numbers when possible. So
if you're adding 5 because that's the size of "/dev/", I think it's a good idea
to use sizeof("/dev/")-1, and so on. This way the code is much easier to
understand IMHO.
(yes, I know the existing code above yours doesn't do this, but i think it's
a good idea to push for higher quality standards anyway ;-))
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel