Re: [PATCH 1/3] Replace some uses STREQLEN with STRPREFIX

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

 



On Fri, 2016-06-24 at 15:00 +0200, Ján Tomko wrote:
> Do not call it with a magic constant matching the length
> of the pattern.
> ---
>  src/qemu/qemu_command.c             | 2 +-
>  src/storage/storage_backend_iscsi.c | 2 +-
>  src/storage/storage_backend_scsi.c  | 2 +-
>  src/xen/xen_hypervisor.c            | 4 ++--
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 08c66b8..0638a86 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3610,7 +3610,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
>  {
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
>  
> -    if (STREQLEN(def->os.machine, "s390-virtio", 10) &&
> +    if (STRPREFIX(def->os.machine, "s390-virtio") &&

The original code only checked the first 10 bytes of
def->os.machine, though. So it would have matched
"s390-virtie", but the new version doesn't! :P

-- 
Andrea Bolognani / Red Hat / Virtualization

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