diff options
author | Burt P <pburt0@gmail.com> | 2018-10-23 20:42:53 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-11-04 15:02:12 -0800 |
commit | 90e4cedcfc40c17c833d4acce374027044ac7377 (patch) | |
tree | a5f1972014b0cf0d0a2df79b34112f0a16f7cd6d /hardinfo/dmi_util.c | |
parent | db3efb41cb8eb83841b57d57b508baad93b5024c (diff) |
dmi_util: ignore full string of 'X' or '0'
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo/dmi_util.c')
-rw-r--r-- | hardinfo/dmi_util.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c index 82099456..5da5a99b 100644 --- a/hardinfo/dmi_util.c +++ b/hardinfo/dmi_util.c @@ -24,9 +24,12 @@ /* frees the string and sets it NULL if it is to be ignored * returns -1 if error, 0 if ok, 1 if ignored */ static int ignore_placeholder_strings(gchar **pstr) { + gchar *chk, *p; + chk = g_strdup(*pstr); + if (pstr == NULL || *pstr == NULL) return -1; -#define DMI_IGNORE(m) if (strcasecmp(m, *pstr) == 0) { g_free(*pstr); *pstr = NULL; return 1; } +#define DMI_IGNORE(m) if (strcasecmp(m, *pstr) == 0) { g_free(chk); g_free(*pstr); *pstr = NULL; return 1; } DMI_IGNORE("To be filled by O.E.M."); DMI_IGNORE("System Product Name"); DMI_IGNORE("System Manufacturer"); @@ -34,9 +37,19 @@ static int ignore_placeholder_strings(gchar **pstr) { DMI_IGNORE("Default String"); DMI_IGNORE("Rev X.0x"); /* ASUS board version nonsense */ DMI_IGNORE("x.x"); /* Gigabyte board version nonsense */ - DMI_IGNORE("XX"); /* Zotac version nonsense */ DMI_IGNORE("NA"); + + /* Zotac version nonsense */ + p = chk; + while (*p != 0) { *p = 'x'; p++; } /* all X */ + DMI_IGNORE(chk); + p = chk; + while (*p != 0) { *p = '0'; p++; } /* all 0 */ + DMI_IGNORE(chk); + /*... more, I'm sure. */ + + g_free(chk); return 0; } |