[01/27] lib: fwts_framework: ensure src pointer is const
diff mbox series

Message ID 20180815131129.24146-2-colin.king@canonical.com
State Accepted
Headers show
Series
  • [01/27] lib: fwts_framework: ensure src pointer is const
Related show

Commit Message

Colin King Aug. 15, 2018, 1:11 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

We are reading src from a const static string, so make src
pointer const char *.

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

Comments

Alex Hung Aug. 15, 2018, 5:54 p.m. UTC | #1
On 2018-08-15 06:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> We are reading src from a const static string, so make src
> pointer const char *.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_framework.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index f6e7b72e..60b9bd66 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -286,7 +286,8 @@ static void fwts_framework_show_tests_categories(void)
>   
>   		for (i = 0; categories[i].title != NULL; i++) {
>   			if (categories[i].flag & test->flags) {
> -				char *src = (char *)categories[i].title, *dst;
> +				const char *src = (const char *)categories[i].title;
> +				char *dst;
>   				size_t len = strlen(src) + 1;
>   				char buf[len];
>   
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Aug. 16, 2018, 9:11 a.m. UTC | #2
On 08/15/2018 09:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We are reading src from a const static string, so make src
> pointer const char *.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_framework.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index f6e7b72e..60b9bd66 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -286,7 +286,8 @@ static void fwts_framework_show_tests_categories(void)
>  
>  		for (i = 0; categories[i].title != NULL; i++) {
>  			if (categories[i].flag & test->flags) {
> -				char *src = (char *)categories[i].title, *dst;
> +				const char *src = (const char *)categories[i].title;
> +				char *dst;
>  				size_t len = strlen(src) + 1;
>  				char buf[len];
>  

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

Patch
diff mbox series

diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index f6e7b72e..60b9bd66 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -286,7 +286,8 @@  static void fwts_framework_show_tests_categories(void)
 
 		for (i = 0; categories[i].title != NULL; i++) {
 			if (categories[i].flag & test->flags) {
-				char *src = (char *)categories[i].title, *dst;
+				const char *src = (const char *)categories[i].title;
+				char *dst;
 				size_t len = strlen(src) + 1;
 				char buf[len];