Source-Changes archive

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

Re: CVS commit: src/sys/arch/i386/stand/pxeboot



On Wed, Jun 15, 2005 at 03:00:18PM +0900, Bang Jun-Young wrote:
> > Log Message:
> > Get rid off the ugly S_SIZE() macro which breaks the build now that
> > bcmp() is a macro, too.
> 
> I agree S_SIZE() is ugly, but MEMSTRCMP() is not that good, either.

Why? It doesn't do tricky argument expansion like S_SIZE() did.

> There are two (better) solutions for this:
> 
> 1. Just s/bcmp/memcmp/.
> 
> -                     if (bcmp(pxenv->Signature, S_SIZE("PXENV+")))
> +                     if (memcmp(pxenv->Signature, S_SIZE("PXENV+")))

That didn't work because memcmp() is a macro, too.

> 2. S_SIZE() should haven't been introduced in the first place, since it
> was only used twice across the tree. The above line can be written as
> 
>                       const char *sig = "PXENV+";
>                       ...
>                       if (memcmp(pxenv->Signature, sig, sizeof(sig)))

Besides the incorrect declaration (see Jason's e-mail) I didn't like
to invent two variables for that.

        Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/



Home | Main Index | Thread Index | Old Index