diff options
author | Maria Matejka <mq@ucw.cz> | 2020-05-01 15:34:17 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2020-05-01 15:34:17 +0200 |
commit | 048eb2ddf1ee9587d9fa30cbb3f87d6f650a2133 (patch) | |
tree | fdec4c5679a02c901cf2bc92fd81618c6f12d48e /proto/ospf/ospf.c | |
parent | 17de3a023f7bde293892b41bfafe5740c8553fc8 (diff) | |
parent | 59238768b3b05fa134348d2232b42537d0403994 (diff) |
Merge remote-tracking branch 'origin/mq-static-analysis'
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r-- | proto/ospf/ospf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 29610f4a..c8ed0e06 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -620,7 +620,7 @@ ospf_get_route_info(rte * rte, byte * buf) } static int -ospf_get_attr(eattr * a, byte * buf, int buflen UNUSED) +ospf_get_attr(const eattr * a, byte * buf, int buflen UNUSED) { switch (a->id) { @@ -1244,7 +1244,7 @@ ospf_sh_state(struct proto *P, int verbose, int reachable) uint num = p->gr->hash_entries; struct top_hash_entry *hea[num]; - struct top_hash_entry *hex[verbose ? num : 0]; + struct top_hash_entry **hex = verbose ? alloca(num * sizeof(struct top_hash_entry *)) : NULL; struct top_hash_entry *he; struct top_hash_entry *cnode = NULL; @@ -1289,7 +1289,9 @@ ospf_sh_state(struct proto *P, int verbose, int reachable) lsa_compare_ospf3 = !ospf2; qsort(hea, j1, sizeof(struct top_hash_entry *), lsa_compare_for_state); - qsort(hex, jx, sizeof(struct top_hash_entry *), ext_compare_for_state); + + if (verbose) + qsort(hex, jx, sizeof(struct top_hash_entry *), ext_compare_for_state); /* * This code is a bit tricky, we have a primary LSAs (router and |