diff mbox series

service: Const-qualify 'connman_service_get_interface'.

Message ID 20231117211929.705335-1-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series service: Const-qualify 'connman_service_get_interface'. | expand

Commit Message

Grant Erickson Nov. 17, 2023, 9:19 p.m. UTC
Const-qualify the network service argument to make it clear to the
compiler, static analyzers, and human readers that the function is
strictly a getter with no network service mutation side effects.
---
 include/service.h     | 2 +-
 src/service.c         | 2 +-
 tools/iptables-unit.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Marcel Holtmann Nov. 23, 2023, 11:23 a.m. UTC | #1
Hi Grant,

> Const-qualify the network service argument to make it clear to the
> compiler, static analyzers, and human readers that the function is
> strictly a getter with no network service mutation side effects.
> ---
> include/service.h     | 2 +-
> src/service.c         | 2 +-
> tools/iptables-unit.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)

patch has been applied.

Regards

Marcel
diff mbox series

Patch

diff --git a/include/service.h b/include/service.h
index e45d7b58da7d..69f93574bafb 100644
--- a/include/service.h
+++ b/include/service.h
@@ -116,7 +116,7 @@  void connman_service_unref_debug(struct connman_service *service,
 
 enum connman_service_type connman_service_get_type(const struct connman_service *service);
 enum connman_service_state connman_service_get_state(const struct connman_service *service);
-char *connman_service_get_interface(struct connman_service *service);
+char *connman_service_get_interface(const struct connman_service *service);
 
 const char *connman_service_get_identifier(const struct connman_service *service);
 const char *connman_service_get_domainname(const struct connman_service *service);
diff --git a/src/service.c b/src/service.c
index 81a1bebdc14b..a94d14652eb2 100644
--- a/src/service.c
+++ b/src/service.c
@@ -6196,7 +6196,7 @@  enum connman_service_type connman_service_get_type(const struct connman_service
  *
  * Get network interface of service
  */
-char *connman_service_get_interface(struct connman_service *service)
+char *connman_service_get_interface(const struct connman_service *service)
 {
 	int index;
 
diff --git a/tools/iptables-unit.c b/tools/iptables-unit.c
index b91591f23e7f..d490b87d80ca 100644
--- a/tools/iptables-unit.c
+++ b/tools/iptables-unit.c
@@ -624,7 +624,7 @@  struct connman_service {
 	char *dummy;
 };
 
-char *connman_service_get_interface(struct connman_service *service)
+char *connman_service_get_interface(const struct connman_service *service)
 {
 	return "eth0";
 }