diff mbox

lib: fwts_summary: move statement into previous if block

Message ID 20170413095046.27651-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King April 13, 2017, 9:50 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The previous if block also handles the !summary_item_found condition
so move the statement into this if block.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_summary.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Alex Hung April 17, 2017, 5:20 p.m. UTC | #1
On 2017-04-13 02:50 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The previous if block also handles the !summary_item_found condition
> so move the statement into this if block.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_summary.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index 41008733..82339ec0 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -163,11 +163,10 @@ int fwts_summary_add(
>  			return FWTS_ERROR;
>  		}
>  		fwts_chop_newline(summary_item->text);
> -	}
>
> -	/* And append new item if not done so already */
> -	if (!summary_item_found)
> +		/* And append new item if not done so already */
>  		fwts_list_append(fwts_summaries[index], summary_item);
> +	}
>
>  	return FWTS_OK;
>  }
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu April 21, 2017, 2:33 a.m. UTC | #2
On 04/13/2017 05:50 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The previous if block also handles the !summary_item_found condition
> so move the statement into this if block.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_summary.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index 41008733..82339ec0 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -163,11 +163,10 @@ int fwts_summary_add(
>  			return FWTS_ERROR;
>  		}
>  		fwts_chop_newline(summary_item->text);
> -	}
>
> -	/* And append new item if not done so already */
> -	if (!summary_item_found)
> +		/* And append new item if not done so already */
>  		fwts_list_append(fwts_summaries[index], summary_item);
> +	}
>
>  	return FWTS_OK;
>  }
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
index 41008733..82339ec0 100644
--- a/src/lib/src/fwts_summary.c
+++ b/src/lib/src/fwts_summary.c
@@ -163,11 +163,10 @@  int fwts_summary_add(
 			return FWTS_ERROR;
 		}
 		fwts_chop_newline(summary_item->text);
-	}
 
-	/* And append new item if not done so already */
-	if (!summary_item_found)
+		/* And append new item if not done so already */
 		fwts_list_append(fwts_summaries[index], summary_item);
+	}
 
 	return FWTS_OK;
 }