- struct udev_list *list_loop;
- struct udev_list *list_new;
-
- /* avoid duplicate entries */
- list_for_each_entry(list_loop, list) {
- if (strcmp(list_loop->name, name) == 0) {
- dbg(udev, "'%s' is already in the list\n", name);
- return list_loop;
+ list_node_remove(&entry->node);
+ entry->list = NULL;
+}
+
+struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list,
+ const char *name, const char *value,
+ int unique, int sort)
+{
+ struct udev_list_entry *entry_loop = NULL;
+ struct udev_list_entry *entry_new;
+
+ if (unique)
+ udev_list_entry_foreach(entry_loop, list_get_entry(list)) {
+ if (strcmp(entry_loop->name, name) == 0) {
+ info(udev, "'%s' is already in the list\n", name);
+ if (value != NULL) {
+ free(entry_loop->value);
+ entry_loop->value = strdup(value);
+ if (entry_loop->value == NULL)
+ return NULL;
+ info(udev, "'%s' value replaced with '%s'\n", name, value);
+ }
+ return entry_loop;
+ }