Re: [spice] server: Don't check the 'this' mjpeg_encoder pointer

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

 



> 
> mjpeg_encoder_get_stats() was the only function to check it.
> 
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> ---
>  server/mjpeg_encoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
> index c8253a7..84a0078 100644
> --- a/server/mjpeg_encoder.c
> +++ b/server/mjpeg_encoder.c
> @@ -1333,7 +1333,7 @@ uint64_t mjpeg_encoder_get_bit_rate(MJpegEncoder
> *encoder)
>  
>  void mjpeg_encoder_get_stats(MJpegEncoder *encoder, MJpegEncoderStats
>  *stats)
>  {
> -    spice_assert(encoder != NULL && stats != NULL);
> +    spice_assert(stats != NULL);
>      stats->starting_bit_rate = encoder->starting_bit_rate;
>      stats->cur_bit_rate = mjpeg_encoder_get_bit_rate(encoder);
>      stats->avg_quality = (double)encoder->avg_quality / encoder->num_frames;
> --
> 2.6.2

Personally I think that these kind of checks are not helping that much and
I would agree. A NULL pointer is a bug but removing the test cause a core
on modern systems so adding it just slow down the execution and increase code
size. For the same reason however even the check for stats could be removed
like many other tests for NULL pointers.

It's quite question of style subject to personal opinions.

If nobody will disagree I will merge it. Please remember me if I forget.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]