[Spice-devel] [spice-common 7/8] coverity: remove structurally dead code

Christophe Fergeau cfergeau at redhat.com
Mon Apr 4 09:05:15 UTC 2016


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Mon, Apr 04, 2016 at 10:03:38AM +0200, Fabiano FidĂȘncio wrote:
> The loop (for (;;)) will be executed only once, so, no reason for
> keeping it.
> ---
>  common/lz_compress_tmpl.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
> index e316c4b..0305278 100644
> --- a/common/lz_compress_tmpl.c
> +++ b/common/lz_compress_tmpl.c
> @@ -323,18 +323,15 @@ match:        // RLE or dictionary (both are encoded by distance from ref (-1) a
>              // TODO: maybe separate a run from the same seg or from different ones in order
>              //       to spare ref < ref_limit and that way we can also perform 8 calls of
>              //       (ref++ != ip++) outside a loop
> -            for (;;) {
> -                while ((ip < ip_bound) && (ref < ref_limit)) {
> -                    if (!SAME_PIXEL(*ref, *ip)) {
> -                        ref++;
> -                        ip++;
> -                        break;
> -                    } else {
> -                        ref++;
> -                        ip++;
> -                    }
> +            while ((ip < ip_bound) && (ref < ref_limit)) {
> +                if (!SAME_PIXEL(*ref, *ip)) {
> +                    ref++;
> +                    ip++;
> +                    break;
> +                } else {
> +                    ref++;
> +                    ip++;
>                  }
> -                break;
>              }
>          }
>  
> -- 
> 2.7.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160404/8d9bab16/attachment.sig>


More information about the Spice-devel mailing list