diff --git a/include/config.h b/include/config.h index fb2b67dd..a5645ea1 100644 --- a/include/config.h +++ b/include/config.h @@ -13,6 +13,6 @@ struct xdpw_config { void print_config(enum LOGLEVEL loglevel, struct xdpw_config *config); void finish_config(struct xdpw_config *config); -void init_config(const char **configfile, struct xdpw_config *config); +void init_config(const char ** const configfile, struct xdpw_config *config); #endif diff --git a/src/core/config.c b/src/core/config.c index 46f69028..0d701406 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -76,7 +76,7 @@ static void config_parse_file(const char *configfile, struct xdpw_config *config print_config(DEBUG, config); } -static char *get_config_path(void) { +static const char *get_config_path(void) { const char *home = getenv("HOME"); size_t size_fallback = 1 + strlen(home) + strlen("/.config"); char *config_home_fallback = calloc(size_fallback, sizeof(char)); @@ -109,7 +109,7 @@ static char *get_config_path(void) { return NULL; } -void init_config(const char **configfile, struct xdpw_config *config) { +void init_config(const char ** const configfile, struct xdpw_config *config) { if (*configfile == NULL) { *configfile = get_config_path(); } diff --git a/src/core/main.c b/src/core/main.c index 6d3b368e..3028516e 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -42,7 +42,7 @@ static int handle_name_lost(sd_bus_message *m, void *userdata, sd_bus_error *ret int main(int argc, char *argv[]) { struct xdpw_config config = {0}; - const char *configfile = NULL; + char *configfile = NULL; enum LOGLEVEL loglevel = DEFAULT_LOGLEVEL; bool replace = false; @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { } init_logger(stderr, loglevel); - init_config(&configfile, &config); + init_config((const char ** const)&configfile, &config); int ret = 0; @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) { // TODO: cleanup finish_config(&config); - free((char *)configfile); + free(configfile); return EXIT_SUCCESS;