summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-12-08 16:53:48 +0100
committerDave Davenport <qball@gmpclient.org>2016-12-08 16:53:48 +0100
commitea28bcdc74dc4085b1c337dcb469aa641b3a8a6c (patch)
treea00f6aa4448f0a138650c1e517eb31c3d5f59b7e /source/x11-helper.c
parenta259738720f8e35df7df387faad4ffcc2b6c2a23 (diff)
Use g_strsplit_set instead of strtok so we can run g_strsplit in place
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r--source/x11-helper.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 5061e347..20894a17 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -648,8 +648,10 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key
char *saveptr = NULL;
xkb_keysym_t sym = XKB_KEY_NoSymbol;
- for ( char *entry = strtok_r ( mod_key, "+-", &saveptr ); error_msg == NULL && entry != NULL;
- entry = strtok_r ( NULL, "+-", &saveptr ) ) {
+
+ char **entries = g_strsplit_set ( mod_key, "+-", -1);
+ for ( int i = 0; entries && entries[i]; i++ ) {
+ char *entry = entries[i];
// Remove trailing and leading spaces.
entry = g_strstrip ( entry );
// Compare against lowered version.
@@ -698,6 +700,7 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key
}
g_free ( entry_lowered );
}
+ g_strfreev(entries);
g_free ( input_key );