summaryrefslogtreecommitdiff
path: root/randr/rroutput.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-09-20 12:05:52 -0700
committerKeith Packard <keithp@guitar.keithp.com>2006-09-20 12:05:52 -0700
commitd08718d8fd31477e90f13b9e122504c515b46ee0 (patch)
tree2c65df397d32909eebd8ddedc7196cbce3f37852 /randr/rroutput.c
parentef1f3248cb5fff0a02c0059f865c4d931eba23a6 (diff)
Avoid calling xalloc(0). Change rrScreenSizeSet to rrScreenSetSize.
Diffstat (limited to 'randr/rroutput.c')
-rw-r--r--randr/rroutput.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 07dabad2e..3d4c16342 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -30,7 +30,7 @@ RESTYPE RROutputType;
RROutputPtr
RROutputCreate (ScreenPtr pScreen,
- char *name,
+ const char *name,
int nameLength,
void *devPrivate)
{
@@ -89,9 +89,14 @@ RROutputSetClones (RROutputPtr output,
{
RROutputPtr *newClones;
- newClones = xalloc (numClones * sizeof (RROutputPtr));
- if (!newClones)
- return FALSE;
+ if (numClones)
+ {
+ newClones = xalloc (numClones * sizeof (RROutputPtr));
+ if (!newClones)
+ return FALSE;
+ }
+ else
+ newClones = NULL;
if (output->clones)
xfree (output->clones);
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
@@ -108,9 +113,14 @@ RROutputSetModes (RROutputPtr output,
{
RRModePtr *newModes;
- newModes = xalloc (numModes * sizeof (RRModePtr));
- if (!newModes)
- return FALSE;
+ if (numModes)
+ {
+ newModes = xalloc (numModes * sizeof (RRModePtr));
+ if (!newModes)
+ return FALSE;
+ }
+ else
+ newModes = NULL;
if (output->modes)
xfree (output->modes);
memcpy (newModes, modes, numModes * sizeof (RRModePtr));
@@ -127,9 +137,14 @@ RROutputSetCrtcs (RROutputPtr output,
{
RRCrtcPtr *newCrtcs;
- newCrtcs = xalloc (numCrtcs * sizeof (RRCrtcPtr));
- if (!newCrtcs)
- return FALSE;
+ if (numCrtcs)
+ {
+ newCrtcs = xalloc (numCrtcs * sizeof (RRCrtcPtr));
+ if (!newCrtcs)
+ return FALSE;
+ }
+ else
+ newCrtcs = NULL;
if (output->crtcs)
xfree (output->crtcs);
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
@@ -265,9 +280,14 @@ ProcRRGetOutputInfo (ClientPtr client)
((rep.nameLength + 3) >> 2));
extraLen = rep.length << 2;
- extra = xalloc (extraLen);
- if (!extra)
- return BadAlloc;
+ if (extraLen)
+ {
+ extra = xalloc (extraLen);
+ if (!extra)
+ return BadAlloc;
+ }
+ else
+ extra = NULL;
crtcs = (RRCrtc *) extra;
modes = (RRMode *) (crtcs + output->numCrtcs);