[libvirt] [PATCH 10/10] Replace sscanf in PCI device address parsing
Eric Blake
eblake at redhat.com
Wed Mar 31 16:48:47 UTC 2010
On 03/31/2010 10:38 AM, Eric Blake wrote:
> Hmm, thinking aloud here: your patch series has introduced several
> instances of checking STRPREFIX, then advancing to the end of the
> prefix. Maybe it's time to introduce a helper macro that does both the
> check and advances the pointer to the end of the match? Something like:
>
> #define STPCMP(ptr, cmp) \
> (STRPREFIX (*(ptr), cmp) ? (ptr) += strlen (cmp) : NULL)
>
> STPCMP(&tmp, " : ");
> if (tmp == NULL)
> error...
> else
> use tmp...
More thinking aloud - that looks a bit confusing compared to other stp*
interfaces. Maybe:
#define STPCMP(str, cmp) \
(STRPREFIX (str, cmp) ? (str) + strlen (cmp) : NULL)
if ((tmp = STPCMP(tmp, " : ") == NULL)
error...
else
use tmp...
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100331/cd731e2c/attachment-0001.sig>
More information about the libvir-list
mailing list