<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 08/14/2018 07:24 PM, Colin King
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20180814112435.22166-9-colin.king@canonical.com">
<pre wrap="">From: Colin Ian King <a class="moz-txt-link-rfc2396E" href="mailto:colin.king@canonical.com"><colin.king@canonical.com></a>
No functional change.
Signed-off-by: Colin Ian King <a class="moz-txt-link-rfc2396E" href="mailto:colin.king@canonical.com"><colin.king@canonical.com></a>
---
src/lib/src/fwts_keymap.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/lib/src/fwts_keymap.c b/src/lib/src/fwts_keymap.c
index a3256630..296c7443 100644
--- a/src/lib/src/fwts_keymap.c
+++ b/src/lib/src/fwts_keymap.c
@@ -31,6 +31,7 @@
static void fwts_keymap_keycode_free(void *data)
{
fwts_keycode *keycode = (fwts_keycode*)data;
+
free(keycode->keyname);
free(keycode->keytext);
free(keycode);
@@ -70,24 +71,23 @@ fwts_list *fwts_keymap_load(const char *machine)
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
fwts_keycode *key;
char *str = buffer;
- int scancode;
char *keyname = NULL;
char *keytext = NULL;
+ int scancode;
scancode = strtoul(buffer, &str, 16);
-
- if (str == NULL || *str == '\0')
+ if ((str == NULL) || (*str == '\0'))
continue;
/* Skip over whitespace */
- while (*str != '\0' && isspace(*str))
+ while ((*str != '\0') && isspace(*str))
str++;
if (*str == '\0')
continue;
keyname = str;
/* Skip over keyname */
- while (*str != '\0' && !isspace(*str))
+ while ((*str != '\0') && !isspace(*str))
str++;
keytext = keyname; /* Default if we cannot find human readable name */
@@ -132,6 +132,7 @@ fwts_keycode *fwts_keymap_find_scancode(fwts_list *keymap, const int scancode)
fwts_list_foreach(item, keymap) {
fwts_keycode *keycode = fwts_list_data(fwts_keycode*, item);
+
if (keycode->scancode == scancode)
return keycode;
}
</pre>
</blockquote>
Acked-by: Ivan Hu <a class="moz-txt-link-rfc2396E"
href="mailto:ivan.hu@canonical.com"><ivan.hu@canonical.com></a>
</body>
</html>