config: Constify the public interface.

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 <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
master
Richard Cochran 2020-02-09 07:17:08 -08:00
parent b8480ef908
commit 831f7e073b
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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: */