mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 10:51:20 +03:00
proc-cmdline: turn flags parameter into a proper typedef'ed enum
Let's add some extra typesafety.
This commit is contained in:
parent
8755568681
commit
f6dd5e7c18
@ -39,7 +39,7 @@ int proc_cmdline(char **ret) {
|
||||
return read_one_line_file("/proc/cmdline", ret);
|
||||
}
|
||||
|
||||
int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, unsigned flags) {
|
||||
int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, ProcCmdlineFlags flags) {
|
||||
const char *p;
|
||||
int r;
|
||||
|
||||
@ -82,7 +82,7 @@ int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned flags) {
|
||||
int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, ProcCmdlineFlags flags) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
int r;
|
||||
|
||||
@ -127,7 +127,7 @@ bool proc_cmdline_key_streq(const char *x, const char *y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int proc_cmdline_get_key(const char *key, unsigned flags, char **value) {
|
||||
int proc_cmdline_get_key(const char *key, ProcCmdlineFlags flags, char **value) {
|
||||
_cleanup_free_ char *line = NULL, *ret = NULL;
|
||||
bool found = false;
|
||||
const char *p;
|
||||
|
@ -5,20 +5,20 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
enum {
|
||||
typedef enum ProcCmdlineFlags {
|
||||
PROC_CMDLINE_STRIP_RD_PREFIX = 1 << 0,
|
||||
PROC_CMDLINE_VALUE_OPTIONAL = 1 << 1,
|
||||
PROC_CMDLINE_RD_STRICT = 1 << 2,
|
||||
};
|
||||
} ProcCmdlineFlags;
|
||||
|
||||
typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
|
||||
|
||||
int proc_cmdline(char **ret);
|
||||
|
||||
int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, unsigned flags);
|
||||
int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags);
|
||||
int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, ProcCmdlineFlags flags);
|
||||
int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, ProcCmdlineFlags flags);
|
||||
|
||||
int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value);
|
||||
int proc_cmdline_get_key(const char *parameter, ProcCmdlineFlags flags, char **value);
|
||||
int proc_cmdline_get_bool(const char *key, bool *ret);
|
||||
|
||||
char *proc_cmdline_key_startswith(const char *s, const char *prefix);
|
||||
|
Loading…
Reference in New Issue
Block a user