[09/27] lib: fwts_text_list: fix up some const casting issues
diff mbox series

Message ID 20180815131129.24146-10-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>

Fix some const char pointer casting warnings

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

Comments

Alex Hung Aug. 15, 2018, 5:55 p.m. UTC | #1
On 2018-08-15 06:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Fix some const char pointer casting warnings
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_text_list.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lib/src/fwts_text_list.c b/src/lib/src/fwts_text_list.c
> index c223afbb..4255e573 100644
> --- a/src/lib/src/fwts_text_list.c
> +++ b/src/lib/src/fwts_text_list.c
> @@ -82,8 +82,8 @@ char *fwts_text_list_strstr(fwts_list *list, const char *needle)
>    */
>   fwts_list *fwts_list_from_text(const char *text)
>   {
> -	char *ptr;
> -        fwts_list *list;
> +	const char *ptr;
> +	fwts_list *list;
>   
>   	if (text == NULL)
>   		return NULL;
> @@ -91,10 +91,10 @@ fwts_list *fwts_list_from_text(const char *text)
>   	if ((list = fwts_list_new()) == NULL)
>   		return NULL;
>   
> -	ptr = (char*)text;
> +	ptr = text;
>   
>   	while (*ptr) {
> -		char *start = ptr;
> +		const char *start = ptr;
>   		char *str;
>   		int len;
>   
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Aug. 16, 2018, 9:14 a.m. UTC | #2
On 08/15/2018 09:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Fix some const char pointer casting warnings
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_text_list.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/lib/src/fwts_text_list.c b/src/lib/src/fwts_text_list.c
> index c223afbb..4255e573 100644
> --- a/src/lib/src/fwts_text_list.c
> +++ b/src/lib/src/fwts_text_list.c
> @@ -82,8 +82,8 @@ char *fwts_text_list_strstr(fwts_list *list, const char *needle)
>   */
>  fwts_list *fwts_list_from_text(const char *text)
>  {
> -	char *ptr;
> -        fwts_list *list;
> +	const char *ptr;
> +	fwts_list *list;
>  
>  	if (text == NULL)
>  		return NULL;
> @@ -91,10 +91,10 @@ fwts_list *fwts_list_from_text(const char *text)
>  	if ((list = fwts_list_new()) == NULL)
>  		return NULL;
>  
> -	ptr = (char*)text;
> +	ptr = text;
>  
>  	while (*ptr) {
> -		char *start = ptr;
> +		const char *start = ptr;
>  		char *str;
>  		int len;
>  

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

Patch
diff mbox series

diff --git a/src/lib/src/fwts_text_list.c b/src/lib/src/fwts_text_list.c
index c223afbb..4255e573 100644
--- a/src/lib/src/fwts_text_list.c
+++ b/src/lib/src/fwts_text_list.c
@@ -82,8 +82,8 @@  char *fwts_text_list_strstr(fwts_list *list, const char *needle)
  */
 fwts_list *fwts_list_from_text(const char *text)
 {
-	char *ptr;
-        fwts_list *list;
+	const char *ptr;
+	fwts_list *list;
 
 	if (text == NULL)
 		return NULL;
@@ -91,10 +91,10 @@  fwts_list *fwts_list_from_text(const char *text)
 	if ((list = fwts_list_new()) == NULL)
 		return NULL;
 
-	ptr = (char*)text;
+	ptr = text;
 
 	while (*ptr) {
-		char *start = ptr;
+		const char *start = ptr;
 		char *str;
 		int len;