Blame SOURCES/0018-dmidecode-Add-helper-function-for-separators.patch

fc71ac
From 9c7db76f373a1d25e52177b81e97bb9e0f9c32b5 Mon Sep 17 00:00:00 2001
fc71ac
From: Jean Delvare <jdelvare@suse.de>
fc71ac
Date: Wed, 1 Apr 2020 10:00:33 +0200
fc71ac
Subject: [PATCH 18/23] dmidecode: Add helper function for separators
fc71ac
fc71ac
A simple helper function to print a blank line between records.
fc71ac
fc71ac
Signed-off-by: Jean Delvare <jdelvare@suse.de>
fc71ac
---
fc71ac
 dmidecode.c | 9 +++++----
fc71ac
 dmioutput.c | 5 +++++
fc71ac
 dmioutput.h | 1 +
fc71ac
 3 files changed, 11 insertions(+), 4 deletions(-)
fc71ac
fc71ac
diff --git a/dmidecode.c b/dmidecode.c
fc71ac
index 5e9b9899ec1f..3551637e7b16 100644
fc71ac
--- a/dmidecode.c
fc71ac
+++ b/dmidecode.c
fc71ac
@@ -5068,7 +5068,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 				h->type >= 128 ? "OEM-specific" : "Unknown");
fc71ac
 			dmi_dump(h);
fc71ac
 	}
fc71ac
-	printf("\n");
fc71ac
+	pr_sep();
fc71ac
 }
fc71ac
 
fc71ac
 static void to_dmi_header(struct dmi_header *h, u8 *data)
fc71ac
@@ -5195,7 +5195,8 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
fc71ac
 		if ((unsigned long)(next - buf) > len)
fc71ac
 		{
fc71ac
 			if (display && !(opt.flags & FLAG_QUIET))
fc71ac
-				printf("\t<TRUNCATED>\n\n");
fc71ac
+				printf("\t<TRUNCATED>\n");
fc71ac
+			pr_sep();
fc71ac
 			data = next;
fc71ac
 			break;
fc71ac
 		}
fc71ac
@@ -5213,7 +5214,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
fc71ac
 			if (opt.flags & FLAG_DUMP)
fc71ac
 			{
fc71ac
 				dmi_dump(&h);
fc71ac
-				printf("\n");
fc71ac
+				pr_sep();
fc71ac
 			}
fc71ac
 			else
fc71ac
 				dmi_decode(&h, ver);
fc71ac
@@ -5271,7 +5272,7 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
fc71ac
 				pr_info("Table at 0x%08llX.",
fc71ac
 					(unsigned long long)base);
fc71ac
 		}
fc71ac
-		printf("\n");
fc71ac
+		pr_sep();
fc71ac
 	}
fc71ac
 
fc71ac
 	if ((flags & FLAG_NO_FILE_OFFSET) || (opt.flags & FLAG_FROM_DUMP))
fc71ac
diff --git a/dmioutput.c b/dmioutput.c
fc71ac
index da04450494f7..ef1c41b2f94e 100644
fc71ac
--- a/dmioutput.c
fc71ac
+++ b/dmioutput.c
fc71ac
@@ -118,3 +118,8 @@ void pr_list_end(void)
fc71ac
 {
fc71ac
 	/* a no-op for text output */
fc71ac
 }
fc71ac
+
fc71ac
+void pr_sep(void)
fc71ac
+{
fc71ac
+	printf("\n");
fc71ac
+}
fc71ac
diff --git a/dmioutput.h b/dmioutput.h
fc71ac
index 58ca5a854a79..6b5f0e0e92c5 100644
fc71ac
--- a/dmioutput.h
fc71ac
+++ b/dmioutput.h
fc71ac
@@ -30,3 +30,4 @@ void pr_subattr(const char *name, const char *format, ...);
fc71ac
 void pr_list_start(const char *name, const char *format, ...);
fc71ac
 void pr_list_item(const char *format, ...);
fc71ac
 void pr_list_end(void);
fc71ac
+void pr_sep(void);
fc71ac
-- 
fc71ac
2.17.1
fc71ac