Skip to contentSkip to conversation

service: Const-qualify 'service' param in '*_nameserver_{add,del}_routes'

PATCH In review Grant Erickson 2 participants 2 messages Nov 28, 2023 – Nov 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 service: Const-qualify 'service' param in '*_nameserver_{add,del}_routes'

Const-qualify the network service arguments of '__connman_service_nameserver_{add,del}_routes' to make it clear to the compiler, static analyzers, and human readers that the functions have no network service mutation side effects.

---
 src/connman.h | 4 ++--
 src/service.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
src/connman.h +2 -2
index ae04cd9a26c6..4d596f7e6585 100644
@@ -779,9 +779,9 @@ int __connman_service_nameserver_append(struct connman_service *service,
 int __connman_service_nameserver_remove(struct connman_service *service,
 				const char *nameserver, bool is_auto);
 void __connman_service_nameserver_clear(struct connman_service *service);
-void __connman_service_nameserver_add_routes(struct connman_service *service,
+void __connman_service_nameserver_add_routes(const struct connman_service *service,
 						const char *gw);
-void __connman_service_nameserver_del_routes(struct connman_service *service,
+void __connman_service_nameserver_del_routes(const struct connman_service *service,
 					enum connman_ipconfig_type type);
 void __connman_service_set_timeservers(struct connman_service *service,
 						char **timeservers);
src/service.c +2 -2
index d6a55d043bd1..16b561f48a41 100644
@@ -1410,7 +1410,7 @@ static void nameserver_del_routes(int index, char **nameservers,
 	}
 }
 
-void __connman_service_nameserver_add_routes(struct connman_service *service,
+void __connman_service_nameserver_add_routes(const struct connman_service *service,
 						const char *gw)
 {
 	int index;
@@ -1438,7 +1438,7 @@ void __connman_service_nameserver_add_routes(struct connman_service *service,
 	}
 }
 
-void __connman_service_nameserver_del_routes(struct connman_service *service,
+void __connman_service_nameserver_del_routes(const struct connman_service *service,
 					enum connman_ipconfig_type type)
 {
 	int index;
Signature · 1 line
2.42.0
#1 lore raw

Hi Grant,

Quoted 8 lines

Const-qualify the network service arguments of '__connman_service_nameserver_{add,del}_routes' to make it clear to the compiler, static analyzers, and human readers that the functions have no network service mutation side effects.
---
src/connman.h | 4 ++--
src/service.c | 4 ++--

2 files changed, 4 insertions(+), 4 deletions(-)

patch has been applied.

Regards

Marcel