diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-01-23 18:05:12 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-03-19 16:25:26 -0700 |
commit | d60166b507096ade932d0881555e99f4dc8836bb (patch) | |
tree | f045ca321004047bcd9c2580c96c1df98b7a91a8 /src | |
parent | ba0b312ac835f3a660d610d73fba89c6f92f7efc (diff) |
makekeys: No need for strncat
Diffstat (limited to 'src')
-rw-r--r-- | src/makekeys/makekeys.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/makekeys/makekeys.c b/src/makekeys/makekeys.c index 07ba3ce..8fa6dda 100644 --- a/src/makekeys/makekeys.c +++ b/src/makekeys/makekeys.c @@ -132,8 +132,7 @@ get_xf86_keysym(const char *buf, char *key, size_t len, int index) return 0; /* Prepend XF86 or XF86_ to the key */ - snprintf(key, len, "XF86%s", is_xf86_special(tmp) ? "_" : ""); - strncat(key, tmp, len - strlen(key) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(tmp) ? "_" : "", tmp); return 1; } @@ -147,17 +146,16 @@ get_xf86_keysym_alias(const char *buf, char *key, size_t len, int index) /* Try to handle both XF86XK and XK aliases */ if (sscanf(buf, "#define XF86XK_%127s XF86XK_%127s", ktmp, atmp) == 2) { /* Prepend XF86 to the key and alias */ - snprintf(key, len, "XF86%s", is_xf86_special(ktmp) ? "_" : ""); - strncat(key, ktmp, len - strlen(key) - 1); - snprintf(alias, sizeof(alias), "XF86%s", - is_xf86_special(atmp) ? "_" : ""); - strncat(alias, atmp, sizeof(alias) - strlen(alias) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(ktmp) ? "_" : "", + ktmp); + snprintf(alias, sizeof(alias), "XF86%s%s", + is_xf86_special(atmp) ? "_" : "", atmp); } else { if (sscanf(buf, "#define XF86XK_%127s XK_%127s", ktmp, alias) != 2) return 0; /* Prepend XF86 to the key */ - snprintf(key, len, "XF86%s", is_xf86_special(ktmp) ? "_" : ""); - strncat(key, ktmp, len - strlen(key) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(ktmp) ? "_" : "", + ktmp); } for (i = index - 1; i >= 0; i--) { |