You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/01/26 23:28:14 UTC

mesos git commit: Changed static pods to pointers in role validation.

Repository: mesos
Updated Branches:
  refs/heads/master ffcef51f0 -> 5e618ac21


Changed static pods to pointers in role validation.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5e618ac2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5e618ac2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5e618ac2

Branch: refs/heads/master
Commit: 5e618ac2197e856f09511850bebe51fea71c1844
Parents: ffcef51
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Tue Jan 26 14:26:08 2016 -0800
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Jan 26 14:28:08 2016 -0800

----------------------------------------------------------------------
 src/common/roles.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5e618ac2/src/common/roles.cpp
----------------------------------------------------------------------
diff --git a/src/common/roles.cpp b/src/common/roles.cpp
index 46e40f0..65c7193 100644
--- a/src/common/roles.cpp
+++ b/src/common/roles.cpp
@@ -51,25 +51,26 @@ Try<vector<string>> parse(const string& text)
 // \x20 is space (whitespace);
 // \x2f is slash ('/');
 // \x7f is backspace (del);
-static const string INVALID_CHARACTERS = "\x09\x0a\x0b\x0c\x0d\x20\x2f\x7f";
+static const string* INVALID_CHARACTERS =
+  new string("\x09\x0a\x0b\x0c\x0d\x20\x2f\x7f");
 
 
 Option<Error> validate(const string& role)
 {
-  static const string dot = ".";
-  static const string dotdot = "..";
+  static const string* dot = new string(".");
+  static const string* dotdot = new string("..");
   if (role.empty()) {
     return Error("Empty role name is invalid");
-  } else if (role == dot) {
+  } else if (role == *dot) {
     return Error("Role name '.' is invalid");
-  } else if (role == dotdot) {
+  } else if (role == *dotdot) {
     return Error("Role name '..' is invalid");
   } else if (role[0] == '-') {
     return Error("Role name '" + role + "' is invalid "
                  "because it starts with a dash");
   }
 
-  if (role.find_first_of(INVALID_CHARACTERS) != string::npos) {
+  if (role.find_first_of(*INVALID_CHARACTERS) != string::npos) {
     return Error("Role name '" + role + "' is invalid "
                  "because it contains slash, backspace or whitespace");
   }