]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: constify a few parameters in the VRF code
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 18 Jan 2019 18:15:41 +0000 (16:15 -0200)
Parameters should be const whenever possible to improve code
readability and remove the need to cast away the constness of
const arguments.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/vrf.c
lib/vrf.h

index 0c82f6a3cd451a4dda81f4605f62ef544ef47d7a..e1f27b7e72769e82b274d328b01dfd25ecb32a8f 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -572,7 +572,7 @@ static int vrf_default_accepts_vrf(int type)
 
 /* Create a socket for the VRF. */
 int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
-              char *interfacename)
+              const char *interfacename)
 {
        int ret, save_errno, ret2;
 
@@ -947,7 +947,7 @@ vrf_id_t vrf_get_default_id(void)
                return VRF_DEFAULT_INTERNAL;
 }
 
-int vrf_bind(vrf_id_t vrf_id, int fd, char *name)
+int vrf_bind(vrf_id_t vrf_id, int fd, const char *name)
 {
        int ret = 0;
 
@@ -1006,7 +1006,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params)
 }
 
 int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id,
-                        char *interfacename)
+                        const char *interfacename)
 {
        int ret, save_errno, ret2;
 
index fe4fc77250cc7ac6bd027fe3be51afe421482a69..eacbaf542baedfb86d3ac4572f463d2cbd76577f 100644 (file)
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -215,12 +215,12 @@ extern void vrf_terminate(void);
 
 /* Create a socket serving for the given VRF */
 extern int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
-                     char *name);
+                     const char *name);
 
 extern int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id,
-                               char *name);
+                               const char *name);
 
-extern int vrf_bind(vrf_id_t vrf_id, int fd, char *name);
+extern int vrf_bind(vrf_id_t vrf_id, int fd, const char *name);
 
 /* VRF ioctl operations */
 extern int vrf_getaddrinfo(const char *node, const char *service,