mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
proc-cmdline: make proc_cmdline_parse_given() static
It is used only in proc-cmdline.c and its test. And the test can be covered by proc_cmdline_parse().
This commit is contained in:
parent
1479799c4d
commit
2a6911bb1f
@ -79,7 +79,7 @@ static int proc_cmdline_extract_first(const char **p, char **ret_word, ProcCmdli
|
||||
return 0;
|
||||
}
|
||||
|
||||
int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, ProcCmdlineFlags flags) {
|
||||
static int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, ProcCmdlineFlags flags) {
|
||||
const char *p;
|
||||
int r;
|
||||
|
||||
|
@ -16,7 +16,6 @@ typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *da
|
||||
|
||||
int proc_cmdline(char **ret);
|
||||
|
||||
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, ProcCmdlineFlags flags, char **value);
|
||||
|
@ -90,17 +90,17 @@ static void test_proc_cmdline_given_one(bool flip_initrd) {
|
||||
in_initrd_force(!in_initrd());
|
||||
|
||||
bool t = true, f = false;
|
||||
assert_se(proc_cmdline_parse_given("foo_bar=quux wuff-piep=\"tuet \" rd.zumm space='x y z' miepf=\"uuu\"",
|
||||
parse_item_given, &t, PROC_CMDLINE_STRIP_RD_PREFIX) >= 0);
|
||||
|
||||
assert_se(proc_cmdline_parse_given("foo_bar=quux wuff-piep=\"tuet \" rd.zumm space='x y z' miepf=\"uuu\"",
|
||||
parse_item_given, &f, 0) >= 0);
|
||||
assert_se(proc_cmdline_parse(parse_item_given, &t, PROC_CMDLINE_STRIP_RD_PREFIX) >= 0);
|
||||
assert_se(proc_cmdline_parse(parse_item_given, &f, 0) >= 0);
|
||||
|
||||
if (flip_initrd)
|
||||
in_initrd_force(!in_initrd());
|
||||
}
|
||||
|
||||
TEST(test_proc_cmdline_given) {
|
||||
assert_se(putenv((char*) "SYSTEMD_PROC_CMDLINE=foo_bar=quux wuff-piep=\"tuet \" rd.zumm space='x y z' miepf=\"uuu\"") == 0);
|
||||
assert_se(putenv((char*) "SYSTEMD_EFI_OPTIONS=miepf=\"uuu\"") == 0);
|
||||
|
||||
test_proc_cmdline_given_one(false);
|
||||
/* Repeat the same thing, but now flip our ininitrdness */
|
||||
test_proc_cmdline_given_one(true);
|
||||
|
Loading…
Reference in New Issue
Block a user