summaryrefslogtreecommitdiff
path: root/src/cryptsetup
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-25 23:49:41 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-25 23:51:32 +0100
commite32530cbef746a3d346334a821a7c804f49af4e6 (patch)
tree1379386b96cd527788dcc442ea636325570780b9 /src/cryptsetup
parent608d41f355d580a6f73e76b298bfc1b4e3155b80 (diff)
cryptsetup-generator: let's be a bit more efficient with strv_extend()
Diffstat (limited to 'src/cryptsetup')
-rw-r--r--src/cryptsetup/cryptsetup-generator.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 5c4a2807a7..8959bf51c8 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -258,26 +258,14 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks) {
}
} else if (startswith(word, "luks.uuid=")) {
- char **t;
-
- t = strv_append(*arg_proc_cmdline_disks, word + 10);
- if (!t)
+ if (strv_extend(arg_proc_cmdline_disks, word + 10) < 0)
return log_oom();
- strv_free(*arg_proc_cmdline_disks);
- *arg_proc_cmdline_disks = t;
-
} else if (startswith(word, "rd.luks.uuid=")) {
if (in_initrd()) {
- char **t;
-
- t = strv_append(*arg_proc_cmdline_disks, word + 13);
- if (!t)
+ if (strv_extend(arg_proc_cmdline_disks, word + 13) < 0)
return log_oom();
-
- strv_free(*arg_proc_cmdline_disks);
- *arg_proc_cmdline_disks = t;
}
} else if (startswith(word, "luks.") ||
@@ -370,17 +358,11 @@ int main(int argc, char *argv[]) {
return log_oom();
if (streq(proc_device, device) || streq(proc_name, name)) {
- char **t;
-
if (create_disk(name, device, password, options) < 0)
r = EXIT_FAILURE;
- t = strv_append(arg_proc_cmdline_disks_done, p);
- if (!t)
+ if (strv_extend(&arg_proc_cmdline_disks_done, p) < 0)
return log_oom();
-
- strv_free(arg_proc_cmdline_disks_done);
- arg_proc_cmdline_disks_done = t;
}
}
} else {