diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-04-07 10:19:09 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-07 10:19:09 +0300 |
| commit | 0633fb7856e75f5631d25386eb240b49d1f5cb0d (patch) | |
| tree | 87e33643719330e84f867da800896ee4ebc7ac3e /lib | |
| parent | 9261fbdc6ebc4245a62d250b0a5588ee70db52b2 (diff) | |
| parent | b589466918337c11021fd4085aacf0d7e963a9a4 (diff) | |
Merge pull request #13162 from donaldsharp/pass_by_value_no_no_no
*: Use a `struct prefix *p` instead of a `struct prefix` in functions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/link_state.c | 13 | ||||
| -rw-r--r-- | lib/link_state.h | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/link_state.c b/lib/link_state.c index 589c0ae704..0aba021b1a 100644 --- a/lib/link_state.c +++ b/lib/link_state.c @@ -333,7 +333,7 @@ int ls_attributes_same(struct ls_attributes *l1, struct ls_attributes *l2) /** * Link State prefix management functions */ -struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix p) +struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix *p) { struct ls_prefix *new; @@ -342,7 +342,7 @@ struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix p) new = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_prefix)); new->adv = adv; - new->pref = p; + new->pref = *p; return new; } @@ -889,7 +889,7 @@ struct ls_subnet *ls_subnet_update(struct ls_ted *ted, struct ls_prefix *pref) if (pref == NULL) return NULL; - old = ls_find_subnet(ted, pref->pref); + old = ls_find_subnet(ted, &pref->pref); if (old) { if (!ls_prefix_same(old->ls_pref, pref)) { ls_prefix_del(old->ls_pref); @@ -942,11 +942,12 @@ void ls_subnet_del_all(struct ls_ted *ted, struct ls_subnet *subnet) ls_subnet_del(ted, subnet); } -struct ls_subnet *ls_find_subnet(struct ls_ted *ted, const struct prefix prefix) +struct ls_subnet *ls_find_subnet(struct ls_ted *ted, + const struct prefix *prefix) { struct ls_subnet subnet = {}; - subnet.key = prefix; + subnet.key = *prefix; return subnets_find(&ted->subnets, &subnet); } @@ -1846,7 +1847,7 @@ struct ls_subnet *ls_msg2subnet(struct ls_ted *ted, struct ls_message *msg, subnet->status = UPDATE; break; case LS_MSG_EVENT_DELETE: - subnet = ls_find_subnet(ted, pref->pref); + subnet = ls_find_subnet(ted, &pref->pref); if (subnet) { if (delete) ls_subnet_del_all(ted, subnet); diff --git a/lib/link_state.h b/lib/link_state.h index e6a6388ba4..b75f035431 100644 --- a/lib/link_state.h +++ b/lib/link_state.h @@ -314,7 +314,7 @@ extern int ls_attributes_same(struct ls_attributes *a1, * * @return New Link State Prefix */ -extern struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix p); +extern struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix *p); /** * Remove Link State Prefix. Data Structure is freed. @@ -709,7 +709,7 @@ extern void ls_subnet_del_all(struct ls_ted *ted, struct ls_subnet *subnet); * @return Subnet if found, NULL otherwise */ extern struct ls_subnet *ls_find_subnet(struct ls_ted *ted, - const struct prefix prefix); + const struct prefix *prefix); /** * Create a new Link State Data Base. |
