mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-17 08:38:42 +00:00
Define EAF_ORIGINATED and propagate it properly when merging attribute lists.
This commit is contained in:
parent
4b03f64b34
commit
51a183af78
@ -298,6 +298,7 @@ typedef struct eattr {
|
|||||||
#define EAF_TYPE_UNDEF 0x0f /* `force undefined' entry */
|
#define EAF_TYPE_UNDEF 0x0f /* `force undefined' entry */
|
||||||
#define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */
|
#define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */
|
||||||
#define EAF_VAR_LENGTH 0x02 /* Attribute length is variable (part of type spec) */
|
#define EAF_VAR_LENGTH 0x02 /* Attribute length is variable (part of type spec) */
|
||||||
|
#define EAF_ORIGINATED 0x40 /* The attribute has originated locally */
|
||||||
#define EAF_TEMP 0x80 /* A temporary attribute (the one stored in the tmp attr list) */
|
#define EAF_TEMP 0x80 /* A temporary attribute (the one stored in the tmp attr list) */
|
||||||
|
|
||||||
struct adata {
|
struct adata {
|
||||||
|
@ -117,7 +117,7 @@ ea_do_sort(ea_list *e)
|
|||||||
static inline void
|
static inline void
|
||||||
ea_do_prune(ea_list *e)
|
ea_do_prune(ea_list *e)
|
||||||
{
|
{
|
||||||
eattr *s, *d, *l;
|
eattr *s, *d, *l, *s0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/* Discard duplicates and undefs. Do you remember sorting was stable? */
|
/* Discard duplicates and undefs. Do you remember sorting was stable? */
|
||||||
@ -125,14 +125,17 @@ ea_do_prune(ea_list *e)
|
|||||||
l = e->attrs + e->count;
|
l = e->attrs + e->count;
|
||||||
while (s < l)
|
while (s < l)
|
||||||
{
|
{
|
||||||
if ((s->type & EAF_TYPE_MASK) != EAF_TYPE_UNDEF)
|
s0 = s++;
|
||||||
{
|
|
||||||
*d++ = *s;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
s++;
|
|
||||||
while (s < l && s->id == s[-1].id)
|
while (s < l && s->id == s[-1].id)
|
||||||
s++;
|
s++;
|
||||||
|
/* s0 is the most recent version, s[-1] the oldest one */
|
||||||
|
if ((s0->type & EAF_TYPE_MASK) != EAF_TYPE_UNDEF)
|
||||||
|
{
|
||||||
|
*d = *s0;
|
||||||
|
d->type = (d->type & ~EAF_ORIGINATED) | (s[-1].type & EAF_ORIGINATED);
|
||||||
|
d++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e->count = i;
|
e->count = i;
|
||||||
}
|
}
|
||||||
@ -320,6 +323,8 @@ ea_dump(ea_list *e)
|
|||||||
if (a->type & EAF_TEMP)
|
if (a->type & EAF_TEMP)
|
||||||
debug("T");
|
debug("T");
|
||||||
debug("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
|
debug("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
|
||||||
|
if (a->type & EAF_ORIGINATED)
|
||||||
|
debug("o");
|
||||||
if (a->type & EAF_EMBEDDED)
|
if (a->type & EAF_EMBEDDED)
|
||||||
debug(":%08x", a->u.data);
|
debug(":%08x", a->u.data);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user