diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-12-02 20:56:26 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-01-07 13:23:17 +0100 |
commit | fcddaa4b9b22a910a24a513bc05579a12eb1db41 (patch) | |
tree | 2909d496b0b4b18466466b163d260b939e75c206 /src | |
parent | e1a0359b599d0beeb93f11d9948ec2cb1a1008c4 (diff) |
dump(): Use emplace()
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/archive.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc index d78ec2b93..fdee643b1 100644 --- a/src/libutil/archive.cc +++ b/src/libutil/archive.cc @@ -93,13 +93,12 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter) debug(format("removing case hack suffix from '%1%'") % (path + "/" + i.name)); name.erase(pos); } - if (unhacked.find(name) != unhacked.end()) + if (!unhacked.emplace(name, i.name).second) throw Error("file name collision in between '%1%' and '%2%'", (path + "/" + unhacked[name]), (path + "/" + i.name)); - unhacked[name] = i.name; } else - unhacked[i.name] = i.name; + unhacked.emplace(i.name, i.name); for (auto & i : unhacked) if (filter(path + "/" + i.first)) { |