[Openais] [PATCH 6/8] COVERITY 3: remove dead code in cpg_dispatch()

Steven Dake sdake at redhat.com
Fri Nov 20 17:19:20 PST 2009


looks good same comments as evs service

On Sun, 2009-10-25 at 11:58 +1300, Angus Salkeld wrote:
> 382  			switch (dispatch_types) {
> 383  			case CPG_DISPATCH_ONE:
> Event dead_error_condition: On this path, the condition "ignore_dispatch != 0" could not be true
> Also see events: [dead_error_line][const][assignment][new_values]
> 384  				if (ignore_dispatch) {
> 
> Event dead_error_line: Cannot reach this line of code
> Also see events: [dead_error_condition][const][assignment][new_values]
> 
> 385  					ignore_dispatch = 0;
> 386  				} else {
> 387  					cont = 0;
> 388  				}
> 389  				break;
> 390  			case CPG_DISPATCH_ALL:
> 
> Event const: After this line, the value of "ignore_dispatch" is equal to 0
> Event new_values: Conditional "ignore_dispatch != 0"
> Also see events: [dead_error_line][dead_error_condition][assignment][new_values]
> 
> 391  				if (ignore_dispatch) {
> 392  					ignore_dispatch = 0;
> 393  				}
> 394  				break;
> 
> Signed-off-by: Angus Salkeld <angus.salkeld at gmail.com>
> ---
>   lib/cpg.c |   18 ++----------------
>   1 files changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/cpg.c b/lib/cpg.c
> index bac9361..253acda 100644
> --- a/lib/cpg.c
> +++ b/lib/cpg.c
> @@ -258,7 +258,6 @@ cs_error_t cpg_dispatch (
>   	struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback;
>   	cpg_callbacks_t callbacks;
>   	coroipc_response_header_t *dispatch_data;
> -	int ignore_dispatch = 0;
>   	struct cpg_address member_list[CPG_MEMBERS_MAX];
>   	struct cpg_address left_list[CPG_MEMBERS_MAX];
>   	struct cpg_address joined_list[CPG_MEMBERS_MAX];
> @@ -379,21 +378,8 @@ cs_error_t cpg_dispatch (
>   		/*
>   		 * Determine if more messages should be processed
>   		 * */
> -		switch (dispatch_types) {
> -		case CPG_DISPATCH_ONE:
> -			if (ignore_dispatch) {
> -				ignore_dispatch = 0;
> -			} else {
> -				cont = 0;
> -			}
> -			break;
> -		case CPG_DISPATCH_ALL:
> -			if (ignore_dispatch) {
> -				ignore_dispatch = 0;
> -			}
> -			break;
> -		case CPG_DISPATCH_BLOCKING:
> -			break;
> +		if (dispatch_types == CPG_DISPATCH_ONE) {
> +			cont = 0;
>   		}
>   	} while (cont);
> 



More information about the Openais mailing list