[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: Remove use of strcmp, etc

On Tue, May 13, 2008 at 02:56:19PM +0200, Jim Meyering wrote:
> I finished the job with the following.
> That exposed another binary difference (which is fine):
> -    if (STRNEQ(str, "linux"))
> +    if (STREQ(str, "hvm"))
>          hvm = 1;

Yes, this is technically a no-op change if people are consistent
in using 'linux' vs 'hvm'. If they typo and use something else
then one part of the code would have treated it as HVM while another
would treat it as paravirt. This change just makes the driver
consistent in its inpretation, to always favour paravirt.

> I automatically changed most uses of STRN?EQLEN (e.g.,
> -        STRNEQLEN((const char *)target, "hd", 2) &&
> +        !STRPREFIX((const char *)target, "hd") &&
> to uses of STRPREFIX.  That matched all of yours and caught a few more,
> so you might want to run the last two conversions to keep them all
> together.

Yes, I was conservative when using STRPREFIX in my conversion.
I only change a few with static 2nd arg strings, because some of the
non-static ones were passing a non-static string, and a length
which was less than strlen() on the 2nd arg.

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]