diff mbox series

lib: fwts_log: remove redundant initialization of ptr1

Message ID 20180131100732.15177-1-colin.king@canonical.com
State Accepted
Headers show
Series lib: fwts_log: remove redundant initialization of ptr1 | expand

Commit Message

Colin Ian King Jan. 31, 2018, 10:07 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Pointer ptr1 is initialized to str and then again in a for-loop,
hence the initialization is redundant and can be removed.

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

Comments

Alex Hung Feb. 2, 2018, 2:48 a.m. UTC | #1
On 2018-01-31 02:07 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer ptr1 is initialized to str and then again in a for-loop,
> hence the initialization is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_log.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c
> index beceb98b..c699e4dc 100644
> --- a/src/lib/src/fwts_log.c
> +++ b/src/lib/src/fwts_log.c
> @@ -139,7 +139,7 @@ char *fwts_log_field_to_str_full(const fwts_log_field field)
>   char *fwts_log_field_to_str_upper(const fwts_log_field field)
>   {
>   	static char str[16];
> -	char *ptr1 = str;
> +	char *ptr1;
>   	char *ptr2 = fwts_log_field_to_str_full(field);
>   
>   	for (ptr1 = str; *ptr2; ptr1++, ptr2++)
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Feb. 6, 2018, 3 a.m. UTC | #2
On 01/31/2018 06:07 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Pointer ptr1 is initialized to str and then again in a for-loop,
> hence the initialization is redundant and can be removed.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_log.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c
> index beceb98b..c699e4dc 100644
> --- a/src/lib/src/fwts_log.c
> +++ b/src/lib/src/fwts_log.c
> @@ -139,7 +139,7 @@ char *fwts_log_field_to_str_full(const fwts_log_field field)
>  char *fwts_log_field_to_str_upper(const fwts_log_field field)
>  {
>  	static char str[16];
> -	char *ptr1 = str;
> +	char *ptr1;
>  	char *ptr2 = fwts_log_field_to_str_full(field);
>  
>  	for (ptr1 = str; *ptr2; ptr1++, ptr2++)

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

Patch

diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c
index beceb98b..c699e4dc 100644
--- a/src/lib/src/fwts_log.c
+++ b/src/lib/src/fwts_log.c
@@ -139,7 +139,7 @@  char *fwts_log_field_to_str_full(const fwts_log_field field)
 char *fwts_log_field_to_str_upper(const fwts_log_field field)
 {
 	static char str[16];
-	char *ptr1 = str;
+	char *ptr1;
 	char *ptr2 = fwts_log_field_to_str_full(field);
 
 	for (ptr1 = str; *ptr2; ptr1++, ptr2++)