Remove non-method mkPath()

This commit is contained in:
Eelco Dolstra 2022-01-04 18:45:16 +01:00
parent 263a8d293c
commit ed93aec3c3
3 changed files with 7 additions and 9 deletions

View file

@ -786,9 +786,9 @@ void Value::mkString(std::string_view s, const PathSet & context)
}
void mkPath(Value & v, const char * s)
void Value::mkPath(std::string_view s)
{
v.mkPath(dupString(s));
mkPath(dupStringWithLen(s.data(), s.size()));
}
@ -1711,8 +1711,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
else if (firstType == nPath) {
if (!context.empty())
throwEvalError(pos, "a string that refers to a store path cannot be appended to a path");
auto path = canonPath(s.str());
mkPath(v, path.c_str());
v.mkPath(canonPath(s.str()));
} else
v.mkString(s.str(), context);
}

View file

@ -1441,7 +1441,7 @@ static void prim_dirOf(EvalState & state, const Pos & pos, Value * * args, Value
{
PathSet context;
Path dir = dirOf(state.coerceToString(pos, *args[0], context, false, false));
if (args[0]->type() == nPath) mkPath(v, dir.c_str()); else v.mkString(dir, context);
if (args[0]->type() == nPath) v.mkPath(dir); else v.mkString(dir, context);
}
static RegisterPrimOp primop_dirOf({
@ -1522,7 +1522,7 @@ static void prim_findFile(EvalState & state, const Pos & pos, Value * * args, Va
string path = state.forceStringNoCtx(*args[1], pos);
mkPath(v, state.checkSourcePath(state.findFile(searchPath, path, pos)).c_str());
v.mkPath(state.checkSourcePath(state.findFile(searchPath, path, pos)));
}
static RegisterPrimOp primop_findFile(RegisterPrimOp::Info {

View file

@ -248,6 +248,8 @@ public:
path = s;
}
void mkPath(std::string_view s);
inline void mkNull()
{
clearValue();
@ -399,9 +401,6 @@ static inline void mkString(Value & v, const Symbol & s)
}
void mkPath(Value & v, const char * s);
#if HAVE_BOEHMGC
typedef std::vector<Value *, traceable_allocator<Value *> > ValueVector;
typedef std::map<Symbol, Value *, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, Value *> > > ValueMap;