[libvirt] [PATCH 1/5] vshCommandRun: avoid used-uninitialized timing-related report from clang
Eric Blake
eblake at redhat.com
Wed Apr 14 14:10:17 UTC 2010
On 04/14/2010 02:46 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
>
> * tools/virsh.c (vshCommandRun): Test only the initial value of
> ctl->timing, so that static analyzers don't have to consider that
> it might be changed by cmd->def->handler.
> ---
> tools/virsh.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index d5fe6c4..b2a1538 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -9411,16 +9411,17 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd)
>
> while (cmd) {
> struct timeval before, after;
> + bool enable_timing = ctl->timing;
>
> if ((ctl->conn == NULL) || (disconnected != 0))
> vshReconnect(ctl);
>
> - if (ctl->timing)
> + if (enable_timing)
> GETTIMEOFDAY(&before);
>
> ret = cmd->def->handler(ctl, cmd);
>
> - if (ctl->timing)
> + if (enable_timing)
ACK. No semantic change unless we had a weird handler(), in which case
the new semantics are better.
--
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/20100414/f9a79f1c/attachment-0001.sig>
More information about the libvir-list
mailing list