/* SPDX-License-Identifier: MIT OR X11 * * Copyright © 2024 Enrico Weigelt, metux IT consult */ #include #include "dix/property_priv.h" #include "include/privates.h" #include "include/propertyst.h" void dixPropertyFree(PropertyPtr pr) { if (pr) { free(pr->data); dixFreeObjectWithPrivates(pr, PRIVATE_PROPERTY); } } PropertyPtr dixPropertyCreate(Atom type, Atom name, int format, size_t len, const void *value) { const int totalSize = (format >> 3) * len; void *data = calloc(1, totalSize); if (!data) return NULL; PropertyPtr pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY); if (!pProp) { free(data); return NULL; } memcpy(data, value, totalSize); pProp->data = data; pProp->propertyName = name; pProp->format = format; pProp->size = len; pProp->type = type; return pProp; }