[PATCH 04/27] lib: fwts_log: remove const arg in fwts_log_set_field_filter

Colin King colin.king at canonical.com
Wed Aug 15 13:11:06 UTC 2018


From: Colin Ian King <colin.king at canonical.com>

Argument str should not be const as strtok_r can modify it; remove
the const.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/include/fwts_log.h | 2 +-
 src/lib/src/fwts_log.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h
index 0ddcf76f..e9da27b3 100644
--- a/src/lib/include/fwts_log.h
+++ b/src/lib/include/fwts_log.h
@@ -129,7 +129,7 @@ int       fwts_log_printf(const fwts_framework *fw, const fwts_log_field field,
 	__attribute__((format(printf, 7, 8)));
 void      fwts_log_newline(fwts_log *log);
 void      fwts_log_underline(fwts_log *log, const int ch);
-void      fwts_log_set_field_filter(const char *str);
+void      fwts_log_set_field_filter(char *str);
 int       fwts_log_set_owner(fwts_log *log, const char *owner);
 void      fwts_log_set_format(const char *str);
 void      fwts_log_print_fields(void);
diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c
index 32406f30..5a7151ec 100644
--- a/src/lib/src/fwts_log.c
+++ b/src/lib/src/fwts_log.c
@@ -274,7 +274,7 @@ void fwts_log_filter_unset_field(const fwts_log_field filter)
  *	list of field names. ~ or ^ prefix to a field name
  *	clears a bit.
  */
-void fwts_log_set_field_filter(const char *str)
+void fwts_log_set_field_filter(char *str)
 {
 	char *saveptr;
 	fwts_log_field field;
@@ -282,7 +282,7 @@ void fwts_log_set_field_filter(const char *str)
 	for (;; str=NULL) {
 		char *token;
 
-		if ((token = strtok_r((char*)str, ",|", &saveptr)) == NULL)
+		if ((token = strtok_r(str, ",|", &saveptr)) == NULL)
 			break;
 		if (*token == '^' || *token == '~') {
 			field = fwts_log_str_to_field(token+1);
-- 
2.17.1




More information about the fwts-devel mailing list