From b4b4c28214545524d90efed5ebb24054cec78e4e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 19 Feb 2024 11:55:07 +0100 Subject: default environment: make string arguments const Change default_environment_path_set() to take a const char * and let default_environment_path_get() return a const char *. Also, do not keep a copy of the string passed to default_environment_path_set() rather than the original string to make it more clear where the path is allocated. This allows us to free the string passed to default_environment_path_set() after usage by some callers. Link: https://lore.barebox.org/20240219105507.1618465-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer --- include/envfs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/envfs.h b/include/envfs.h index abe0ffb963..767b34c943 100644 --- a/include/envfs.h +++ b/include/envfs.h @@ -105,14 +105,14 @@ int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags); /* defaults to /dev/env0 */ #ifdef CONFIG_ENV_HANDLING -void default_environment_path_set(char *path); -char *default_environment_path_get(void); +void default_environment_path_set(const char *path); +const char *default_environment_path_get(void); #else -static inline void default_environment_path_set(char *path) +static inline void default_environment_path_set(const char *path) { } -static inline char *default_environment_path_get(void) +static inline const char *default_environment_path_get(void) { return NULL; } -- cgit v1.2.3