summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keys.c35
-rw-r--r--options.c4
2 files changed, 19 insertions, 20 deletions
diff --git a/keys.c b/keys.c
index f90096c..9b79389 100644
--- a/keys.c
+++ b/keys.c
@@ -257,17 +257,19 @@ void
set_keysym (Keys_t * key, EventType_t event_type, KeySym keysym,
unsigned int modifier, char *command, SCM function)
{
+ int size;
+
key->type = SYM;
key->event_type = event_type;
key->key.sym = keysym;
key->modifier = modifier;
if (command != NULL)
- {
- key->command = (char *) malloc ((strlen (command) + 1) * sizeof (char));
-
+ {
+ size = (strlen (command) + 1) * sizeof (char);
+ key->command = (char *) malloc (size);
if (key->command != NULL)
- strncpy (key->command, command, strlen (command) + 1);
+ strncpy (key->command, command, size);
}
else
{
@@ -275,30 +277,25 @@ set_keysym (Keys_t * key, EventType_t event_type, KeySym keysym,
}
key->function = function;
-
- // printf("******************* ICICICICICI *********************\n");
- //#ifdef GUILE_FLAG
- // printf(" name=%d\n", SCM_IMP (key->function));
- //#endif
-
- // scm_permanent_object (key->function);
}
void
set_keycode (Keys_t * key, EventType_t event_type, KeyCode keycode,
unsigned int modifier, char *command, SCM function)
{
+ int size;
+
key->type = CODE;
key->event_type = event_type;
key->key.code = keycode;
key->modifier = modifier;
if (command != NULL)
- {
- key->command = (char *) malloc ((strlen (command) + 1) * sizeof (char));
-
+ {
+ size = (strlen (command) + 1) * sizeof (char);
+ key->command = (char *) malloc (size);
if (key->command != NULL)
- strncpy (key->command, command, strlen (command) + 1);
+ strncpy (key->command, command, size);
}
else
{
@@ -313,6 +310,8 @@ void
set_button (Keys_t * key, EventType_t event_type, unsigned int button,
unsigned int modifier, char *command, SCM function)
{
+ int size;
+
key->type = BUTTON;
key->event_type = event_type;
key->key.button = button;
@@ -320,10 +319,10 @@ set_button (Keys_t * key, EventType_t event_type, unsigned int button,
if (command != NULL)
{
- key->command = (char *) malloc ((strlen (command) + 1) * sizeof (char));
-
+ size = (strlen (command) + 1) * sizeof (char);
+ key->command = (char *) malloc (size);
if (key->command != NULL)
- strncpy (key->command, command, strlen (command) + 1);
+ strncpy (key->command, command, size);
}
else
{
diff --git a/options.c b/options.c
index 18487a8..7257091 100644
--- a/options.c
+++ b/options.c
@@ -178,7 +178,7 @@ get_options (int argc, char **argv)
if (rc_file != NULL)
{
strncpy (rc_file, home, sizeof (rc_file) - 20);
- strncat (rc_file, "/.xbindkeysrc", sizeof (rc_file));
+ strncat (rc_file, "/.xbindkeysrc", 20);
}
}
@@ -190,7 +190,7 @@ get_options (int argc, char **argv)
if (rc_guile_file != NULL)
{
strncpy (rc_guile_file, home, sizeof (rc_guile_file) - 20);
- strncat (rc_guile_file, "/.xbindkeysrc.scm", sizeof (rc_guile_file));
+ strncat (rc_guile_file, "/.xbindkeysrc.scm", 20);
}
}
#endif