Removed unnecesary break statements in local approver.

Removes `break` statements located in lines following a `return`
statement since they are effectively unreachable code, don't improve
readability nor make the code cleaner.

Review: https://reviews.apache.org/r/58292/


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

Branch: refs/heads/master
Commit: 76d42c3bb8404b68656dfff4ed31cff9750f3e65
Parents: 8e15963
Author: Alexander Rojas <[email protected]>
Authored: Mon Apr 10 18:03:10 2017 -0700
Committer: Jie Yu <[email protected]>
Committed: Tue Apr 11 16:31:06 2017 -0700

----------------------------------------------------------------------
 src/common/validation.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/76d42c3b/src/common/validation.cpp
----------------------------------------------------------------------
diff --git a/src/common/validation.cpp b/src/common/validation.cpp
index 544d3a0..9c4f1de 100644
--- a/src/common/validation.cpp
+++ b/src/common/validation.cpp
@@ -16,6 +16,8 @@
 
 #include "common/validation.hpp"
 
+#include <limits.h>
+
 #include <algorithm>
 #include <cctype>
 
@@ -37,13 +39,19 @@ Option<Error> validateID(const string& id)
     return Error("ID must not be empty");
   }
 
+  if (id.length() > NAME_MAX) {
+    return Error(
+        "ID must not be greater than " +
+        stringify(NAME_MAX) + " characters");
+  }
+
   // The ID cannot be exactly these special path components.
   if (id == "." || id == "..") {
     return Error("'" + id + "' is disallowed");
   }
 
   // Rules on invalid characters in the ID:
-  // - Control charaters are obviously not allowed.
+  // - Control characters are obviously not allowed.
   // - Slashes are disallowed as IDs are likely mapped to directories in Mesos.
   auto invalidCharacter = [](char c) {
     return iscntrl(c) ||

Reply via email to