ACK: [PATCH 08/13] lib: fwts_keymap: some minor fwts coding style changes

ivanhu ivan.hu at canonical.com
Thu Aug 16 09:04:46 UTC 2018



On 08/14/2018 07:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> No functional change.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  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;
>  	}
Acked-by: Ivan Hu <ivan.hu at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180816/a9f1da58/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180816/a9f1da58/attachment.sig>


More information about the fwts-devel mailing list