Merge "init: Simplify struct BuiltinArguments" am: 95465fe718 am: 81af4365b8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2451825 Change-Id: Id00184d42c3afd6f4b7e879197d57e587a73adb5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
e7cba7f653
4 changed files with 4 additions and 8 deletions
|
|
@ -30,7 +30,7 @@ namespace init {
|
||||||
|
|
||||||
Result<void> RunBuiltinFunction(const BuiltinFunction& function,
|
Result<void> RunBuiltinFunction(const BuiltinFunction& function,
|
||||||
const std::vector<std::string>& args, const std::string& context) {
|
const std::vector<std::string>& args, const std::string& context) {
|
||||||
auto builtin_arguments = BuiltinArguments(context);
|
BuiltinArguments builtin_arguments{.context = context};
|
||||||
|
|
||||||
builtin_arguments.args.resize(args.size());
|
builtin_arguments.args.resize(args.size());
|
||||||
builtin_arguments.args[0] = args[0];
|
builtin_arguments.args[0] = args[0];
|
||||||
|
|
@ -69,7 +69,7 @@ Result<void> Command::InvokeFunc(Subcontext* subcontext) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<void> Command::CheckCommand() const {
|
Result<void> Command::CheckCommand() const {
|
||||||
auto builtin_arguments = BuiltinArguments("host_init_verifier");
|
BuiltinArguments builtin_arguments{.context = "host_init_verifier"};
|
||||||
|
|
||||||
builtin_arguments.args.resize(args_.size());
|
builtin_arguments.args.resize(args_.size());
|
||||||
builtin_arguments.args[0] = args_[0];
|
builtin_arguments.args[0] = args_[0];
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,6 @@ namespace android {
|
||||||
namespace init {
|
namespace init {
|
||||||
|
|
||||||
struct BuiltinArguments {
|
struct BuiltinArguments {
|
||||||
BuiltinArguments(const std::string& context) : context(context) {}
|
|
||||||
BuiltinArguments(std::vector<std::string> args, const std::string& context)
|
|
||||||
: args(std::move(args)), context(context) {}
|
|
||||||
|
|
||||||
const std::string& operator[](std::size_t i) const { return args[i]; }
|
const std::string& operator[](std::size_t i) const { return args[i]; }
|
||||||
auto begin() const { return args.begin(); }
|
auto begin() const { return args.begin(); }
|
||||||
auto end() const { return args.end(); }
|
auto end() const { return args.end(); }
|
||||||
|
|
|
||||||
|
|
@ -1074,7 +1074,7 @@ static Result<void> do_restorecon(const BuiltinArguments& args) {
|
||||||
static Result<void> do_restorecon_recursive(const BuiltinArguments& args) {
|
static Result<void> do_restorecon_recursive(const BuiltinArguments& args) {
|
||||||
std::vector<std::string> non_const_args(args.args);
|
std::vector<std::string> non_const_args(args.args);
|
||||||
non_const_args.insert(std::next(non_const_args.begin()), "--recursive");
|
non_const_args.insert(std::next(non_const_args.begin()), "--recursive");
|
||||||
return do_restorecon({std::move(non_const_args), args.context});
|
return do_restorecon({.args = std::move(non_const_args), .context = args.context});
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result<void> do_loglevel(const BuiltinArguments& args) {
|
static Result<void> do_loglevel(const BuiltinArguments& args) {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ Result<void> check_exec_background(const BuiltinArguments& args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<void> check_exec_reboot_on_failure(const BuiltinArguments& args) {
|
Result<void> check_exec_reboot_on_failure(const BuiltinArguments& args) {
|
||||||
BuiltinArguments remaining_args(args.context);
|
BuiltinArguments remaining_args{.context = args.context};
|
||||||
|
|
||||||
remaining_args.args = std::vector<std::string>(args.begin() + 1, args.end());
|
remaining_args.args = std::vector<std::string>(args.begin() + 1, args.end());
|
||||||
remaining_args.args[0] = args[0];
|
remaining_args.args[0] = args[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue