summaryrefslogtreecommitdiff
path: root/src/basic/proc-cmdline.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-10-27 11:15:20 +0200
committerLennart Poettering <lennart@poettering.net>2017-11-17 11:13:44 +0100
commit11f5d82507494b39fcce27e102e5a8b186451acf (patch)
tree8518e8cc6342e09d3edb1bc731727818b89680fb /src/basic/proc-cmdline.c
parenta3ab8f2a9923b0dc35a0a9f17fd1d69adc5f75d2 (diff)
downloadsystemd-11f5d82507494b39fcce27e102e5a8b186451acf.tar.gz
proc-cmdline: minor runlevel_to_target() coding style fixes
Let's not mix function calls and variable declarations, as well as assignments and comparison in one expression.
Diffstat (limited to 'src/basic/proc-cmdline.c')
-rw-r--r--src/basic/proc-cmdline.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index 8592a428d5..8590133f9f 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -270,17 +270,21 @@ static const char * const rlmap_initrd[] = {
};
const char* runlevel_to_target(const char *word) {
+ const char * const *rlmap_ptr;
size_t i;
- const char * const *rlmap_ptr = in_initrd() ? rlmap_initrd
- : rlmap;
if (!word)
return NULL;
- if (in_initrd() && (word = startswith(word, "rd.")) == NULL)
- return NULL;
+ if (in_initrd()) {
+ word = startswith(word, "rd.");
+ if (!word)
+ return NULL;
+ }
+
+ rlmap_ptr = in_initrd() ? rlmap_initrd : rlmap;
- for (i = 0; rlmap_ptr[i] != NULL; i += 2)
+ for (i = 0; rlmap_ptr[i]; i += 2)
if (streq(word, rlmap_ptr[i]))
return rlmap_ptr[i+1];