diff mbox series

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

Message ID 20231128203504.1194193-1-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series service: Const-qualify 'service' param in '*_nameserver_{add,del}_routes' | expand

Commit Message

Grant Erickson Nov. 28, 2023, 8:35 p.m. UTC
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(-)

Comments

Marcel Holtmann Nov. 29, 2023, 12:56 p.m. UTC | #1
Hi Grant,

> 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
diff mbox series

Patch

diff --git a/src/connman.h b/src/connman.h
index ae04cd9a26c6..4d596f7e6585 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -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);
diff --git a/src/service.c b/src/service.c
index d6a55d043bd1..16b561f48a41 100644
--- a/src/service.c
+++ b/src/service.c
@@ -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;