Input ABI 14 makes the InputOption struct opaque, so use the new API
provided (and wrap for older ABIs).

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/wcmValidateDevice.c |   53 +++++++++++++++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 94bcdc6..60d2091 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -308,6 +308,34 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
        return ret;
 }
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 14
+static InputOption*
+input_option_new(InputOption *list, char *key, char *value)
+{
+       InputOption *new;
+
+       new = calloc(1, sizeof(InputOption));
+       new->key = key;
+       new->value = value;
+       new->next = list;
+       return new;
+}
+
+static void
+input_option_free_list(InputOption **opts)
+{
+       InputOption *tmp = *opts;
+       while(*opts)
+       {
+               tmp = (*opts)->next;
+               free((*opts)->key);
+               free((*opts)->value);
+               free((*opts));
+               *opts = tmp;
+       }
+}
+#endif
+
 /**
  * Duplicate xf86 options, replace the "type" option with the given type
  * (and the name with "$name $type" and convert them to InputOption
@@ -322,7 +350,7 @@ static InputOption *wcmOptionDupConvert(InputInfoPtr pInfo, 
const char* basename
        WacomCommonPtr common = priv->common;
        pointer original = pInfo->options;
        WacomToolPtr ser = common->serials;
-       InputOption *iopts = NULL, *new;
+       InputOption *iopts = NULL;
        char *name;
        pointer options;
        int rc;
@@ -364,29 +392,14 @@ static InputOption *wcmOptionDupConvert(InputInfoPtr 
pInfo, const char* basename
 
        while(options)
        {
-               new = calloc(1, sizeof(InputOption));
-
-               new->key = xf86OptionName(options);
-               new->value = xf86OptionValue(options);
-               new->next = iopts;
-               iopts = new;
+               iopts = input_option_new(iopts,
+                                        xf86OptionName(options),
+                                        xf86OptionValue(options));
                options = xf86NextOption(options);
        }
        return iopts;
 }
 
-static void wcmFreeInputOpts(InputOption* opts)
-{
-       InputOption *tmp = opts;
-       while(opts)
-       {
-               tmp = opts->next;
-               free(opts->key);
-               free(opts->value);
-               free(opts);
-               opts = tmp;
-       }
-}
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
 /**
@@ -438,7 +451,7 @@ wcmHotplugDevice(ClientPtr client, pointer closure )
                              hotplug_info->attrs,
 #endif
                              &dev);
-       wcmFreeInputOpts(hotplug_info->input_options);
+       input_option_free_list(&hotplug_info->input_options);
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
        FreeInputAttributes(hotplug_info->attrs);
-- 
1.7.7


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to