mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
OdevAttribute: config_odev_add_attribute: replace existing values
If an attribute already exists replace its value rather than adding a duplicate attribute with the new value to the list. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -163,11 +163,14 @@ config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
|
||||
{
|
||||
struct OdevAttribute *oa;
|
||||
|
||||
oa = malloc(sizeof(struct OdevAttribute));
|
||||
oa = config_odev_find_attribute(attribs, attrib);
|
||||
if (!oa)
|
||||
oa = calloc(1, sizeof(struct OdevAttribute));
|
||||
if (!oa)
|
||||
return FALSE;
|
||||
|
||||
oa->attrib_id = attrib;
|
||||
free(oa->attrib_name);
|
||||
oa->attrib_name = strdup(attrib_name);
|
||||
xorg_list_append(&oa->member, &attribs->list);
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user