diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-19 11:55:07 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-20 11:51:00 +0100 |
commit | b4b4c28214545524d90efed5ebb24054cec78e4e (patch) | |
tree | 01d9f31d199e2ad81c59218f0cc7190662b8b9ce /include | |
parent | 7dd66e63d887f15565434218f768df22cfd31182 (diff) | |
download | barebox-b4b4c28214545524d90efed5ebb24054cec78e4e.tar.gz barebox-b4b4c28214545524d90efed5ebb24054cec78e4e.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/envfs.h | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |