diff mbox

[4/7] lib: fwts_pipeio: remove redundant initializations of file to NULL

Message ID 20161019132639.16524-5-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Oct. 19, 2016, 1:26 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The open assigns file to the open descriptor, so no need to initialize
it to NULL.  Cleans up 2 cppcheck style warnings:

src/lib/src/fwts_pipeio.c:397: (style) Variable 'file' is reassigned a
  value before the old one has been used.
src/lib/src/fwts_pipeio.c:429: (style) Variable 'file' is reassigned a
  value before the old one has been used

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

Comments

Alex Hung Oct. 19, 2016, 5:28 p.m. UTC | #1
On 2016-10-19 06:26 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The open assigns file to the open descriptor, so no need to initialize
> it to NULL.  Cleans up 2 cppcheck style warnings:
>
> src/lib/src/fwts_pipeio.c:397: (style) Variable 'file' is reassigned a
>   value before the old one has been used.
> src/lib/src/fwts_pipeio.c:429: (style) Variable 'file' is reassigned a
>   value before the old one has been used
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_pipeio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index ecd4e33..0ee1de1 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -390,7 +390,7 @@ int fwts_write_string_file(
>  	const char *file_name,
>  	const char *str)
>  {
> -	FILE *file = NULL;
> +	FILE *file;
>  	int ret;
>
>  	errno = 0;
> @@ -422,7 +422,7 @@ int fwts_read_file_first_line(
>  	const char *file_name,
>  	char **line)
>  {
> -	FILE *file = NULL;
> +	FILE *file;
>  	char buffer[LINE_MAX], *temp;
>  	errno = 0;
>
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Oct. 24, 2016, 8:03 a.m. UTC | #2
On 2016年10月19日 21:26, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The open assigns file to the open descriptor, so no need to initialize
> it to NULL.  Cleans up 2 cppcheck style warnings:
>
> src/lib/src/fwts_pipeio.c:397: (style) Variable 'file' is reassigned a
>   value before the old one has been used.
> src/lib/src/fwts_pipeio.c:429: (style) Variable 'file' is reassigned a
>   value before the old one has been used
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_pipeio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index ecd4e33..0ee1de1 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -390,7 +390,7 @@ int fwts_write_string_file(
>  	const char *file_name,
>  	const char *str)
>  {
> -	FILE *file = NULL;
> +	FILE *file;
>  	int ret;
>
>  	errno = 0;
> @@ -422,7 +422,7 @@ int fwts_read_file_first_line(
>  	const char *file_name,
>  	char **line)
>  {
> -	FILE *file = NULL;
> +	FILE *file;
>  	char buffer[LINE_MAX], *temp;
>  	errno = 0;
>
>

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

Patch

diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
index ecd4e33..0ee1de1 100644
--- a/src/lib/src/fwts_pipeio.c
+++ b/src/lib/src/fwts_pipeio.c
@@ -390,7 +390,7 @@  int fwts_write_string_file(
 	const char *file_name,
 	const char *str)
 {
-	FILE *file = NULL;
+	FILE *file;
 	int ret;
 
 	errno = 0;
@@ -422,7 +422,7 @@  int fwts_read_file_first_line(
 	const char *file_name,
 	char **line)
 {
-	FILE *file = NULL;
+	FILE *file;
 	char buffer[LINE_MAX], *temp;
 	errno = 0;