[PATCH v2 evdev 3/3] Remove constness of device filename to avoid warning when freed.

Rami Ylimäki rami.ylimaki at vincit.fi
Tue Mar 8 01:23:47 PST 2011


A warning from free() can be avoided by casting the constness away
from its argument pointer or by not declaring the pointer as const in
the first place.

Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
---
 src/evdev.c |    2 +-
 src/evdev.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index db62375..474d20d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2171,7 +2171,7 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
         /* Release strings allocated in EvdevAddKeyClass. */
         XkbFreeRMLVOSet(&pEvdev->rmlvo, FALSE);
         /* Release string allocated in EvdevOpenDevice. */
-        free((void *)pEvdev->device); /* (const char *) */
+        free(pEvdev->device);
         pEvdev->device = NULL;
     }
     xf86DeleteInput(pInfo, flags);
diff --git a/src/evdev.h b/src/evdev.h
index f640fdd..80e4580 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -116,7 +116,7 @@ typedef struct {
 } EventQueueRec, *EventQueuePtr;
 
 typedef struct {
-    const char *device;
+    char *device;
     int grabDevice;         /* grab the event device? */
 
     int num_vals;           /* number of valuators */
-- 
1.6.3.3



More information about the xorg-devel mailing list