+ return CONST_CAST (struct attribute *, attr);
+}
+
+/* Adds ATTR to SET. Succeeds and returns true if SET does not already contain
+ an attribute with the same name (matched case insensitively); otherwise
+ fails and returns false. On success only, ownership of ATTR is transferred
+ to SET. */
+bool
+attrset_try_add (struct attrset *set, struct attribute *attr)
+{
+ const char *name = attribute_get_name (attr);
+ if (attrset_lookup (set, name))
+ return false;
+ hmap_insert (&set->map, &attr->node, utf8_hash_case_string (name, 0));
+ return true;