mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
env-util: drop _pure_ for strv_env_get_n
This function calls getenv() internally, making it non-pure, as envvars can change between two calls even if passed arguments are the same.
This commit is contained in:
parent
17ca151733
commit
70e80269aa
@ -529,7 +529,7 @@ int _strv_env_assign_many(char ***l, ...) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* strv_env_get_n(char **l, const char *name, size_t k, ReplaceEnvFlags flags) {
|
||||
char* strv_env_get_n(char * const *l, const char *name, size_t k, ReplaceEnvFlags flags) {
|
||||
assert(name);
|
||||
|
||||
if (k == SIZE_MAX)
|
||||
@ -539,7 +539,7 @@ char* strv_env_get_n(char **l, const char *name, size_t k, ReplaceEnvFlags flags
|
||||
|
||||
STRV_FOREACH_BACKWARDS(i, l)
|
||||
if (strneq(*i, name, k) && (*i)[k] == '=')
|
||||
return *i + k + 1;
|
||||
return (char*) *i + k + 1;
|
||||
|
||||
if (flags & REPLACE_ENV_USE_ENVIRONMENT) {
|
||||
const char *t;
|
||||
|
@ -53,8 +53,8 @@ int strv_env_assignf(char ***l, const char *key, const char *valuef, ...) _print
|
||||
int _strv_env_assign_many(char ***l, ...) _sentinel_;
|
||||
#define strv_env_assign_many(l, ...) _strv_env_assign_many(l, __VA_ARGS__, NULL)
|
||||
|
||||
char* strv_env_get_n(char **l, const char *name, size_t k, ReplaceEnvFlags flags) _pure_;
|
||||
static inline char* strv_env_get(char **x, const char *n) {
|
||||
char* strv_env_get_n(char * const *l, const char *name, size_t k, ReplaceEnvFlags flags);
|
||||
static inline char* strv_env_get(char * const *x, const char *n) {
|
||||
return strv_env_get_n(x, n, SIZE_MAX, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user