Add const modifier to variable

This commit is contained in:
Ervin Hegedus 2025-08-12 21:36:52 +02:00
parent 8b3269f4d1
commit 62cb73f31d
No known key found for this signature in database
GPG Key ID: 5FA5BC3F5EC41F61

View File

@ -228,7 +228,7 @@ bool Rbl::evaluate(Transaction *t, RuleWithActions *rule,
// SonarCloud suggested to use the init-statement to declare "addr" inside the if statement. // SonarCloud suggested to use the init-statement to declare "addr" inside the if statement.
// I think that's not good here, because we need that in the else block // I think that's not good here, because we need that in the else block
struct sockaddr *addr = info->ai_addr; // NOSONAR const struct sockaddr *addr = info->ai_addr; // NOSONAR
if (addr->sa_family == AF_INET) { // NOSONAR if (addr->sa_family == AF_INET) { // NOSONAR
struct sockaddr_in sin{}; // initialize an empty struct; we don't need port info struct sockaddr_in sin{}; // initialize an empty struct; we don't need port info
memcpy(&sin.sin_addr, addr->sa_data + 2, sizeof(sin.sin_addr)); memcpy(&sin.sin_addr, addr->sa_data + 2, sizeof(sin.sin_addr));