[PATCH v2 06/14] OdevAttribute: config_odev_add_attribute: replace existing values
Peter Hutterer
peter.hutterer at who-t.net
Tue Feb 11 06:55:19 CET 2014
On Tue, Feb 04, 2014 at 12:49:12PM +0100, Hans de Goede wrote:
> If an attribute already exists replace its value rather then adding a
typo: "than" :)
> duplicate attribute with the new value to the list.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> config/config.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/config/config.c b/config/config.c
> index 64dfb88..aaef746 100644
> --- a/config/config.c
> +++ b/config/config.c
> @@ -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);
looks like a future xnfstrdup candidate()
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Cheers,
Peter
> xorg_list_append(&oa->member, &attribs->list);
> return TRUE;
> --
> 1.8.5.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list