summaryrefslogtreecommitdiffstats
path: root/src/hibernate-resume/hibernate-resume-generator.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-08-08 19:44:52 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-08-08 20:16:31 +0200
commita8d3315ba410de0db154516d945b0731656a41d8 (patch)
tree601382dedfb235754b93234f9f9a48ab70b646ac /src/hibernate-resume/hibernate-resume-generator.c
parentresolve: ignore nameserver= and domain= kernel command line options without v... (diff)
downloadsystemd-a8d3315ba410de0db154516d945b0731656a41d8.tar.xz
systemd-a8d3315ba410de0db154516d945b0731656a41d8.zip
tree-wise: drop unnecessary use of proc_cmdline_key_streq()
If the key does not contain '-' or '_', then it is not necessary to use proc_cmdline_key_streq(), and streq() is sufficient. This also adds missing assertions about 'key' argument.
Diffstat (limited to 'src/hibernate-resume/hibernate-resume-generator.c')
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index fcd2889238..8b83ad6bdb 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -56,7 +56,9 @@ typedef struct EFIHibernateLocation {
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
int r;
- if (proc_cmdline_key_streq(key, "resume")) {
+ assert(key);
+
+ if (streq(key, "resume")) {
char *s;
if (proc_cmdline_value_missing(key, value))
@@ -79,7 +81,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
arg_resume_offset_set = true;
- } else if (proc_cmdline_key_streq(key, "resumeflags")) {
+ } else if (streq(key, "resumeflags")) {
if (proc_cmdline_value_missing(key, value))
return 0;
@@ -87,7 +89,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (!strextend_with_separator(&arg_resume_options, ",", value))
return log_oom();
- } else if (proc_cmdline_key_streq(key, "rootflags")) {
+ } else if (streq(key, "rootflags")) {
if (proc_cmdline_value_missing(key, value))
return 0;
@@ -95,7 +97,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (!strextend_with_separator(&arg_root_options, ",", value))
return log_oom();
- } else if (proc_cmdline_key_streq(key, "noresume")) {
+ } else if (streq(key, "noresume")) {
+
if (value) {
log_warning("\"noresume\" kernel command line switch specified with an argument, ignoring.");
return 0;