From b9ecc1d4e5b9cc4e4c3e6793516e1809aec76762 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 1 Aug 2024 17:06:49 -0700 Subject: [PATCH] In dtc_compile, use c string instead of stl string --- riscv/dts.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riscv/dts.cc b/riscv/dts.cc index 48e538247c..9751ffeee1 100644 --- a/riscv/dts.cc +++ b/riscv/dts.cc @@ -101,8 +101,8 @@ std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, static std::string dtc_compile(const std::string& dtc_input, bool compile) { - const std::string input_type = compile ? "dts" : "dtb"; - const std::string output_type = compile ? "dtb" : "dts"; + const char* input_type = compile ? "dts" : "dtb"; + const char* output_type = compile ? "dtb" : "dts"; int dtc_input_pipe[2]; pid_t dtc_input_pid; @@ -144,7 +144,7 @@ static std::string dtc_compile(const std::string& dtc_input, bool compile) close(dtc_input_pipe[1]); close(dtc_output_pipe[0]); close(dtc_output_pipe[1]); - execlp(DTC, DTC, "-O", output_type.c_str(), "-I", input_type.c_str(), (char *)0); + execlp(DTC, DTC, "-O", output_type, "-I", input_type, nullptr); std::cerr << "Failed to run " DTC ": " << strerror(errno) << std::endl; exit(1); }