Skip to content

Commit

Permalink
Fix single-line conditional in ip_tools; single-line lambda in types
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Lebedev <[email protected]>
  • Loading branch information
lebdron committed Nov 6, 2017
1 parent 5106668 commit b610d2a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ BinPackArguments: false
BinPackParameters: false
DerivePointerAlignment: false
PointerAlignment: Right
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
12 changes: 8 additions & 4 deletions libs/common/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ namespace iroha {
*/
template <typename T, typename... Args>
auto makeMethodInvoke(T &object, Args &&... args) {
return [&](auto f) { return (object.*f)(std::forward<Args>(args)...); };
return [&](auto f) {
return (object.*f)(std::forward<Args>(args)...);
};
}

/**
Expand Down Expand Up @@ -308,11 +310,13 @@ namespace iroha {
using privkey_t = blob_t<64>;

struct keypair_t {
keypair_t() = default;

keypair_t(pubkey_t pubkey, privkey_t privkey)
: pubkey(pubkey), privkey(privkey) {}

pubkey_t pubkey;
privkey_t privkey;

keypair_t() = default;
keypair_t(pubkey_t pubkey, privkey_t privkey): pubkey(pubkey), privkey(privkey) {}
};

// timestamps
Expand Down
35 changes: 19 additions & 16 deletions libs/ip_tools/ip_tools.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
Copyright Soramitsu Co., Ltd. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
* http://soramitsu.co.jp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "ip_tools.hpp"
#include "logger/logger.hpp"
Expand All @@ -24,7 +25,9 @@ namespace iroha {
namespace ip_tools {

bool isIpValid(const std::string &ip) {
if (ip == "localhost") return true;
if (ip == "localhost") {
return true;
}
std::regex ipRegex(
"((([0-1]?\\d\\d?)|((2[0-4]\\d)|(25[0-5]))).){3}(([0-1]?\\d\\d?)|((2[0-4]"
"\\d)|(25[0-5])))");
Expand Down
31 changes: 16 additions & 15 deletions libs/ip_tools/ip_tools.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
Copyright Soramitsu Co., Ltd. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
* http://soramitsu.co.jp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef IROHA_IP_TOOLS_HPP
#define IROHA_IP_TOOLS_HPP
Expand Down

0 comments on commit b610d2a

Please sign in to comment.