summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 15:28:30 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 20:27:18 +0700
commit0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 (patch)
tree3534c9035180b7e0d2ebbbf0202a370cb61f8e8d /hw/dmx
parent5a0fc0ad21d562612676ef88ef2d533b2391810a (diff)
Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ -if(E) { free(E); } +free(E); Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/config/dmxparse.c4
-rw-r--r--hw/dmx/dmx.h2
-rw-r--r--hw/dmx/dmxinit.c4
-rw-r--r--hw/dmx/dmxstat.c2
-rw-r--r--hw/dmx/glxProxy/glxutil.c4
-rw-r--r--hw/dmx/glxProxy/glxvisuals.c3
-rw-r--r--hw/dmx/input/dmxbackend.c2
-rw-r--r--hw/dmx/input/dmxconsole.c2
-rw-r--r--hw/dmx/input/dmxinputinit.c12
-rw-r--r--hw/dmx/input/lnx-keyboard.c2
-rw-r--r--hw/dmx/input/lnx-ms.c2
-rw-r--r--hw/dmx/input/lnx-ps2.c2
-rw-r--r--hw/dmx/input/usb-common.c2
13 files changed, 20 insertions, 23 deletions
diff --git a/hw/dmx/config/dmxparse.c b/hw/dmx/config/dmxparse.c
index 28a1835af..35f1c2185 100644
--- a/hw/dmx/config/dmxparse.c
+++ b/hw/dmx/config/dmxparse.c
@@ -98,7 +98,7 @@ const char *dmxConfigCopyString(const char *string, int length)
void dmxConfigFree(void *area)
{
- if (area) free(area);
+ free(area);
}
DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
@@ -370,7 +370,7 @@ DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
void dmxConfigFreeOption(DMXConfigOptionPtr p)
{
if (!p) return;
- if (p->string) free(p->string);
+ free(p->string);
dmxConfigFreeToken(p->start);
dmxConfigFreeString(p->option);
dmxConfigFreeToken(p->end);
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h
index 4532960b5..bf4b92cb2 100644
--- a/hw/dmx/dmx.h
+++ b/hw/dmx/dmx.h
@@ -351,7 +351,7 @@ do { \
#define MAXSCREENSFREE(o) \
do { \
- if (o) free(o); \
+ free(o); \
o = NULL; \
} while (0)
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 8a03c65ce..7cd50dadf 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -606,8 +606,8 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxScreens[i].stat = NULL;
}
for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
- if (dmxScreens) free(dmxScreens);
- if (dmxInputs) free(dmxInputs);
+ free(dmxScreens);
+ free(dmxInputs);
dmxScreens = NULL;
dmxInputs = NULL;
dmxNumScreens = 0;
diff --git a/hw/dmx/dmxstat.c b/hw/dmx/dmxstat.c
index 41b0eb27c..c3f1d3b36 100644
--- a/hw/dmx/dmxstat.c
+++ b/hw/dmx/dmxstat.c
@@ -122,7 +122,7 @@ DMXStatInfo *dmxStatAlloc(void)
/** Free the memory used by a \a DMXStatInfo structure. */
void dmxStatFree(DMXStatInfo *pt)
{
- if (pt) free(pt);
+ free(pt);
}
static void dmxStatValue(DMXStatAvg *data, unsigned long value)
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
index cfd026979..18fd43ac4 100644
--- a/hw/dmx/glxProxy/glxutil.c
+++ b/hw/dmx/glxProxy/glxutil.c
@@ -105,7 +105,5 @@ __glXRealloc(void *addr, size_t newSize)
void
__glXFree(void *addr)
{
- if (addr) {
- free(addr);
- }
+ free(addr);
}
diff --git a/hw/dmx/glxProxy/glxvisuals.c b/hw/dmx/glxProxy/glxvisuals.c
index 58151b7f2..4c64db24a 100644
--- a/hw/dmx/glxProxy/glxvisuals.c
+++ b/hw/dmx/glxProxy/glxvisuals.c
@@ -531,8 +531,7 @@ Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
__glXFree(pNewVisualConfigs);
/* Free the private list created by DDX HW driver */
- if (visualPrivates)
- free(visualPrivates);
+ free(visualPrivates);
visualPrivates = NULL;
return TRUE;
diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c
index 55615cf39..e917a5c42 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -114,7 +114,7 @@ pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
* #dmxBackendCreatePrivate. */
void dmxBackendDestroyPrivate(pointer private)
{
- if (private) free(private);
+ free(private);
}
static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)
diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c
index 80df0649e..7ec209df0 100644
--- a/hw/dmx/input/dmxconsole.c
+++ b/hw/dmx/input/dmxconsole.c
@@ -148,7 +148,7 @@ pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
/** If \a private is non-NULL, free its associated memory. */
void dmxConsoleDestroyPrivate(pointer private)
{
- if (private) free(private);
+ free(private);
}
static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 814fc1a89..b2e16fba4 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -1084,9 +1084,9 @@ static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
dmxLocalCoreKeyboard = NULL;
if (local->destroy_private) local->destroy_private(local->private);
- if (local->history) free(local->history);
- if (local->valuators) free(local->valuators);
- if (local->deviceName) free(local->deviceName);
+ free(local->history);
+ free(local->valuators);
+ free(local->deviceName);
local->private = NULL;
local->history = NULL;
local->deviceName = NULL;
@@ -1100,9 +1100,9 @@ void dmxInputFree(DMXInputInfo *dmxInput)
if (!dmxInput) return;
- if (dmxInput->keycodes) free(dmxInput->keycodes);
- if (dmxInput->symbols) free(dmxInput->symbols);
- if (dmxInput->geometry) free(dmxInput->geometry);
+ free(dmxInput->keycodes);
+ free(dmxInput->symbols);
+ free(dmxInput->geometry);
for (i = 0; i < dmxInput->numDevs; i++) {
dmxInputFreeLocal(dmxInput->devs[i]);
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c
index 050c80ebf..5bfb8813c 100644
--- a/hw/dmx/input/lnx-keyboard.c
+++ b/hw/dmx/input/lnx-keyboard.c
@@ -368,7 +368,7 @@ pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
/** Destroy a private structure. */
void kbdLinuxDestroyPrivate(pointer priv)
{
- if (priv) free(priv);
+ free(priv);
}
/** Ring the bell.
diff --git a/hw/dmx/input/lnx-ms.c b/hw/dmx/input/lnx-ms.c
index 549df46e2..ee187072c 100644
--- a/hw/dmx/input/lnx-ms.c
+++ b/hw/dmx/input/lnx-ms.c
@@ -301,7 +301,7 @@ pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
/** Destroy a private structure. */
void msLinuxDestroyPrivate(pointer priv)
{
- if (priv) free(priv);
+ free(priv);
}
/** Fill the \a info structure with information needed to initialize \a
diff --git a/hw/dmx/input/lnx-ps2.c b/hw/dmx/input/lnx-ps2.c
index 70918eef4..3a220cf01 100644
--- a/hw/dmx/input/lnx-ps2.c
+++ b/hw/dmx/input/lnx-ps2.c
@@ -269,7 +269,7 @@ pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
/** Destroy a private structure. */
void ps2LinuxDestroyPrivate(pointer priv)
{
- if (priv) free(priv);
+ free(priv);
}
/** Fill the \a info structure with information needed to initialize \a
diff --git a/hw/dmx/input/usb-common.c b/hw/dmx/input/usb-common.c
index 95c00b839..25479aea6 100644
--- a/hw/dmx/input/usb-common.c
+++ b/hw/dmx/input/usb-common.c
@@ -377,5 +377,5 @@ pointer usbCreatePrivate(DeviceIntPtr pDevice)
/** Destroy a private structure. */
void usbDestroyPrivate(pointer priv)
{
- if (priv) free(priv);
+ free(priv);
}