use ConstCharRange

master
Daniel Kolesa 2015-11-24 20:14:37 +00:00
parent c6dd8111bb
commit 3d9bbc465a
1 changed files with 4 additions and 3 deletions

View File

@ -327,7 +327,8 @@ struct ObState {
}
}
void rule_dup(const char *tgt, const char *ptgt, const char *dep) {
void rule_dup(ConstCharRange tgt, ConstCharRange ptgt, ConstCharRange dep,
bool inherit_deps) {
Rule *oldr = nullptr;
for (auto &rule: rules.iter())
if (ptgt == rule.target)
@ -338,7 +339,7 @@ struct ObState {
r.target = tgt;
r.action = oldr->action;
r.func = oldr->func;
r.deps = dep ? cscript::util::list_explode(dep) : oldr->deps;
r.deps = inherit_deps ? oldr->deps : cscript::util::list_explode(dep);
}
};
@ -443,7 +444,7 @@ int main(int argc, char **argv) {
os.cs.add_command("duprule", "sssN", [](CsState &cs, const char *tgt,
const char *ptgt, const char *dep,
int *numargs) {
((ObState &)cs).rule_dup(tgt, ptgt, (*numargs > 2) ? dep : nullptr);
((ObState &)cs).rule_dup(tgt, ptgt, dep, *numargs <= 2);
});
os.cs.add_commandn("getenv", "ss", [](CsState &cs, TvalRange args) {