summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorPaul Jakma <paul@opensourcerouting.org>2014-09-19 15:35:15 +0100
committerPaul Jakma <paul@quagga.net>2014-09-23 16:33:21 +0100
commit7bef33cbf5027189bd55e4890a07a6bef8277f93 (patch)
tree744283cc2493348e042a278062743d3ecf00abf0 /ospf6d
parentb2dd59ee0e74926278e128846624f5c93288223b (diff)
downloadquagga-7bef33cbf5027189bd55e4890a07a6bef8277f93.tar.bz2
quagga-7bef33cbf5027189bd55e4890a07a6bef8277f93.tar.xz
ospf6_lsdb: trivial, make it clear that showfunc is set before deref.
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_lsdb.c27
-rw-r--r--ospf6d/ospf6_lsdb.h13
2 files changed, 25 insertions, 15 deletions
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 707afc67..b5a4587c 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -485,22 +485,29 @@ ospf6_lsdb_maxage_remover (struct ospf6_lsdb *lsdb)
}
void
-ospf6_lsdb_show (struct vty *vty, int level,
+ospf6_lsdb_show (struct vty *vty, enum ospf_lsdb_show_level level,
u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
struct ospf6_lsdb *lsdb)
{
struct ospf6_lsa *lsa;
void (*showfunc) (struct vty *, struct ospf6_lsa *) = NULL;
- if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
- showfunc = ospf6_lsa_show_summary;
- else if (level == OSPF6_LSDB_SHOW_LEVEL_DETAIL)
- showfunc = ospf6_lsa_show;
- else if (level == OSPF6_LSDB_SHOW_LEVEL_INTERNAL)
- showfunc = ospf6_lsa_show_internal;
- else if (level == OSPF6_LSDB_SHOW_LEVEL_DUMP)
- showfunc = ospf6_lsa_show_dump;
-
+ switch (level)
+ {
+ case OSPF6_LSDB_SHOW_LEVEL_DETAIL:
+ showfunc = ospf6_lsa_show;
+ break;
+ case OSPF6_LSDB_SHOW_LEVEL_INTERNAL:
+ showfunc = ospf6_lsa_show_internal;
+ break;
+ case OSPF6_LSDB_SHOW_LEVEL_DUMP:
+ showfunc = ospf6_lsa_show_dump;
+ break;
+ case OSPF6_LSDB_SHOW_LEVEL_NORMAL:
+ default:
+ showfunc = ospf6_lsa_show_summary;
+ }
+
if (type && id && adv_router)
{
lsa = ospf6_lsdb_lookup (*type, *id, *adv_router, lsdb);
diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h
index a124adbf..425f6153 100644
--- a/ospf6d/ospf6_lsdb.h
+++ b/ospf6d/ospf6_lsdb.h
@@ -66,12 +66,15 @@ extern struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
extern void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
extern void ospf6_lsdb_lsa_unlock (struct ospf6_lsa *lsa);
-#define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0
-#define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1
-#define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2
-#define OSPF6_LSDB_SHOW_LEVEL_DUMP 3
+enum ospf_lsdb_show_level {
+ OSPF6_LSDB_SHOW_LEVEL_NORMAL = 0,
+ OSPF6_LSDB_SHOW_LEVEL_DETAIL,
+ OSPF6_LSDB_SHOW_LEVEL_INTERNAL,
+ OSPF6_LSDB_SHOW_LEVEL_DUMP,
+};
-extern void ospf6_lsdb_show (struct vty *vty, int level, u_int16_t *type,
+extern void ospf6_lsdb_show (struct vty *vty,
+ enum ospf_lsdb_show_level level, u_int16_t *type,
u_int32_t *id, u_int32_t *adv_router,
struct ospf6_lsdb *lsdb);