From 05188ccec1cad52ebe78f67bebcbe85a7a1e27d5 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 29 Jul 2024 19:25:46 +0200 Subject: [PATCH] randr: RRCreateProviderProperty(): 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 Part-of: --- randr/rrproviderproperty.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index 27444ea8a..45e9a63e6 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -107,16 +107,10 @@ RRCreateProviderProperty(Atom property) { RRPropertyPtr prop; - prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); + prop = (RRPropertyPtr) calloc(1, sizeof(RRPropertyRec)); if (!prop) return NULL; - prop->next = NULL; prop->propertyName = property; - prop->is_pending = FALSE; - prop->range = FALSE; - prop->immutable = FALSE; - prop->num_valid = 0; - prop->valid_values = NULL; RRInitProviderPropertyValue(&prop->current); RRInitProviderPropertyValue(&prop->pending); return prop;