[PATCH 09/14] Cleanup: be explicit about ignoring the return value of dc_buffer_clear

Jef Driesen jef at libdivecomputer.org
Wed Jan 3 07:27:57 PST 2018


On 29-12-17 01:35, Dirk Hohndel wrote:
> --- a/src/atomics_cobalt.c
> +++ b/src/atomics_cobalt.c
> @@ -323,7 +323,7 @@ atomics_cobalt_read_dive (dc_device_t *abstract, 
> dc_buffer_t *buffer, int init,
>   	// When only two 0xFF bytes are received, there are no more dives.
>   	unsigned char *data = dc_buffer_get_data (buffer);
>   	if (nbytes == 2 && data[0] == 0xFF && data[1] == 0xFF) {
> -		dc_buffer_clear (buffer);
> +		(void)dc_buffer_clear (buffer);
>   		return DC_STATUS_SUCCESS;
>   	}

Hmm, I'm not really a fan of this. It adds more visual noise for very 
little real gain (other than silencing the static analyzer).

Maybe this function should have returned a void instead.

Jef


More information about the devel mailing list