summaryrefslogtreecommitdiff
path: root/randr
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 /randr
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 'randr')
-rw-r--r--randr/rrcrtc.c36
-rw-r--r--randr/rroutput.c15
-rw-r--r--randr/rrproperty.c30
-rw-r--r--randr/rrscreen.c3
-rw-r--r--randr/rrtransform.c6
5 files changed, 30 insertions, 60 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 987f77233..f5fe76512 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -190,8 +190,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
}
else
{
- if (crtc->outputs)
- free(crtc->outputs);
+ free(crtc->outputs);
newoutputs = NULL;
}
crtc->outputs = newoutputs;
@@ -440,8 +439,7 @@ RRCrtcDestroyResource (pointer value, XID pid)
}
}
}
- if (crtc->gammaRed)
- free(crtc->gammaRed);
+ free(crtc->gammaRed);
if (crtc->mode)
RRModeDestroy (crtc->mode);
free(crtc);
@@ -563,8 +561,7 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
}
else
gamma = NULL;
- if (crtc->gammaRed)
- free(crtc->gammaRed);
+ free(crtc->gammaRed);
crtc->gammaRed = gamma;
crtc->gammaGreen = gamma + size;
crtc->gammaBlue = gamma + size*2;
@@ -805,8 +802,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
RROutputType, client, DixSetAttrAccess);
if (rc != Success)
{
- if (outputs)
- free(outputs);
+ free(outputs);
return rc;
}
/* validate crtc for this output */
@@ -815,8 +811,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
break;
if (j == outputs[i]->numCrtcs)
{
- if (outputs)
- free(outputs);
+ free(outputs);
return BadMatch;
}
/* validate mode for this output */
@@ -830,8 +825,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
if (j == outputs[i]->numModes + outputs[i]->numUserModes)
{
- if (outputs)
- free(outputs);
+ free(outputs);
return BadMatch;
}
}
@@ -850,8 +844,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
if (k == outputs[i]->numClones)
{
- if (outputs)
- free(outputs);
+ free(outputs);
return BadMatch;
}
}
@@ -900,8 +893,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
* Invalid rotation
*/
client->errorValue = stuff->rotation;
- if (outputs)
- free(outputs);
+ free(outputs);
return BadValue;
}
@@ -913,8 +905,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
* requested rotation or reflection not supported by screen
*/
client->errorValue = stuff->rotation;
- if (outputs)
- free(outputs);
+ free(outputs);
return BadMatch;
}
@@ -943,16 +934,14 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (stuff->x + source_width > pScreen->width)
{
client->errorValue = stuff->x;
- if (outputs)
- free(outputs);
+ free(outputs);
return BadValue;
}
if (stuff->y + source_height > pScreen->height)
{
client->errorValue = stuff->y;
- if (outputs)
- free(outputs);
+ free(outputs);
return BadValue;
}
}
@@ -979,8 +968,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
pScrPriv->lastSetTime = time;
sendReply:
- if (outputs)
- free(outputs);
+ free(outputs);
rep.type = X_Reply;
/* rep.status has already been filled in */
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 7822c0dc3..937b14df0 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -134,8 +134,7 @@ RROutputSetClones (RROutputPtr output,
}
else
newClones = NULL;
- if (output->clones)
- free(output->clones);
+ free(output->clones);
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
output->clones = newClones;
output->numClones = numClones;
@@ -280,8 +279,7 @@ RROutputSetCrtcs (RROutputPtr output,
}
else
newCrtcs = NULL;
- if (output->crtcs)
- free(output->crtcs);
+ free(output->crtcs);
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
output->crtcs = newCrtcs;
output->numCrtcs = numCrtcs;
@@ -402,13 +400,10 @@ RROutputDestroyResource (pointer value, XID pid)
for (m = 0; m < output->numUserModes; m++)
RRModeDestroy (output->userModes[m]);
- if (output->userModes)
- free(output->userModes);
+ free(output->userModes);
- if (output->crtcs)
- free(output->crtcs);
- if (output->clones)
- free(output->clones);
+ free(output->crtcs);
+ free(output->clones);
RRDeleteAllOutputProperties (output);
free(output);
return 1;
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 5e37577b8..a4402e147 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -69,10 +69,8 @@ RRDeleteAllOutputProperties (RROutputPtr output)
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
- if (prop->current.data)
- free(prop->current.data);
- if (prop->pending.data)
- free(prop->pending.data);
+ free(prop->current.data);
+ free(prop->pending.data);
free(prop);
}
}
@@ -109,14 +107,10 @@ RRCreateOutputProperty (Atom property)
static void
RRDestroyOutputProperty (RRPropertyPtr prop)
{
- if (prop->valid_values)
- free(prop->valid_values);
- if (prop->current.data)
- free(prop->current.data);
- if (prop->pending.data)
- free(prop->pending.data);
- if (prop->valid_values)
- free(prop->valid_values);
+ free(prop->valid_values);
+ free(prop->current.data);
+ free(prop->pending.data);
+ free(prop->valid_values);
free(prop);
}
@@ -232,12 +226,10 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
!pScrPriv->rrOutputSetProperty(output->pScreen, output,
prop->propertyName, &new_value))
{
- if (new_value.data)
- free(new_value.data);
+ free(new_value.data);
return (BadValue);
}
- if (prop_value->data)
- free(prop_value->data);
+ free(prop_value->data);
*prop_value = new_value;
}
@@ -378,8 +370,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
*/
if (prop->is_pending && !pending)
{
- if (prop->pending.data)
- free(prop->pending.data);
+ free(prop->pending.data);
RRInitOutputPropertyValue (&prop->pending);
}
@@ -387,8 +378,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
prop->range = range;
prop->immutable = immutable;
prop->num_valid = num_values;
- if (prop->valid_values)
- free(prop->valid_values);
+ free(prop->valid_values);
prop->valid_values = new_values;
if (add) {
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index a2a0f36a6..f58e6578a 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -951,8 +951,7 @@ ProcRRSetScreenConfig (ClientPtr client)
sendReply:
- if (pData)
- free(pData);
+ free(pData);
rep.type = X_Reply;
/* rep.status has already been filled in */
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 7fd4fa0b6..a470e1e75 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -37,8 +37,7 @@ RRTransformInit (RRTransformPtr transform)
void
RRTransformFini (RRTransformPtr transform)
{
- if (transform->params)
- free(transform->params);
+ free(transform->params);
}
Bool
@@ -82,8 +81,7 @@ RRTransformSetFilter (RRTransformPtr dst,
}
else
new_params = NULL;
- if (dst->params)
- free(dst->params);
+ free(dst->params);
dst->filter = filter;
dst->params = new_params;
dst->nparams = nparams;