[PATCH 03/27] lib: fwts_framework: argument 'arg' should not be const

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


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

The argument 'arg' is currently const which is not correct as it
can be modified by strtok. Remove this unwanted keyword.

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

diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index 47299ef4..bedc1ee9 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -999,12 +999,12 @@ static fwts_framework_test *fwts_framework_skip_test(fwts_framework_test *test)
  *  fwts_framework_skip_test_parse()
  *	parse optarg of comma separated list of tests to skip
  */
-static int fwts_framework_skip_test_parse(const char *arg)
+static int fwts_framework_skip_test_parse(char *arg)
 {
 	char *str;
 	char *token;
 
-	for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) {
+	for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) {
 		fwts_framework_test *test;
 
 		if ((test = fwts_framework_test_find(token)) == NULL) {
@@ -1017,12 +1017,12 @@ static int fwts_framework_skip_test_parse(const char *arg)
 	return FWTS_OK;
 }
 
-static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list)
+static int fwts_framework_filter_error_parse(char *arg, fwts_list *list)
 {
 	char *str;
 	char *token;
 
-	for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) {
+	for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) {
 		if (fwts_list_append(list, token) == NULL) {
 			fprintf(stderr, "Out of memory parsing argument %s\n", arg);
 			fwts_list_free_items(list, NULL);
@@ -1037,14 +1037,14 @@ static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list)
  *  fwts_framework_log_type_parse()
  *	parse optarg of comma separated log types
  */
-static int fwts_framework_log_type_parse(fwts_framework *fw, const char *arg)
+static int fwts_framework_log_type_parse(fwts_framework *fw, char *arg)
 {
 	char *str;
 	char *token;
 
 	fw->log_type = 0;
 
-	for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) {
+	for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) {
 		if (!strcmp(token, "plaintext"))
 			fw->log_type |= LOG_TYPE_PLAINTEXT;
 		else if (!strcmp(token, "json"))
@@ -1069,14 +1069,14 @@ static int fwts_framework_log_type_parse(fwts_framework *fw, const char *arg)
  *  fwts_framework_acpica_parse()
  *	parse optarg of comma separated acpica mode flags
  */
-static int fwts_framework_acpica_parse(fwts_framework *fw, const char *arg)
+static int fwts_framework_acpica_parse(fwts_framework *fw, char *arg)
 {
 	char *str;
 	char *token;
 
 	fw->acpica_mode = 0;
 
-	for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) {
+	for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) {
 		if (!strcmp(token, "serialized"))
 			fw->acpica_mode |= FWTS_ACPICA_MODE_SERIALIZED;
 		else if (!strcmp(token, "slack"))
-- 
2.17.1




More information about the fwts-devel mailing list