[Spice-devel] [PATCH spice-common 2/3] ring: Remove short living temporary variable

Christophe de Dinechin christophe.de.dinechin at gmail.com
Tue Nov 7 11:39:23 UTC 2017


Frediano Ziglio writes:

> Just a style change, the variable does not help readability.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

Acked-by: Christophe de Dinechin <dinechin at redhat.com>

> ---
>  common/ring.h | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/common/ring.h b/common/ring.h
> index 036c098..1ed3576 100644
> --- a/common/ring.h
> +++ b/common/ring.h
> @@ -82,28 +82,22 @@ static inline void ring_remove(RingItem *item)
>
>  static inline RingItem *ring_get_head(Ring *ring)
>  {
> -    RingItem *ret;
> -
>      spice_assert(ring->next != NULL && ring->prev != NULL);
>
>      if (ring_is_empty(ring)) {
>          return NULL;
>      }
> -    ret = ring->next;
> -    return ret;
> +    return ring->next;
>  }
>
>  static inline RingItem *ring_get_tail(Ring *ring)
>  {
> -    RingItem *ret;
> -
>      spice_assert(ring->next != NULL && ring->prev != NULL);
>
>      if (ring_is_empty(ring)) {
>          return NULL;
>      }
> -    ret = ring->prev;
> -    return ret;
> +    return ring->prev;
>  }
>
>  static inline RingItem *ring_next(Ring *ring, RingItem *pos)


--
Cheers,
Christophe de Dinechin (IRC c3d)


More information about the Spice-devel mailing list