[Spice-devel] [PATCH spice-common 1/3] ring: Remove __ring_remove function

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


Frediano Ziglio writes:

> Is just used by ring_remove, no reason to have it.

Nack. I think there is a good reason: the code and its intent is much
clearer with a "ring_remove" name.


>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  common/ring.h | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/common/ring.h b/common/ring.h
> index 4b0e313..036c098 100644
> --- a/common/ring.h
> +++ b/common/ring.h
> @@ -70,19 +70,14 @@ static inline void ring_add_before(RingItem *item, RingItem *pos)
>      ring_add(pos->prev, item);
>  }
>
> -static inline void __ring_remove(RingItem *item)
> -{
> -    item->next->prev = item->prev;
> -    item->prev->next = item->next;
> -    item->prev = item->next = NULL;
> -}
> -
>  static inline void ring_remove(RingItem *item)
>  {
>      spice_assert(item->next != NULL && item->prev != NULL);
>      spice_assert(item->next != item);
>
> -    __ring_remove(item);
> +    item->next->prev = item->prev;
> +    item->prev->next = item->next;
> +    item->prev = item->next = NULL;
>  }
>
>  static inline RingItem *ring_get_head(Ring *ring)


--
Cheers,
Christophe de Dinechin (IRC c3d)


More information about the Spice-devel mailing list