Skip to contentSkip to conversation

tst_test: Print tags only when defined.

PATCH New Cyril Hrubis 1 participant 1 message Mar 30, 2020 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_test: Print tags only when defined.

We were printing the Tags heading even when no tags were defined.

---
 lib/tst_test.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
lib/tst_test.c +10 -9
index dae3fa1b5..e502c2c1a 100644
@@ -447,18 +447,19 @@ static void print_test_tags(void)
 	unsigned int i;
 	const struct tst_tag *tags = tst_test->tags;
 
+	if (!tags)
+		return;
+
 	printf("\nTags\n");
 	printf("----\n");
 
-	if (tags) {
-		for (i = 0; tags[i].name; i++) {
-			if (!strcmp(tags[i].name, "CVE"))
-				printf(CVE_DB_URL "%s\n", tags[i].value);
-			else if (!strcmp(tags[i].name, "linux-git"))
-				printf(LINUX_GIT_URL "%s\n", tags[i].value);
-			else
-				printf("%s: %s\n", tags[i].name, tags[i].value);
-		}
+	for (i = 0; tags[i].name; i++) {
+		if (!strcmp(tags[i].name, "CVE"))
+			printf(CVE_DB_URL "%s\n", tags[i].value);
+		else if (!strcmp(tags[i].name, "linux-git"))
+			printf(LINUX_GIT_URL "%s\n", tags[i].value);
+		else
+			printf("%s: %s\n", tags[i].name, tags[i].value);
 	}
 
 	printf("\n");
Signature · 1 line
2.24.1