ospf6_lsdb: trivial, make it clear that showfunc is set before deref.

(cherry picked from commit 7bef33cbf5027189bd55e4890a07a6bef8277f93)
This commit is contained in:
Paul Jakma 2014-09-19 15:35:15 +01:00 committed by Daniel Walton
parent 46f4a4d21f
commit f58c5fbdc3
2 changed files with 25 additions and 15 deletions

View File

@ -487,21 +487,28 @@ ospf6_lsdb_maxage_remover (struct ospf6_lsdb *lsdb)
} }
void 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, u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
struct ospf6_lsdb *lsdb) struct ospf6_lsdb *lsdb)
{ {
struct ospf6_lsa *lsa; struct ospf6_lsa *lsa;
void (*showfunc) (struct vty *, struct ospf6_lsa *) = NULL; void (*showfunc) (struct vty *, struct ospf6_lsa *) = NULL;
if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL) switch (level)
showfunc = ospf6_lsa_show_summary; {
else if (level == OSPF6_LSDB_SHOW_LEVEL_DETAIL) case OSPF6_LSDB_SHOW_LEVEL_DETAIL:
showfunc = ospf6_lsa_show; showfunc = ospf6_lsa_show;
else if (level == OSPF6_LSDB_SHOW_LEVEL_INTERNAL) break;
case OSPF6_LSDB_SHOW_LEVEL_INTERNAL:
showfunc = ospf6_lsa_show_internal; showfunc = ospf6_lsa_show_internal;
else if (level == OSPF6_LSDB_SHOW_LEVEL_DUMP) break;
case OSPF6_LSDB_SHOW_LEVEL_DUMP:
showfunc = ospf6_lsa_show_dump; showfunc = ospf6_lsa_show_dump;
break;
case OSPF6_LSDB_SHOW_LEVEL_NORMAL:
default:
showfunc = ospf6_lsa_show_summary;
}
if (type && id && adv_router) if (type && id && adv_router)
{ {

View File

@ -67,12 +67,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_remove_all (struct ospf6_lsdb *lsdb);
extern void ospf6_lsdb_lsa_unlock (struct ospf6_lsa *lsa); extern void ospf6_lsdb_lsa_unlock (struct ospf6_lsa *lsa);
#define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0 enum ospf_lsdb_show_level {
#define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1 OSPF6_LSDB_SHOW_LEVEL_NORMAL = 0,
#define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2 OSPF6_LSDB_SHOW_LEVEL_DETAIL,
#define OSPF6_LSDB_SHOW_LEVEL_DUMP 3 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, u_int32_t *id, u_int32_t *adv_router,
struct ospf6_lsdb *lsdb); struct ospf6_lsdb *lsdb);