Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/auriamg/macdylibbundler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Friedrichsmeier <thomas.friedrichsmeier@ruhr-uni-bochum.de>2018-04-10 10:25:00 +0300
committerThomas Friedrichsmeier <thomas.friedrichsmeier@ruhr-uni-bochum.de>2018-04-10 10:25:00 +0300
commit3f9a34b0c39b2e98c9a580ae98aabd76d140ca57 (patch)
tree54ca401c73873ac9eaeb2e9dee84ab504254f9fc
parent0bd58f5492582dcb4a7386ba544b810dfbcd970f (diff)
Avoid adding duplicate symlinks.
-rw-r--r--src/Dependency.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Dependency.cpp b/src/Dependency.cpp
index e9e4a36..ee46e7e 100644
--- a/src/Dependency.cpp
+++ b/src/Dependency.cpp
@@ -192,7 +192,11 @@ std::string Dependency::getInnerPath()
}
-void Dependency::addSymlink(std::string s){ symlinks.push_back(s); }
+void Dependency::addSymlink(std::string s)
+{
+ // calling std::find on this vector is not near as slow as an extra invocation of install_name_tool
+ if(std::find(symlinks.begin(), symlinks.end(), s) == symlinks.end()) symlinks.push_back(s);
+}
// Compares the given Dependency with this one. If both refer to the same file,
// it returns true and merges both entries into one.
@@ -202,7 +206,7 @@ bool Dependency::mergeIfSameAs(Dependency& dep2)
{
const int samount = getSymlinkAmount();
for(int n=0; n<samount; n++) {
- dep2.addSymlink(getSymlink(n)); // FIXME - there may be duplicate symlinks
+ dep2.addSymlink(getSymlink(n));
}
return true;
}