diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-08-21 02:41:37 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-08-21 02:41:37 +0200 |
commit | 5b3d4186defcf9faa15fce45703ee8c5a80f74db (patch) | |
tree | 9d5bbdd64223747a6cb6b28ecc9259a605643528 /ospfd/ospf_ext.c | |
parent | Merge pull request #2874 from opensourcerouting/fix-doc-bfdd-index (diff) | |
download | frr-5b3d4186defcf9faa15fce45703ee8c5a80f74db.tar.xz frr-5b3d4186defcf9faa15fce45703ee8c5a80f74db.zip |
ospfd: Add ospf_lsa_new_and_data function and abstract away
In all but one instance we were following this pattern
with ospf_lsa_new:
ospf_lsa_new()
ospf_lsa_data_new()
so let's create a ospf_lsa_new_and_data to abstract
this bit of fun and cleanup all the places where
it assumes these function calls can fail.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_ext.c')
-rw-r--r-- | ospfd/ospf_ext.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index b8d14c351..f6ed9b81b 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -977,20 +977,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_new(struct ospf_area *area, lsah->length = htons(length); /* Now, create an OSPF LSA instance. */ - new = ospf_lsa_new(); - if (new == NULL) { - zlog_warn("EXT (%s): ospf_lsa_new() error", __func__); - stream_free(s); - return NULL; - } - new->data = ospf_lsa_data_new(length); - if (new->data == NULL) { - zlog_warn("EXT (%s): ospf_lsa_data_new() error", __func__); - ospf_lsa_unlock(&new); - new = NULL; - stream_free(s); - return NULL; - } + new = ospf_lsa_new_and_data(length); /* Segment Routing belongs only to default VRF */ new->vrf_id = VRF_DEFAULT; @@ -1056,20 +1043,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_new(struct ospf_area *area, lsah->length = htons(length); /* Now, create an OSPF LSA instance. */ - new = ospf_lsa_new(); - if (new == NULL) { - zlog_warn("EXT (%s): ospf_lsa_new() error", __func__); - stream_free(s); - return NULL; - } - new->data = ospf_lsa_data_new(length); - if (new->data == NULL) { - zlog_warn("EXT (%s): ospf_lsa_data_new() error", __func__); - ospf_lsa_unlock(&new); - new = NULL; - stream_free(s); - return NULL; - } + new = ospf_lsa_new_and_data(length); /* Segment Routing belongs only to default VRF */ new->vrf_id = VRF_DEFAULT; |