various: do not use assert_se as a workaround in non-test code

This partially reverts 5332be60d3. I expect that
there is no practical difference, but it seems philosophically wrong to use
assert_se(), i.e. for the generation of the code in non-debug builds, just to
suppress a warning. We have _unused_ for that, use it.

I verified that we don't get warnings with clang and -DNDEBUG=1 with this patch.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-04-29 21:59:32 +09:00
committed by Yu Watanabe
parent bd4ab24f49
commit 7dcbb48e46
3 changed files with 12 additions and 10 deletions
@@ -48,10 +48,10 @@ int ndisc_router_solicit_parse(sd_radv *ra, sd_ndisc_router_solicit *rs) {
return log_radv_errno(ra, SYNTHETIC_ERRNO(EBADMSG),
"Too small to be a router solicit, ignoring.");
const struct nd_router_solicit *a = (const struct nd_router_solicit*) rs->packet->raw_packet;
assert_se(a);
assert_se(a->nd_rs_type == ND_ROUTER_SOLICIT);
assert_se(a->nd_rs_code == 0);
_unused_ const struct nd_router_solicit *a = (const struct nd_router_solicit*) rs->packet->raw_packet;
assert(a);
assert(a->nd_rs_type == ND_ROUTER_SOLICIT);
assert(a->nd_rs_code == 0);
r = ndisc_parse_options(rs->packet, &rs->options);
if (r < 0)