Re: [libvirt] [PATCH] nwfilter: Some fixes to XML parser

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

 



On 03/31/2010 02:45 PM, Stefan Berger wrote:
> @@ -433,9 +430,10 @@ macProtocolIDFormatter(virBufferPtr buf,
>                         nwf->p.ethHdrFilter.dataProtocolID.u.u16,
>                         &str)) {
>          virBufferVSprintf(buf, "%s", str);
> -        return 1;
> +    } else {
> +        virBufferVSprintf(buf, "%d", nwf->p.ethHdrFilter.dataProtocolID.u.u16);

This would look a bit better as %u than %d, to match the fact that we
know it is unsigned, but at least I don't see any problems with sign
extension biting us if we leave the line alone.

> +                            if (virStrToLong_i(prop, NULL, 10, &int_val) == 0) {
> +                                if (int_val >= 0 && int_val <= 32) {

Is it any more efficient to use virStrToLong_ui, so that you can drop
the int_val>=0 half of the test by virtue of the fact that you parsed an
unsigned int to begin with?

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]