[Spice-devel] [PATCH 7/9] common: add ring_get_length() for debugging purposes

Alon Levy alevy at redhat.com
Tue Jan 25 11:25:13 PST 2011


On Tue, Jan 25, 2011 at 07:17:26PM +0100, Marc-André Lureau wrote:
> ---
>  common/ring.h |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/common/ring.h b/common/ring.h
> index cdfe7e1..0194959 100644
> --- a/common/ring.h
> +++ b/common/ring.h
> @@ -136,5 +136,18 @@ static inline RingItem *ring_prev(Ring *ring, RingItem *pos)
>      return (ret == ring) ? NULL : ret;
>  }
>  
> +static inline unsigned int ring_get_length(Ring *ring)

This won't compile if no one uses it - so you probably want to make
it non static (or do a hack by doing (void)ring_get_length somewhere).

We definitely don't want to ifdef this (beats the purpose of having it
in gdb).

> +{
> +    RingItem *i;
> +    unsigned int ret = 0;
> +
> +    for (i = ring_get_head(ring);
> +         i != NULL;
> +         i = ring_next(ring, i))
> +        ret++;
> +
> +    return ret;
> +}
> +
>  #endif
>  
> -- 
> 1.7.3.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list