summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-12-12 04:47:25 +0000
committersabetts <sabetts>2001-12-12 04:47:25 +0000
commit3eb8a4e3251386c676c3d0696dc20837e9f58010 (patch)
tree95c2fe2f8b899cf6684d54fe45a58bf7781bb2a0 /src/actions.c
parentbd89c88e67399fb610305ce51b41d778171816b7 (diff)
downloadratpoison-3eb8a4e3251386c676c3d0696dc20837e9f58010.zip
(parse_keydesc): Don't mangle the key description
argument.
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/actions.c b/src/actions.c
index 367968d..950c22d 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -328,16 +328,20 @@ static int string_to_keysym (char *str)
return keysym;
}
+/* Parse a key description. 's' is, naturally, the key description. */
struct rp_key*
-parse_keydesc (char *keydesc)
+parse_keydesc (char *s)
{
static struct rp_key key;
struct rp_key *p = &key;
- char *token, *next_token;
+ char *token, *next_token, *keydesc;
- if (!keydesc)
+ if (s == NULL)
return NULL;
+ /* Avoid mangling s. */
+ keydesc = xstrdup (s);
+
p->state = 0;
p->sym = 0;
@@ -354,6 +358,7 @@ parse_keydesc (char *keydesc)
if (token == NULL)
{
/* It was nothing but hyphens */
+ free (keydesc);
return NULL;
}
@@ -394,6 +399,7 @@ parse_keydesc (char *keydesc)
}
else
{
+ free (keydesc);
return NULL;
}
}
@@ -402,6 +408,8 @@ parse_keydesc (char *keydesc)
} while (next_token != NULL);
}
+ free (keydesc);
+
if (!p->sym)
return NULL;
else