]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libsystemd-network: constify casts
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 8 May 2022 10:39:15 +0000 (12:39 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 8 May 2022 20:47:50 +0000 (22:47 +0200)
It is better to not drop the const-ness from the argument.

src/libsystemd-network/dhcp-option.c

index efb676e60b3d879939035111831f2124e469c1d4..7f49da7c2d7189c826756a7e3d5066256d9f3e5b 100644 (file)
@@ -62,7 +62,7 @@ static int option_append(uint8_t options[], size_t size, size_t *offset,
                 if (strv_isempty((char **) optval))
                         return -EINVAL;
 
-                STRV_FOREACH(s, (char **) optval) {
+                STRV_FOREACH(s, (const char* const*) optval) {
                         size_t len = strlen(*s);
 
                         if (len > 255 || len == 0)
@@ -78,7 +78,7 @@ static int option_append(uint8_t options[], size_t size, size_t *offset,
                 options[*offset + 1] = total;
                 *offset += 2;
 
-                STRV_FOREACH(s, (char **) optval) {
+                STRV_FOREACH(s, (const char* const*) optval) {
                         size_t len = strlen(*s);
 
                         options[*offset] = len;