]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: constify variables if possible 18662/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 18:33:39 +0000 (03:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 18:48:07 +0000 (03:48 +0900)
src/libsystemd-network/sd-ndisc.c
src/libsystemd-network/sd-radv.c
src/network/networkd-ndisc.c
src/systemctl/systemctl-show.c

index d02a2a9279abada758e0c2a9cb7c2ff330808865..f704445654e8bf870423fdb5190d38ee3b96d5cf 100644 (file)
@@ -225,7 +225,7 @@ static int ndisc_recv(sd_event_source *s, int fd, uint32_t revents, void *userda
         if (r < 0) {
                 switch (r) {
                 case -EADDRNOTAVAIL:
-                        (void) in_addr_to_string(AF_INET6, (union in_addr_union*) &rt->address, &addr);
+                        (void) in_addr_to_string(AF_INET6, (const union in_addr_union*) &rt->address, &addr);
                         log_ndisc("Received RA from non-link-local address %s. Ignoring", addr);
                         break;
 
index eac9b159ce0f055512570bf8ab0c755ed7643e53..164b24c6847f40ea49e2bf035fad4b61414a594b 100644 (file)
@@ -244,7 +244,7 @@ static int radv_recv(sd_event_source *s, int fd, uint32_t revents, void *userdat
         if (r < 0) {
                 switch (r) {
                 case -EADDRNOTAVAIL:
-                        (void) in_addr_to_string(AF_INET6, (union in_addr_union*) &src, &addr);
+                        (void) in_addr_to_string(AF_INET6, (const union in_addr_union*) &src, &addr);
                         log_radv("Received RS from non-link-local address %s. Ignoring", addr);
                         break;
 
@@ -272,7 +272,7 @@ static int radv_recv(sd_event_source *s, int fd, uint32_t revents, void *userdat
                 return 0;
         }
 
-        (void) in_addr_to_string(AF_INET6, (union in_addr_union*) &src, &addr);
+        (void) in_addr_to_string(AF_INET6, (const union in_addr_union*) &src, &addr);
 
         r = radv_send(ra, &src, ra->lifetime);
         if (r < 0)
@@ -540,15 +540,15 @@ _public_ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p, int dynamic) {
                 return -ENOEXEC;
 
         (void) in_addr_prefix_to_string(AF_INET6,
-                                        (union in_addr_union*) &p->opt.in6_addr,
+                                        (const union in_addr_union*) &p->opt.in6_addr,
                                         p->opt.prefixlen, &addr_p);
 
         LIST_FOREACH(prefix, cur, ra->prefixes) {
 
                 r = in_addr_prefix_intersect(AF_INET6,
-                                             (union in_addr_union*) &cur->opt.in6_addr,
+                                             (const union in_addr_union*) &cur->opt.in6_addr,
                                              cur->opt.prefixlen,
-                                             (union in_addr_union*) &p->opt.in6_addr,
+                                             (const union in_addr_union*) &p->opt.in6_addr,
                                              p->opt.prefixlen);
                 if (r < 0)
                         return r;
@@ -560,7 +560,7 @@ _public_ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p, int dynamic) {
 
                 _cleanup_free_ char *addr_cur = NULL;
                 (void) in_addr_prefix_to_string(AF_INET6,
-                                                (union in_addr_union*) &cur->opt.in6_addr,
+                                                (const union in_addr_union*) &cur->opt.in6_addr,
                                                 cur->opt.prefixlen, &addr_cur);
                 log_radv("IPv6 prefix %s already configured, ignoring %s",
                          strna(addr_cur), strna(addr_p));
@@ -656,15 +656,15 @@ _public_ int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p, int
                 return -EINVAL;
 
         (void) in_addr_prefix_to_string(AF_INET6,
-                                        (union in_addr_union*) &p->opt.in6_addr,
+                                        (const union in_addr_union*) &p->opt.in6_addr,
                                         p->opt.prefixlen, &pretty);
 
         LIST_FOREACH(prefix, cur, ra->route_prefixes) {
 
                 r = in_addr_prefix_intersect(AF_INET6,
-                                             (union in_addr_union*) &cur->opt.in6_addr,
+                                             (const union in_addr_union*) &cur->opt.in6_addr,
                                              cur->opt.prefixlen,
-                                             (union in_addr_union*) &p->opt.in6_addr,
+                                             (const union in_addr_union*) &p->opt.in6_addr,
                                              p->opt.prefixlen);
                 if (r < 0)
                         return r;
@@ -676,7 +676,7 @@ _public_ int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p, int
 
                 _cleanup_free_ char *addr = NULL;
                 (void) in_addr_prefix_to_string(AF_INET6,
-                                                (union in_addr_union*) &cur->opt.in6_addr,
+                                                (const union in_addr_union*) &cur->opt.in6_addr,
                                                 cur->opt.prefixlen, &addr);
                 log_radv("IPv6 route prefix %s already configured, ignoring %s",
                          strna(addr), strna(pretty));
index d9776940a410714871fac937e3429cf9bc9a2c8b..7af8e620a08678f2e5da76b80512fb0b67783f01 100644 (file)
@@ -150,7 +150,7 @@ static int ndisc_remove_old_one(Link *link, const struct in6_addr *router, bool
                         if (DEBUG_LOGGING) {
                                 _cleanup_free_ char *buf = NULL;
 
-                                (void) in_addr_to_string(AF_INET6, (union in_addr_union *) router, &buf);
+                                (void) in_addr_to_string(AF_INET6, (const union in_addr_union*) router, &buf);
                                 log_link_debug(link, "No SLAAC address obtained from %s is ready. "
                                                "The old NDisc information will be removed later.",
                                                strna(buf));
@@ -162,7 +162,7 @@ static int ndisc_remove_old_one(Link *link, const struct in6_addr *router, bool
         if (DEBUG_LOGGING) {
                 _cleanup_free_ char *buf = NULL;
 
-                (void) in_addr_to_string(AF_INET6, (union in_addr_union *) router, &buf);
+                (void) in_addr_to_string(AF_INET6, (const union in_addr_union*) router, &buf);
                 log_link_debug(link, "Removing old NDisc information obtained from %s.", strna(buf));
         }
 
index 6f3b3566d733f1dcb18be8ae5a8204b62bcff978..6410a4194478dd16fa7462a2c5c64f972fc58dd6 100644 (file)
@@ -1474,7 +1474,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
                                 if (prefixlen > FAMILY_ADDRESS_SIZE(family) * 8)
                                         continue;
 
-                                if (in_addr_prefix_to_string(family, (union in_addr_union *) ap, prefixlen, &str) < 0)
+                                if (in_addr_prefix_to_string(family, (const union in_addr_union*) ap, prefixlen, &str) < 0)
                                         continue;
 
                                 if (!strextend_with_separator(&addresses, " ", str))