The two methods, config_create_interface and config_read, never modify the
strings passed in.  This patch adds the const keyword to ensure these
functions stay that way.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 config.c | 4 ++--
 config.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config.c b/config.c
index 12eb1f9..65afa70 100644
--- a/config.c
+++ b/config.c
@@ -710,7 +710,7 @@ static struct option *config_alloc_longopts(void)
        return opts;
 }
 
-int config_read(char *name, struct config *cfg)
+int config_read(const char *name, struct config *cfg)
 {
        enum config_section current_section = UNKNOWN_SECTION;
        enum parser_result parser_res;
@@ -817,7 +817,7 @@ parse_error:
        return -2;
 }
 
-struct interface *config_create_interface(char *name, struct config *cfg)
+struct interface *config_create_interface(const char *name, struct config *cfg)
 {
        struct interface *iface;
 
diff --git a/config.h b/config.h
index f237fb2..e27d3e2 100644
--- a/config.h
+++ b/config.h
@@ -60,8 +60,8 @@ struct config {
        STAILQ_HEAD(ucmtab_head, unicast_master_table) unicast_master_tables;
 };
 
-int config_read(char *name, struct config *cfg);
-struct interface *config_create_interface(char *name, struct config *cfg);
+int config_read(const char *name, struct config *cfg);
+struct interface *config_create_interface(const char *name, struct config 
*cfg);
 void config_destroy(struct config *cfg);
 
 /* New, hash table based methods: */
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to