[PATCH] fwts_summary: move two arrays into function fwts_summary_report

Colin King colin.king at canonical.com
Sun Apr 11 13:45:24 UTC 2021


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

The scope of arrays summary_names and summary_levels are limited
to function fwts_summary_report so move them into this function.

Clean up a couple of comments by removing some indentation.

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

diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
index fe865621..48f87cfc 100644
--- a/src/lib/src/fwts_summary.c
+++ b/src/lib/src/fwts_summary.c
@@ -24,8 +24,8 @@
 #include "fwts.h"
 
 typedef struct {
-	char *test;		/* test that found the error */
-	char *text;		/* text of failure message */
+	char *test;	/* test that found the error */
+	char *text;	/* text of failure message */
 } fwts_summary_item;
 
 enum {
@@ -38,22 +38,6 @@ enum {
 	SUMMARY_MAX = SUMMARY_UNKNOWN+1
 };
 
-static const char *summary_names[] = {
-	"Critical",
-	"High",
-	"Medium",
-	"Low",
-	"Other"
-};
-
-static const int summary_levels[] = {
-	LOG_LEVEL_CRITICAL,
-	LOG_LEVEL_HIGH,
-	LOG_LEVEL_MEDIUM,
-	LOG_LEVEL_LOW,
-	LOG_LEVEL_NONE
-};
-
 /* list of summary items per error level */
 static fwts_list *fwts_summaries[SUMMARY_MAX];
 
@@ -186,6 +170,22 @@ static void fwts_summary_format_field(
  */
 int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
 {
+	static const char *summary_names[] = {
+		"Critical",
+		"High",
+		"Medium",
+		"Low",
+		"Other"
+	};
+
+	static const int summary_levels[] = {
+		LOG_LEVEL_CRITICAL,
+		LOG_LEVEL_HIGH,
+		LOG_LEVEL_MEDIUM,
+		LOG_LEVEL_LOW,
+		LOG_LEVEL_NONE
+	};
+
 	int i;
 
 	fwts_log_summary(fw, "Test Failure Summary");
-- 
2.30.2




More information about the fwts-devel mailing list