On Wed, 2012-04-18 at 14:57 +1000, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

Signed-off-by: Bastien Nocera <had...@hadess.net>

> ---
>  libwacom/libwacom-database.c |    9 +++++++--
>  libwacom/libwacom.c          |    4 ++--
>  libwacom/libwacomint.h       |    1 +
>  3 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
> index fcc9f03..2a0ee19 100644
> --- a/libwacom/libwacom-database.c
> +++ b/libwacom/libwacom-database.c
> @@ -115,6 +115,12 @@ bus_to_str (WacomBusType bus)
>       g_assert_not_reached ();
>  }
>  
> +char *
> +make_match_string (WacomBusType bus, int vendor_id, int product_id)
> +{
> +     return g_strdup_printf("%s:%04x:%04x", bus_to_str (bus), vendor_id, 
> product_id);
> +}
> +
>  static int
>  libwacom_matchstr_to_ints(const char *match, uint32_t *vendor_id, uint32_t 
> *product_id, WacomBusType *bus)
>  {
> @@ -146,7 +152,6 @@ libwacom_parse_stylus_keyfile(WacomDeviceDatabase *db, 
> const char *path)
>  
>       rc = g_key_file_load_from_file(keyfile, path, G_KEY_FILE_NONE, &error);
>       g_assert (rc);
> -
>       groups = g_key_file_get_groups (keyfile, NULL);
>       for (i = 0; groups[i]; i++) {
>               WacomStylus *stylus;
> @@ -302,7 +307,7 @@ libwacom_parse_tablet_keyfile(const char *path)
>                       device = NULL;
>                       goto out;
>               }
> -             device->match = g_strdup_printf ("%s:%04x:%04x", bus_to_str 
> (device->bus), device->vendor_id, device->product_id);
> +             device->match = make_match_string(device->bus, 
> device->vendor_id, device->product_id);
>               g_free (match);
>       }
>  
> diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> index 05ac6f1..c16e4b5 100644
> --- a/libwacom/libwacom.c
> +++ b/libwacom/libwacom.c
> @@ -209,7 +209,7 @@ libwacom_new (WacomDeviceDatabase *db, int vendor_id, int 
> product_id, WacomBusTy
>          return NULL;
>      }
>  
> -    match = g_strdup_printf ("%s:%04x:%04x", bus_to_str (bus), vendor_id, 
> product_id);
> +    match = make_match_string(bus, vendor_id, product_id);
>      device = libwacom_get_device(db, match);
>      g_free (match);
>  
> @@ -343,7 +343,7 @@ libwacom_update_match(WacomDevice *device, WacomBusType 
> bus, int vendor_id, int
>       device->product_id = product_id;
>       device->bus = bus;
>       g_free(device->match);
> -     device->match = g_strdup_printf("%s:0x%x:0x%x", bus_to_str (bus), 
> vendor_id, product_id);
> +     device->match = make_match_string(device->bus, device->vendor_id, 
> device->product_id);
>  }
>  
>  int libwacom_get_vendor_id(WacomDevice *device)
> diff --git a/libwacom/libwacomint.h b/libwacom/libwacomint.h
> index 9d5ed7a..960bb3c 100644
> --- a/libwacom/libwacomint.h
> +++ b/libwacom/libwacomint.h
> @@ -124,6 +124,7 @@ void libwacom_update_match(WacomDevice *device, 
> WacomBusType bus, int vendor_id,
>  
>  WacomBusType  bus_from_str (const char *str);
>  const char   *bus_to_str   (WacomBusType bus);
> +char *make_match_string(WacomBusType bus, int vendor_id, int product_id);
>  
> 
>  #endif /* _LIBWACOMINT_H_ */



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to