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:
parent
10c64e8056
commit
350559dcdc
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user