summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2007-11-05 14:10:21 +0000
committerDaniel Stone <daniel@fooishbar.org>2007-11-05 14:34:42 +0000
commitd57060f16714f5667722001bd1a4500059dd59e1 (patch)
treea50c464da9ebb4a242f7be7f1ed527e03b81af39 /hw/dmx
parentdef6f74f2d7342f85f3df2053e0b9c1ac483b51d (diff)
DMX: Remove usage of alloca
Replace with heap allocations.
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/dmx.c48
-rw-r--r--hw/dmx/dmxextension.c12
-rw-r--r--hw/dmx/dmxpict.c10
3 files changed, 35 insertions, 35 deletions
diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 24d1620b8..5f1fc0546 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -424,7 +424,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
if (!_DMXXineramaActive()) goto noxinerama;
- if (!(attribs = ALLOCATE_LOCAL(stuff->screenCount * sizeof(*attribs))))
+ if (!(attribs = xalloc(stuff->screenCount * sizeof(*attribs))))
return BadAlloc;
for (i = 0; i < stuff->screenCount; i++) {
@@ -443,7 +443,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
&errorScreen);
#endif
- DEALLOCATE_LOCAL(attribs);
+ xfree(attribs);
if (status == BadValue) return status;
@@ -489,7 +489,7 @@ static int ProcDMXAddScreen(ClientPtr client)
value_list = (CARD32 *)(stuff + 1);
count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
+ if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
name[stuff->displayNameLength] = '\0';
@@ -497,7 +497,7 @@ static int ProcDMXAddScreen(ClientPtr client)
status = dmxAttachScreen(stuff->physicalScreen, &attr);
- DEALLOCATE_LOCAL(name);
+ xfree(name);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -617,30 +617,30 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
- if (!(screens = ALLOCATE_LOCAL(count * sizeof(*screens))))
+ if (!(screens = xalloc(count * sizeof(*screens))))
return BadAlloc;
- if (!(windows = ALLOCATE_LOCAL(count * sizeof(*windows)))) {
- DEALLOCATE_LOCAL(screens);
+ if (!(windows = xalloc(count * sizeof(*windows)))) {
+ xfree(screens);
return BadAlloc;
}
- if (!(pos = ALLOCATE_LOCAL(count * sizeof(*pos)))) {
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
+ if (!(pos = xalloc(count * sizeof(*pos)))) {
+ xfree(windows);
+ xfree(screens);
return BadAlloc;
}
- if (!(vis = ALLOCATE_LOCAL(count * sizeof(*vis)))) {
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
+ if (!(vis = xalloc(count * sizeof(*vis)))) {
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
return BadAlloc;
}
if ((count = dmxPopulate(client, stuff->window, screens, windows,
pos, vis)) < 0) {
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
+ xfree(vis);
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
return BadWindow;
}
@@ -678,10 +678,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
WriteToClient(client, count * sizeof(*vis), (char *)vis);
}
- DEALLOCATE_LOCAL(vis);
- DEALLOCATE_LOCAL(pos);
- DEALLOCATE_LOCAL(windows);
- DEALLOCATE_LOCAL(screens);
+ xfree(vis);
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
return client->noClientException;
}
@@ -842,7 +842,7 @@ static int ProcDMXAddInput(ClientPtr client)
value_list = (CARD32 *)(stuff + 1);
count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
- if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
+ if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
name[stuff->displayNameLength] = '\0';
@@ -850,7 +850,7 @@ static int ProcDMXAddInput(ClientPtr client)
status = dmxAddInput(&attr, &id);
- DEALLOCATE_LOCAL(name);
+ xfree(name);
if (status) return status;
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 103364446..560468c4b 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1121,9 +1121,9 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
}
/* Now allocate the memory we need */
- images = ALLOCATE_LOCAL(len_images*sizeof(char));
- gids = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(Glyph));
- glyphs = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+ images = xalloc(len_images*sizeof(char));
+ gids = xalloc(glyphSet->hash.tableEntries*sizeof(Glyph));
+ glyphs = xalloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
memset(images, 0, len_images * sizeof(char));
pos = images;
@@ -1159,9 +1159,9 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
len_images);
/* Clean up */
- DEALLOCATE_LOCAL(len_images);
- DEALLOCATE_LOCAL(gids);
- DEALLOCATE_LOCAL(glyphs);
+ xfree(len_images);
+ xfree(gids);
+ xfree(glyphs);
}
#endif
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 478542a13..bbb744c45 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -531,13 +531,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
/* The following only works for Render version > 0.2 */
/* All of the XGlyphElt* structure sizes are identical */
- elts = ALLOCATE_LOCAL(nelt * sizeof(XGlyphElt8));
+ elts = xalloc(nelt * sizeof(XGlyphElt8));
if (!elts)
return BadAlloc;
- glyphs = ALLOCATE_LOCAL(nglyph * size);
+ glyphs = xalloc(nglyph * size);
if (!glyphs) {
- DEALLOCATE_LOCAL(elts);
+ xfree(elts);
return BadAlloc;
}
@@ -605,8 +605,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
dmxSync(dmxScreen, FALSE);
- DEALLOCATE_LOCAL(elts);
- DEALLOCATE_LOCAL(glyphs);
+ xfree(elts);
+ xfree(glyphs);
}
return ret;