diff --git a/build.cc b/build.cc index 52dd08f..8218029 100644 --- a/build.cc +++ b/build.cc @@ -37,7 +37,7 @@ static std::vector EXAMPLES = { "stream1", "stream2", "coroutine1", "coroutine2", "concurrency" }; -static fs::path ASM_SOURCE_DIR = "src/asm"; +static fs::path ASM_SOURCE_DIR = fs::path{"src"} / "asm"; static strvec ASM_SOURCES = { "jump_all_gas", "make_all_gas", "ontop_all_gas" }; diff --git a/src/process.cc b/src/process.cc index a1226c2..8657229 100644 --- a/src/process.cc +++ b/src/process.cc @@ -479,21 +479,22 @@ static std::string concat_args(std::vector const &args) { if (*p == '\"') { /* not preceded by \, so it's safe */ ret += "\\\""; + ++p; } else { /* handle any sequence of \ optionally followed by a " */ - std::size_t nbsl = 0; - while (*p++ == '\\') { - ++nbsl; + char const *op = p; + while (*p == '\\') { + ++p; } if (*p == '\"') { /* double all the backslashes plus one for the " */ - ret.append(nbsl * 2 + 1, '\\'); + ret.append((p - op) * 2 + 1, '\\'); ret += '\"'; } else { - ret.append(nbsl, '\\'); + ret.append(p - op, '\\'); } } - sp = p + 1; + sp = p; } ret += '\"'; }