diff mbox series

network: Const-qualify network leaf getter functions.

Message ID 20231128193348.1186889-1-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series network: Const-qualify network leaf getter functions. | expand

Commit Message

Grant Erickson Nov. 28, 2023, 7:33 p.m. UTC
Const-qualify the network arguments in network leaf getter and
introspection functions to make it clear to the compiler, static
analyzers, and human readers that the function is strictly a getter or
introspection function with no network mutation side effects.
---
 include/network.h | 4 ++--
 src/connman.h     | 2 +-
 src/network.c     | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

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

> Const-qualify the network arguments in network leaf getter and
> introspection functions to make it clear to the compiler, static
> analyzers, and human readers that the function is strictly a getter or
> introspection function with no network mutation side effects.
> ---
> include/network.h | 4 ++--
> src/connman.h     | 2 +-
> src/network.c     | 6 +++---
> 3 files changed, 6 insertions(+), 6 deletions(-)

patch has been applied.

Regards

Marcel
diff mbox series

Patch

diff --git a/include/network.h b/include/network.h
index f1a158afce8e..2078509e75bf 100644
--- a/include/network.h
+++ b/include/network.h
@@ -81,8 +81,8 @@  connman_network_ref_debug(struct connman_network *network,
 void connman_network_unref_debug(struct connman_network *network,
 			const char *file, int line, const char *caller);
 
-enum connman_network_type connman_network_get_type(struct connman_network *network);
-const char *connman_network_get_identifier(struct connman_network *network);
+enum connman_network_type connman_network_get_type(const struct connman_network *network);
+const char *connman_network_get_identifier(const struct connman_network *network);
 
 void connman_network_set_index(struct connman_network *network, int index);
 int connman_network_get_index(const struct connman_network *network);
diff --git a/src/connman.h b/src/connman.h
index ae04cd9a26c6..8b900ff185f8 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -623,7 +623,7 @@  int __connman_network_clear_ipconfig(struct connman_network *network,
 int __connman_network_enable_ipconfig(struct connman_network *network,
 				struct connman_ipconfig *ipconfig);
 
-const char *__connman_network_get_type(struct connman_network *network);
+const char *__connman_network_get_type(const struct connman_network *network);
 const char *__connman_network_get_group(struct connman_network *network);
 const char *__connman_network_get_ident(struct connman_network *network);
 bool __connman_network_get_weakness(struct connman_network *network);
diff --git a/src/network.c b/src/network.c
index e5fadd9cea36..3f844f76120d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1333,7 +1333,7 @@  void connman_network_unref_debug(struct connman_network *network,
 	network_destruct(network);
 }
 
-const char *__connman_network_get_type(struct connman_network *network)
+const char *__connman_network_get_type(const struct connman_network *network)
 {
 	return type2string(network->type);
 }
@@ -1345,7 +1345,7 @@  const char *__connman_network_get_type(struct connman_network *network)
  * Get type of network
  */
 enum connman_network_type connman_network_get_type(
-				struct connman_network *network)
+				const struct connman_network *network)
 {
 	return network->type;
 }
@@ -1356,7 +1356,7 @@  enum connman_network_type connman_network_get_type(
  *
  * Get identifier of network
  */
-const char *connman_network_get_identifier(struct connman_network *network)
+const char *connman_network_get_identifier(const struct connman_network *network)
 {
 	return network->identifier;
 }