summaryrefslogtreecommitdiff
path: root/libnm/nm-libnm-utils.c
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-02-23 14:52:05 +0100
committerLubomir Rintel <lkundrak@v3.sk>2018-02-23 19:47:19 +0100
commit280d095fdffd569c64bc7516cce1a2ea8751f5f9 (patch)
treec3ee6d12747d2dbd9c3ef3b5dbb4fa1570c5e7fc /libnm/nm-libnm-utils.c
parente974261e895661bed67277bcacdb2389a1c27258 (diff)
downloadNetworkManager-280d095fdffd569c64bc7516cce1a2ea8751f5f9.tar.gz
libnm/utils: ignore stuff in parentheses for vendor/product fixups
It's always useless.
Diffstat (limited to 'libnm/nm-libnm-utils.c')
-rw-r--r--libnm/nm-libnm-utils.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libnm/nm-libnm-utils.c b/libnm/nm-libnm-utils.c
index 9f05296b3b..9aea2d47d5 100644
--- a/libnm/nm-libnm-utils.c
+++ b/libnm/nm-libnm-utils.c
@@ -31,6 +31,7 @@ _fixup_string (const char *desc,
const char *const *ignored_words)
{
char *desc_full;
+ gboolean in_paren = FALSE;
char *p, *q;
int i;
@@ -48,11 +49,16 @@ _fixup_string (const char *desc,
p = q + 1;
}
- /* replace '_', ',', and ASCII controll characters with space. */
+ /* replace '_', ',', ASCII control characters and parentheses, with space. */
for (p = desc_full; p[0]; p++) {
+ if (*p == '(')
+ in_paren = TRUE;
if ( NM_IN_SET (*p, '_', ',')
- || *p < ' ')
+ || *p < ' '
+ || in_paren)
*p = ' ';
+ if (*p == ')')
+ in_paren = FALSE;
}
/* Attempt to shorten ID by ignoring certain phrases */