diff mbox

[RESUBMIT] lib: fwts_fileio.c: remove unnecessary variable len

Message ID 1334132026-14470-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King April 11, 2012, 8:13 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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

Comments

Keng-Yu Lin April 11, 2012, 8:18 a.m. UTC | #1
On Wed, Apr 11, 2012 at 4:13 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_fileio.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_fileio.c b/src/lib/src/fwts_fileio.c
> index c0a6f15..b3131e3 100644
> --- a/src/lib/src/fwts_fileio.c
> +++ b/src/lib/src/fwts_fileio.c
> @@ -37,8 +37,7 @@ fwts_list *fwts_file_read(FILE *fp)
>                return NULL;
>
>        while (fgets(buffer, sizeof(buffer), fp) != NULL) {
> -               int len = strlen(buffer);
> -               buffer[len-1] = '\0';   /* Chop off "\n" */
> +               buffer[strlen(buffer) - 1] = '\0';      /* Chop off "\n" */
>                fwts_text_list_append(list, buffer);
>        }
>
> --
> 1.7.9.1
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung April 11, 2012, 8:19 a.m. UTC | #2
On 04/11/2012 04:13 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/lib/src/fwts_fileio.c |    3 +--
>   1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_fileio.c b/src/lib/src/fwts_fileio.c
> index c0a6f15..b3131e3 100644
> --- a/src/lib/src/fwts_fileio.c
> +++ b/src/lib/src/fwts_fileio.c
> @@ -37,8 +37,7 @@ fwts_list *fwts_file_read(FILE *fp)
>   		return NULL;
>
>   	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
> -		int len = strlen(buffer);
> -		buffer[len-1] = '\0';	/* Chop off "\n" */
> +		buffer[strlen(buffer) - 1] = '\0';	/* Chop off "\n" */
>   		fwts_text_list_append(list, buffer);
>   	}
>
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_fileio.c b/src/lib/src/fwts_fileio.c
index c0a6f15..b3131e3 100644
--- a/src/lib/src/fwts_fileio.c
+++ b/src/lib/src/fwts_fileio.c
@@ -37,8 +37,7 @@  fwts_list *fwts_file_read(FILE *fp)
 		return NULL;
 
 	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
-		int len = strlen(buffer);
-		buffer[len-1] = '\0';	/* Chop off "\n" */
+		buffer[strlen(buffer) - 1] = '\0';	/* Chop off "\n" */
 		fwts_text_list_append(list, buffer);
 	}