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

[libvirt] Re: [PATCH] use qemudReadLogOutput



Guido Günther <agx sigxcpu org> wrote:
> On Fri, Feb 13, 2009 at 07:07:49PM +0100, Jim Meyering wrote:
>> Here's a proposed patch to make it use better types
>> (always suspect that using "int" is wrong ;-).
> What about the attached version?
>  -- Guido
>
>>From 5b2c2328195f0cf4eb32d2da1d5a5ef57b2fede4 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Sat, 14 Feb 2009 14:18:45 +0100
> Subject: [PATCH] (s)size_t type cleanup
>
> ---
>  src/qemu_driver.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 09be3fb..8f8b44d 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -594,18 +594,18 @@ qemudReadMonitorOutput(virConnectPtr conn,
>                         virDomainObjPtr vm,
>                         int fd,
>                         char *buf,
> -                       int buflen,
> +                       size_t buflen,
>                         qemudHandlerMonitorOutput func,
>                         const char *what,
>                         int timeout)
>  {
> -    int got = 0;
> +    size_t got = 0;
>      buf[0] = '\0';
>      timeout *= 1000; /* poll wants milli seconds */
>
>      /* Consume & discard the initial greeting */
>      while (got < (buflen-1)) {
> -        int ret;
> +        ssize_t ret;
>
>          ret = read(fd, buf+got, buflen-got-1);
>
> @@ -672,13 +672,13 @@ qemudReadLogOutput(virConnectPtr conn,
>                     virDomainObjPtr vm,
>                     int fd,
>                     char *buf,
> -                   int buflen,
> +                   size_t buflen,
>                     qemudHandlerMonitorOutput func,
>                     const char *what,
>                     int timeout)
>  {
> -    int got = 0;
> -    int ret;
> +    size_t got = 0;
> +    ssize_t ret;
>      int retries = timeout*10;
>      buf[0] = '\0';

That looks ok, but since the latter two variables (in qemudReadLogOutput)
are used only from within the while-loop, their declarations belong
in that inner scope.


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