fr_dict_attr_t *n;
fr_dict_attr_t const *old;
fr_dict_attr_flags_t our_flags = *flags;
+ bool self_allocated = false;
if (unlikely(dict->read_only)) {
fr_strerror_printf("%s dictionary has been marked as read only", fr_dict_root(dict)->name);
return -1;
}
+ self_allocated = (attr < 0);
+
/*
* Check that the definition is valid.
*/
*/
if ((old->parent == parent) && (old->type == type) &&
FLAGS_EQUAL(array) && FLAGS_EQUAL(subtype) &&
- ((old->attr == (unsigned int) attr) || ((attr < 0) && old->flags.internal))) {
+ ((old->attr == (unsigned int) attr) || self_allocated)) {
return 0;
}