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



Matthias Scheler wrote:
> 
> Module Name:  src
> Committed By: tron
> Date:         Tue Jun 14 18:25:16 UTC 2005
> 
> Modified Files:
>       src/sys/arch/i386/stand/pxeboot: pxe.c pxe.h
> 
> 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.
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+")))

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)))

Now you don't need to check what MEMSTRCMP() macro is expanded into or 
what S_SIZE() is.

Jun-Young







Home | Main Index | Thread Index | Old Index