diff options
author | Maria Matejka <mq@ucw.cz> | 2019-08-17 10:20:46 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2020-05-01 15:19:12 +0200 |
commit | 0fa8bf91cd474e393ded85b329fde30ba35f6a26 (patch) | |
tree | 6c1c2865a04c3e08eaae55618f333b74edf7be36 /nest | |
parent | bbe49ae569534d0cf7ff226d19e729dcc764e606 (diff) |
Nest: Several assumptions to tame the static analyzer
Diffstat (limited to 'nest')
-rw-r--r-- | nest/rt-attr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 8620d321..3f83edce 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -202,7 +202,7 @@ nexthop__same(struct nexthop *x, struct nexthop *y) } static int -nexthop_compare_node(const struct nexthop *x, const struct nexthop *y) +nexthop_compare_node(const struct nexthop *x, const struct nexthop *y) { int r; @@ -278,18 +278,22 @@ nexthop_merge(struct nexthop *x, struct nexthop *y, int rx, int ry, int max, lin while ((x || y) && max--) { int cmp = nexthop_compare_node(x, y); + if (cmp < 0) { + ASSUME(x); *n = rx ? x : nexthop_copy_node(x, lp); x = x->next; } else if (cmp > 0) { + ASSUME(y); *n = ry ? y : nexthop_copy_node(y, lp); y = y->next; } else { + ASSUME(x && y); *n = rx ? x : (ry ? y : nexthop_copy_node(x, lp)); x = x->next; y = y->next; |