mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
env-util: introduce proper flags type ReplaceEnvFlags for replace_env()
This commit is contained in:
parent
10930fbb1c
commit
d5ce24c99e
@ -500,7 +500,7 @@ int _strv_env_assign_many(char ***l, ...) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strv_env_get_n(char **l, const char *name, size_t k, unsigned flags) {
|
||||
char *strv_env_get_n(char **l, const char *name, size_t k, ReplaceEnvFlags flags) {
|
||||
assert(name);
|
||||
|
||||
if (k <= 0)
|
||||
@ -578,7 +578,7 @@ char **strv_env_clean_with_callback(char **e, void (*invalid_callback)(const cha
|
||||
return e;
|
||||
}
|
||||
|
||||
char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
|
||||
char *replace_env_n(const char *format, size_t n, char **env, ReplaceEnvFlags flags) {
|
||||
enum {
|
||||
WORD,
|
||||
CURLY,
|
||||
|
@ -19,19 +19,19 @@ bool env_name_is_valid(const char *e);
|
||||
bool env_value_is_valid(const char *e);
|
||||
bool env_assignment_is_valid(const char *e);
|
||||
|
||||
enum {
|
||||
typedef enum ReplaceEnvFlags {
|
||||
REPLACE_ENV_USE_ENVIRONMENT = 1 << 0,
|
||||
REPLACE_ENV_ALLOW_BRACELESS = 1 << 1,
|
||||
REPLACE_ENV_ALLOW_EXTENDED = 1 << 2,
|
||||
};
|
||||
} ReplaceEnvFlags;
|
||||
|
||||
char *replace_env_n(const char *format, size_t n, char **env, unsigned flags);
|
||||
char **replace_env_argv(char **argv, char **env);
|
||||
|
||||
static inline char *replace_env(const char *format, char **env, unsigned flags) {
|
||||
char *replace_env_n(const char *format, size_t n, char **env, ReplaceEnvFlags flags);
|
||||
static inline char *replace_env(const char *format, char **env, ReplaceEnvFlags flags) {
|
||||
return replace_env_n(format, strlen(format), env, flags);
|
||||
}
|
||||
|
||||
char **replace_env_argv(char **argv, char **env);
|
||||
|
||||
bool strv_env_is_valid(char **e);
|
||||
#define strv_env_clean(l) strv_env_clean_with_callback(l, NULL, NULL)
|
||||
char **strv_env_clean_with_callback(char **l, void (*invalid_callback)(const char *p, void *userdata), void *userdata);
|
||||
@ -52,7 +52,7 @@ int strv_env_assign(char ***l, const char *key, const char *value);
|
||||
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, unsigned flags) _pure_;
|
||||
char *strv_env_get_n(char **l, const char *name, size_t k, ReplaceEnvFlags flags) _pure_;
|
||||
char *strv_env_get(char **x, const char *n) _pure_;
|
||||
char *strv_env_pairs_get(char **l, const char *name) _pure_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user