[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 3/3] dmidecode: Use _dmi_string for dmi_set_vendor
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 3/3] dmidecode: Use _dmi_string for dmi_set_vendor |
Date: |
Tue, 1 Dec 2020 17:38:22 +0100 |
The strings passed to dmi_set_vendor will never be printed,
they are used for comparison purposes only, so the pre- and
post-processing done by dmi_string is not needed. Call
_dmi_string instead, which is faster.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 3 ++-
dmioem.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
--- dmidecode.orig/dmidecode.c 2020-11-30 11:45:37.404919761 +0100
+++ dmidecode/dmidecode.c 2020-12-01 15:52:27.280838856 +0100
@@ -5243,7 +5243,8 @@ static void dmi_table_decode(u8 *buf, u3
/* assign vendor for vendor-specific decodes later */
if (h.type == 1 && h.length >= 6)
- dmi_set_vendor(dmi_string(&h, data[0x04]),
dmi_string(&h, data[0x5]));
+ dmi_set_vendor(_dmi_string(&h, data[0x04], 0),
+ _dmi_string(&h, data[0x05], 0));
/* Fixup a common mistake */
if (h.type == 34)
--- dmidecode.orig/dmioem.c 2020-12-01 15:56:34.782579802 +0100
+++ dmidecode/dmioem.c 2020-12-01 16:00:00.559858672 +0100
@@ -68,7 +68,7 @@ void dmi_set_vendor(const char *v, const
* Often DMI strings have trailing spaces. Ignore these
* when checking for known vendor names.
*/
- len = strlen(v);
+ len = v ? strlen(v) : 0;
while (len && v[len - 1] == ' ')
len--;
--
Jean Delvare
SUSE L3 Support