[PATCH 1/4] Fix a couple of compiler warnings

Dan Nicholson dbn.lists at gmail.com
Sat May 8 09:06:26 PDT 2010


On Sat, May 8, 2010 at 3:57 AM, Julien Cristau <jcristau at debian.org> wrote:
> On Fri, May  7, 2010 at 23:19:18 -0700, Keith Packard wrote:
>
>> Signed-off-by: Keith Packard <keithp at keithp.com>
>> ---
>>  config/udev.c             |    6 +++---
>>  hw/dmx/dmxgc.c            |    2 ++
>>  hw/dmx/glxProxy/glxcmds.c |    2 +-
>>  3 files changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/config/udev.c b/config/udev.c
>> index 452fb5a..a56fcd6 100644
>> --- a/config/udev.c
>> +++ b/config/udev.c
>> @@ -81,12 +81,12 @@ device_added(struct udev_device *udev_device)
>>      if (!name)
>>          name = "(unnamed)";
>>      else
>> -        attrs.product = name;
>> +        attrs.product = (char *) name;
>>      add_option(&options, "name", name);
>>
>>      add_option(&options, "path", path);
>>      add_option(&options, "device", path);
>> -    attrs.device = path;
>> +    attrs.device = (char *) path;
>>      attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");
>>
>>      config_info = Xprintf("udev:%s", syspath);
>> @@ -119,7 +119,7 @@ device_added(struct udev_device *udev_device)
>>              else if (!strcasecmp(tmp, "options"))
>>                  add_option(&options, "xkb_options", value);
>>          } else if (!strcmp(key, "ID_VENDOR")) {
>> -            attrs.vendor = value;
>> +            attrs.vendor = (char *) value;
>>          } else if (!strcmp(key, "ID_INPUT_KEY")) {
>>              attrs.flags |= ATTR_KEYBOARD;
>>          } else if (!strcmp(key, "ID_INPUT_MOUSE")) {
>
> Can we make the stuff in InputAttributes const instead?

No, because the strings from hal are not const. I have a patch to make
config/udev dup the strings because:

1. udevd might die
2. the device might get immediately removed

In either case, you're holding a pointer into udev's database that
might go away at any time. Doesn't seem like a situation we'd want to
be in.

--
Dan


More information about the xorg-devel mailing list