1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

network/ndisc: constify several arguments and add several assertions

Follow-up for 0f8afaf94d.

No functional change, just for safety.
This commit is contained in:
Yu Watanabe 2024-11-21 01:21:28 +09:00
parent b5f2d7a1ec
commit 1168489cd4

View File

@ -215,7 +215,7 @@ static int ndisc_remove_unused_nexthops(Link *link) {
#define NDISC_NEXTHOP_APP_ID SD_ID128_MAKE(76,d2,0f,1f,76,1e,44,d1,97,3a,52,5c,05,68,b5,0d)
static uint32_t ndisc_generate_nexthop_id(NextHop *nexthop, Link *link, sd_id128_t app_id, uint64_t trial) {
static uint32_t ndisc_generate_nexthop_id(const NextHop *nexthop, Link *link, sd_id128_t app_id, uint64_t trial) {
assert(nexthop);
assert(link);
@ -232,7 +232,7 @@ static uint32_t ndisc_generate_nexthop_id(NextHop *nexthop, Link *link, sd_id128
return (uint32_t) ((result & 0xffffffff) ^ (result >> 32));
}
static bool ndisc_nexthop_equal(NextHop *a, NextHop *b) {
static bool ndisc_nexthop_equal(const NextHop *a, const NextHop *b) {
assert(a);
assert(b);
@ -250,9 +250,11 @@ static bool ndisc_nexthop_equal(NextHop *a, NextHop *b) {
return true;
}
static bool ndisc_take_nexthop_id(NextHop *nexthop, NextHop *existing, Manager *manager) {
static bool ndisc_take_nexthop_id(NextHop *nexthop, const NextHop *existing, Manager *manager) {
assert(nexthop);
assert(nexthop->id == 0);
assert(existing);
assert(existing->id > 0);
assert(manager);
if (!ndisc_nexthop_equal(nexthop, existing))
@ -300,7 +302,7 @@ static int ndisc_nexthop_find_id(NextHop *nexthop, Link *link) {
return false;
}
static int ndisc_nexthop_new(Route *route, Link *link, NextHop **ret) {
static int ndisc_nexthop_new(const Route *route, Link *link, NextHop **ret) {
_cleanup_(nexthop_unrefp) NextHop *nexthop = NULL;
int r;