[PATCH 1/7] Fix a couple of compiler warnings
Keith Packard
keithp at keithp.com
Fri May 14 17:41:41 PDT 2010
On Thu, 13 May 2010 09:49:45 -0400, Kristian Høgsberg <krh at bitplanet.net> wrote:
>
> This works for me and seems like a better way to fix those warnings:
>
> diff --git a/include/input.h b/include/input.h
> index 63f981e..eba4292 100644
> --- a/include/input.h
> +++ b/include/input.h
> @@ -212,10 +212,10 @@ typedef struct _InputOption {
> } InputOption;
>
> typedef struct _InputAttributes {
> - char *product;
> - char *vendor;
> - char *device;
> - char **tags; /* null-terminated */
> + const char *product;
> + const char *vendor;
> + const char *device;
> + const char **tags; /* null-terminated */
> uint32_t flags;
> } InputAttributes;
I had to add some casts while freeing to get rid of the warnings there
too:
From 398b7b0922732fbaa0418059e93efeed57070167 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp at keithp.com>
Date: Fri, 14 May 2010 17:39:18 -0700
Subject: [PATCH] Fix a couple of compiler warnings
Signed-off-by: Keith Packard <keithp at keithp.com>
---
config/udev.c | 8 ++++----
include/input.h | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/config/udev.c b/config/udev.c
index 5e8d8da..c579ee2 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -87,7 +87,7 @@ device_added(struct udev_device *udev_device)
add_option(&options, "path", path);
add_option(&options, "device", path);
attrs.device = path;
- attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");
+ attrs.tags = (const char *const *) xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");
config_info = Xprintf("udev:%s", syspath);
if (!config_info)
@@ -155,12 +155,12 @@ device_added(struct udev_device *udev_device)
}
if (attrs.tags) {
- char **tag = attrs.tags;
+ const char *const *tag = attrs.tags;
while (*tag) {
- free(*tag);
+ free((void *) *tag);
tag++;
}
- free(attrs.tags);
+ free((void *) attrs.tags);
}
return;
diff --git a/include/input.h b/include/input.h
index 63f981e..cc5ba1d 100644
--- a/include/input.h
+++ b/include/input.h
@@ -212,10 +212,10 @@ typedef struct _InputOption {
} InputOption;
typedef struct _InputAttributes {
- char *product;
- char *vendor;
- char *device;
- char **tags; /* null-terminated */
+ const char *product;
+ const char *vendor;
+ const char *device;
+ const char *const *tags; /* null-terminated */
uint32_t flags;
} InputAttributes;
--
1.7.1
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100514/65484b5b/attachment.pgp>
More information about the xorg-devel
mailing list