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 <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 19:25:46 +02:00 committed by Marge Bot
parent 3d3137513a
commit 05188ccec1

View File

@ -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;