randr: RROutputCreate(): use calloc()

We can rely on everything being cleared. And usually even faster, as the
compiler can emit optimized instructions for clearing a whole block at once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-29 18:23:15 +02:00 committed by Marge Bot
parent 1bc6ca30a9
commit 3d3137513a

View File

@ -83,7 +83,7 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv->outputs = outputs; pScrPriv->outputs = outputs;
output = malloc(sizeof(RROutputRec) + nameLength + 1); output = calloc(1, sizeof(RROutputRec) + nameLength + 1);
if (!output) if (!output)
return NULL; return NULL;
output->id = FakeClientID(0); output->id = FakeClientID(0);
@ -94,22 +94,6 @@ RROutputCreate(ScreenPtr pScreen,
output->name[nameLength] = '\0'; output->name[nameLength] = '\0';
output->connection = RR_UnknownConnection; output->connection = RR_UnknownConnection;
output->subpixelOrder = SubPixelUnknown; output->subpixelOrder = SubPixelUnknown;
output->mmWidth = 0;
output->mmHeight = 0;
output->crtc = NULL;
output->numCrtcs = 0;
output->crtcs = NULL;
output->numClones = 0;
output->clones = NULL;
output->numModes = 0;
output->numPreferred = 0;
output->modes = NULL;
output->numUserModes = 0;
output->userModes = NULL;
output->properties = NULL;
output->pendingProperties = FALSE;
output->changed = FALSE;
output->nonDesktop = FALSE;
output->devPrivate = devPrivate; output->devPrivate = devPrivate;
if (!AddResource(output->id, RROutputType, (void *) output)) if (!AddResource(output->id, RROutputType, (void *) output))