[Cmake-commits] CMake branch, next, updated. v3.5.2-1502-g8738542

Brad King brad.king at kitware.com
Thu May 19 12:01:52 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  873854200c33faffd87406143f60664fea9de6a4 (commit)
       via  f4d3c44cc774871f6924304f1f0d3b05fd060f1a (commit)
      from  89e30ba9b52013cf8cb923942e205be4a4354784 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=873854200c33faffd87406143f60664fea9de6a4
commit 873854200c33faffd87406143f60664fea9de6a4
Merge: 89e30ba f4d3c44
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 19 12:01:51 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 19 12:01:51 2016 -0400

    Merge topic 'rpath-no-regex' into next
    
    f4d3c44c Fix support for large RPATH updates (#16105)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4d3c44cc774871f6924304f1f0d3b05fd060f1a
commit f4d3c44cc774871f6924304f1f0d3b05fd060f1a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 19 11:51:51 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu May 19 11:59:25 2016 -0400

    Fix support for large RPATH updates (#16105)
    
    Avoid using a KWSys RegularExpression to search for RPATH substrings.
    It cannot handle large expressions.

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index bb52441..ed83069 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2135,37 +2135,33 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
 std::string::size_type cmSystemToolsFindRPath(std::string const& have,
                                               std::string const& want)
 {
-  // Search for the desired rpath.
-  std::string::size_type pos = have.find(want);
-
-  // If the path is not present we are done.
-  if (pos == std::string::npos) {
-    return pos;
-  }
+  std::string::size_type pos = 0;
+  while (pos < have.size()) {
+    // Look for an occurrence of the string.
+    std::string::size_type const beg = have.find(want, pos);
+    if (beg == std::string::npos) {
+      return std::string::npos;
+    }
 
-  // Build a regex to match a properly separated path instance.
-  std::string regex_str = "(^|:)(";
-  for (std::string::const_iterator i = want.begin(); i != want.end(); ++i) {
-    int ch = *i;
-    if (!(('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
-          ('0' <= ch && ch <= '9'))) {
-      // Escape the non-alphanumeric character.
-      regex_str += "\\";
+    // Make sure it is separated from preceding entries.
+    if (beg > 0 && have[beg - 1] != ':') {
+      pos = beg + 1;
+      continue;
     }
-    // Store the character.
-    regex_str.append(1, static_cast<char>(ch));
-  }
-  regex_str += ")(:|$)";
 
-  // Look for the separated path.
-  cmsys::RegularExpression regex(regex_str.c_str());
-  if (regex.find(have)) {
+    // Make sure it is separated from following entries.
+    std::string::size_type const end = beg + want.size();
+    if (end < have.size() && have[end] != ':') {
+      pos = beg + 1;
+      continue;
+     }
+
     // Return the position of the path portion.
-    return regex.start(2);
-  } else {
-    // The desired rpath was not found.
-    return std::string::npos;
+    return beg;
   }
+
+  // The desired rpath was not found.
+  return std::string::npos;
 }
 #endif
 

-----------------------------------------------------------------------

Summary of changes:
 Source/cmSystemTools.cxx |   48 +++++++++++++++++++++-------------------------
 1 file changed, 22 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list