Skip to content

Commit

Permalink
Expanad tabs and remove trailing spaces
Browse files Browse the repository at this point in the history
In a recent code review, unmodified code had trailing spaces which
always show up in "Red" in git diff and in gerrit. Instead of a point
fix, clean the entire C++ code base to expand tabs to spaces and also
remove all trailing spaces.

This may parts of code difficult for back-porting to other branches but
this code hygiene has been pending for a while. Hence we may only back
port to R5.0.

Change-Id: I24fec35e5c84de9819ab83a14546b0fa22b42fad
Partial-Bug: 1765458
  • Loading branch information
ananth-at-camphor-networks committed Apr 19, 2018
1 parent efe4aa6 commit d9edd3c
Show file tree
Hide file tree
Showing 528 changed files with 4,520 additions and 4,520 deletions.
2 changes: 1 addition & 1 deletion src/bfd/rest_api/bfd_rest_server.h
Expand Up @@ -79,7 +79,7 @@ class RESTServer {
void ClientIPAddressHandlerDelete(const struct RESTData&);
void ClientMonitorHandler(const struct RESTData&);

ClientMap client_sessions_;
ClientMap client_sessions_;
Server *bfd_server_;
tbb::mutex mutex_;
};
Expand Down
2 changes: 1 addition & 1 deletion src/bfd/test/bfd_test_utils.h
Expand Up @@ -50,7 +50,7 @@ class TestCommunicatorManager {
explicit TestCommunicatorManager(boost::asio::io_service *io_service)
: io_service(io_service) {}


static void processPacketAndFreeActual(const callback &cb,
const ControlPacket *controlPacket) {
cb(controlPacket);
Expand Down
2 changes: 1 addition & 1 deletion src/bgp/bgp_config_yaml.cc
Expand Up @@ -602,7 +602,7 @@ bool BgpYamlConfigManager::Resolve(Configuration *candidate,

void BgpYamlConfigManager::UpdateProtocol(
Configuration *current, Configuration *next) {
BgpProtocolConfig *curr_proto = current->GetProtocolConfig();
BgpProtocolConfig *curr_proto = current->GetProtocolConfig();
BgpProtocolConfig *next_proto = next->GetProtocolConfig();
if (curr_proto->CompareTo(*next_proto) == 0) {
Notify(next_proto, CFG_CHANGE);
Expand Down
4 changes: 2 additions & 2 deletions src/bgp/bgp_message_builder.cc
Expand Up @@ -128,7 +128,7 @@ bool BgpMessage::StartReach(const RibOut *ribout, const RibOutAttr *roattr,
route->BuildBgpProtoNextHop(nh, attr->nexthop());

BgpMpNlri *nlri = new BgpMpNlri(
BgpAttribute::MPReachNlri, BgpAf::FamilyToAfi(family),
BgpAttribute::MPReachNlri, BgpAf::FamilyToAfi(family),
BgpAf::FamilyToSafi(family), nh);
update.path_attributes.push_back(nlri);

Expand Down Expand Up @@ -157,7 +157,7 @@ bool BgpMessage::StartUnreach(const BgpRoute *route) {
Address::Family family = table_->family();

BgpMpNlri *nlri =
new BgpMpNlri(BgpAttribute::MPUnreachNlri,
new BgpMpNlri(BgpAttribute::MPUnreachNlri,
BgpAf::FamilyToAfi(family), BgpAf::FamilyToSafi(family));
update.path_attributes.push_back(nlri);

Expand Down
6 changes: 3 additions & 3 deletions src/bgp/bgp_show_config.cc
Expand Up @@ -587,7 +587,7 @@ void ShowBgpGlobalSystemConfigReq::HandleRequest() const {
ShowBgpGlobalSystemConfigReqIterate,
ShowBgpGlobalSystemConfigResp,
ShowBgpGlobalSystemConfig>::CreateData;

s1.instances_.push_back(0);
ps.stages_.push_back(s1);
RequestPipeline rp(ps);
Expand All @@ -607,13 +607,13 @@ void ShowBgpGlobalSystemConfigReqIterate::HandleRequest() const {
ShowBgpGlobalSystemConfigReqIterate,
ShowBgpGlobalSystemConfigResp,
ShowBgpGlobalSystemConfig>::CallbackIterate, _1, _2, _3, _4, _5);

s1.allocFn_ = BgpShowHandler<
ShowBgpGlobalSystemConfigReq,
ShowBgpGlobalSystemConfigReqIterate,
ShowBgpGlobalSystemConfigResp,
ShowBgpGlobalSystemConfig>::CreateData;

s1.instances_.push_back(0);
ps.stages_.push_back(s1);
RequestPipeline rp(ps);
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/evpn/evpn_table.cc
Expand Up @@ -151,10 +151,10 @@ BgpRoute *EvpnTable::RouteReplicate(BgpServer *server,
}

if (evpn_prefix.type() == EvpnPrefix::AutoDiscoveryRoute) {
if (IsMaster() || evpn_prefix.tag() != EvpnPrefix::kMaxTag)
return NULL;
community = server->extcomm_db()->ReplaceRTargetAndLocate(
community.get(), ExtCommunity::ExtCommunityList());
if (IsMaster() || evpn_prefix.tag() != EvpnPrefix::kMaxTag)
return NULL;
community = server->extcomm_db()->ReplaceRTargetAndLocate(
community.get(), ExtCommunity::ExtCommunityList());
}
if (evpn_prefix.type() == EvpnPrefix::SegmentRoute)
return NULL;
Expand Down
14 changes: 7 additions & 7 deletions src/bgp/mvpn/test/mvpn_table_test.cc
Expand Up @@ -307,9 +307,9 @@ TEST_F(MvpnTableTest, CreateType4LeafADRoutePrefix) {
TASK_UTIL_EXPECT_EQ(BgpAf::MVpn, BgpAf::FamilyToSafi(blue_->family()));
TASK_UTIL_EXPECT_EQ(4, type4_rt->GetPrefix().type());
TASK_UTIL_EXPECT_EQ(rt->GetPrefix().source(),
type4_rt->GetPrefix().source());
type4_rt->GetPrefix().source());
TASK_UTIL_EXPECT_EQ(rt->GetPrefix().group(),
type4_rt->GetPrefix().group());
type4_rt->GetPrefix().group());

DelRoute(blue_, prefix_str);
task_util::WaitForIdle();
Expand Down Expand Up @@ -351,11 +351,11 @@ TEST_F(MvpnTableTest, CreateType3SPMSIRoutePrefix) {
TASK_UTIL_EXPECT_EQ(BgpAf::MVpn, BgpAf::FamilyToSafi(blue_->family()));
TASK_UTIL_EXPECT_EQ(3, type3_rt->GetPrefix().type());
TASK_UTIL_EXPECT_EQ(rt->GetPrefix().source(),
type3_rt->GetPrefix().source());
type3_rt->GetPrefix().source());
TASK_UTIL_EXPECT_EQ(rt->GetPrefix().group(),
type3_rt->GetPrefix().group());
type3_rt->GetPrefix().group());
TASK_UTIL_EXPECT_EQ(blue_->server()->bgp_identifier(),
rt->GetPrefix().originator().to_ulong());
rt->GetPrefix().originator().to_ulong());

DelRoute(blue_, prefix_str);
task_util::WaitForIdle();
Expand Down Expand Up @@ -384,7 +384,7 @@ TEST_F(MvpnTableTest, CreateType2RoutePrefix) {
TASK_UTIL_EXPECT_EQ(BgpAf::MVpn, BgpAf::FamilyToSafi(blue_->family()));
TASK_UTIL_EXPECT_EQ(2, rt->GetPrefix().type());
TASK_UTIL_EXPECT_EQ(blue_->server()->autonomous_system(),
rt->GetPrefix().asn());
rt->GetPrefix().asn());

DelRoute(blue_, prefix_str);
task_util::WaitForIdle();
Expand All @@ -406,7 +406,7 @@ TEST_F(MvpnTableTest, CreateType1RoutePrefix) {
TASK_UTIL_EXPECT_EQ(BgpAf::MVpn, BgpAf::FamilyToSafi(blue_->family()));
TASK_UTIL_EXPECT_EQ(1, rt->GetPrefix().type());
TASK_UTIL_EXPECT_EQ(blue_->server()->bgp_identifier(),
rt->GetPrefix().originator().to_ulong());
rt->GetPrefix().originator().to_ulong());

DelRoute(blue_, prefix_str);
task_util::WaitForIdle();
Expand Down
32 changes: 16 additions & 16 deletions src/bgp/routing-instance/routing_instance.cc
Expand Up @@ -713,7 +713,7 @@ void RoutingInstanceMgr::DestroyRoutingInstance(RoutingInstance *rtinstance) {
}
}

SandeshTraceBufferPtr RoutingInstanceMgr::LocateTraceBuffer(
SandeshTraceBufferPtr RoutingInstanceMgr::LocateTraceBuffer(
const std::string &name) {
SandeshTraceBufferPtr trace_buf;

Expand All @@ -730,15 +730,15 @@ SandeshTraceBufferPtr RoutingInstanceMgr::GetTraceBuffer(
tbb::spin_rw_mutex::scoped_lock write_lock(rw_mutex_, true);
SandeshTraceBufferPtr trace_buf;
RoutingInstanceTraceBufferMap::iterator iter;

iter = trace_buffer_active_.find(name);
if (iter != trace_buffer_active_.end()) {
return iter->second;
}

iter = trace_buffer_dormant_.find(name);
if (iter != trace_buffer_dormant_.end()) {
// tracebuf was created for this RoutingInstance in its prior
// tracebuf was created for this RoutingInstance in its prior
// incarnation
trace_buf = iter->second;
trace_buffer_dormant_.erase(iter);
Expand All @@ -751,7 +751,7 @@ SandeshTraceBufferPtr RoutingInstanceMgr::GetTraceBuffer(
trace_buf = SandeshTraceBufferCreate(
name + RTINSTANCE_TRACE_BUF, 1000);
trace_buffer_active_.insert(make_pair(name, trace_buf));

return trace_buf;
}

Expand All @@ -772,7 +772,7 @@ void RoutingInstanceMgr::DisableTraceBuffer(const std::string &name) {
// Move to Dormant map.
if (trace_buffer_dormant_.size() >= dormant_trace_buf_size_) {
// Make room in the Dormant map, so creating by:
// 1. Delete oldest entries in dormant map
// 1. Delete oldest entries in dormant map
// 2. Insert the new entry.
size_t del_count = std::min(trace_buffer_dormant_list_.size(),
trace_buf_threshold_);
Expand All @@ -799,10 +799,10 @@ void RoutingInstanceMgr::DisableTraceBuffer(const std::string &name) {
return;
}

SandeshTraceBufferPtr
SandeshTraceBufferPtr
RoutingInstanceMgr::GetActiveTraceBuffer(const std::string &name) const {
tbb::spin_rw_mutex::scoped_lock read_lock(rw_mutex_, false);
RoutingInstanceTraceBufferMap::const_iterator iter =
RoutingInstanceTraceBufferMap::const_iterator iter =
trace_buffer_active_.find(name);

if (iter != trace_buffer_active_.end()) {
Expand All @@ -815,9 +815,9 @@ RoutingInstanceMgr::GetActiveTraceBuffer(const std::string &name) const {
SandeshTraceBufferPtr
RoutingInstanceMgr::GetDormantTraceBuffer(const std::string &name) const {
tbb::spin_rw_mutex::scoped_lock read_lock(rw_mutex_, false);
RoutingInstanceTraceBufferMap::const_iterator iter =
RoutingInstanceTraceBufferMap::const_iterator iter =
trace_buffer_dormant_.find(name);

if (iter != trace_buffer_dormant_.end()) {
return iter->second;
} else {
Expand All @@ -828,16 +828,16 @@ RoutingInstanceMgr::GetDormantTraceBuffer(const std::string &name) const {
bool RoutingInstanceMgr::HasRoutingInstanceActiveTraceBuf(const std::string
&name) const {
tbb::spin_rw_mutex::scoped_lock read_lock(rw_mutex_, false);
RoutingInstanceTraceBufferMap::const_iterator iter =
RoutingInstanceTraceBufferMap::const_iterator iter =
trace_buffer_active_.find(name);

return (iter != trace_buffer_active_.end());
}

bool RoutingInstanceMgr::HasRoutingInstanceDormantTraceBuf(const std::string
bool RoutingInstanceMgr::HasRoutingInstanceDormantTraceBuf(const std::string
&name) const {
tbb::spin_rw_mutex::scoped_lock read_lock(rw_mutex_, false);
RoutingInstanceTraceBufferMap::const_iterator iter =
RoutingInstanceTraceBufferMap::const_iterator iter =
trace_buffer_dormant_.find(name);
return (iter != trace_buffer_dormant_.end());
}
Expand All @@ -850,7 +850,7 @@ RoutingInstanceMgr::GetEnvRoutingInstanceDormantTraceBufferCapacity() const {
if (buffer_capacity_str) {
size_t env_buffer_capacity = strtoul(buffer_capacity_str, NULL, 0);
return env_buffer_capacity;
}
}
return 0;
}

Expand All @@ -861,7 +861,7 @@ RoutingInstanceMgr::GetEnvRoutingInstanceDormantTraceBufferThreshold() const {
if (buffer_threshold_str) {
size_t env_buffer_threshold = strtoul(buffer_threshold_str, NULL, 0);
return env_buffer_threshold;
}
}
return ROUTING_INSTANCE_DORMANT_TRACE_BUFFER_THRESHOLD_1K;
}

Expand Down
16 changes: 8 additions & 8 deletions src/bgp/rtarget/test/rtarget_address_test.cc
Expand Up @@ -13,7 +13,7 @@ class RouteTargetTest : public ::testing::Test {

TEST_F(RouteTargetTest, ByteArrayType0_1) {
RouteTarget::bytes_type data =
{ { 0x00, 0x02, 0xff, 0x84, 0x01, 0x02, 0x03, 0x04 } };
{ { 0x00, 0x02, 0xff, 0x84, 0x01, 0x02, 0x03, 0x04 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(0, rtarget.Type());
Expand All @@ -23,7 +23,7 @@ TEST_F(RouteTargetTest, ByteArrayType0_1) {

TEST_F(RouteTargetTest, ByteArrayType0_2) {
RouteTarget::bytes_type data =
{ { 0x00, 0x02, 0xff, 0x84, 0x04, 0x03, 0x02, 0x01 } };
{ { 0x00, 0x02, 0xff, 0x84, 0x04, 0x03, 0x02, 0x01 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(0, rtarget.Type());
Expand All @@ -33,7 +33,7 @@ TEST_F(RouteTargetTest, ByteArrayType0_2) {

TEST_F(RouteTargetTest, ByteArrayType0_3) {
RouteTarget::bytes_type data =
{ { 0x00, 0x02, 0xff, 0x84, 0x00, 0x00, 0x00, 0x00 } };
{ { 0x00, 0x02, 0xff, 0x84, 0x00, 0x00, 0x00, 0x00 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(0, rtarget.Type());
Expand All @@ -43,7 +43,7 @@ TEST_F(RouteTargetTest, ByteArrayType0_3) {

TEST_F(RouteTargetTest, ByteArrayType0_4) {
RouteTarget::bytes_type data =
{ { 0x00, 0x02, 0xff, 0x84, 0xFF, 0xFF, 0xFF, 0xFF } };
{ { 0x00, 0x02, 0xff, 0x84, 0xFF, 0xFF, 0xFF, 0xFF } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(0, rtarget.Type());
Expand All @@ -53,7 +53,7 @@ TEST_F(RouteTargetTest, ByteArrayType0_4) {

TEST_F(RouteTargetTest, ByteArrayType1_1) {
RouteTarget::bytes_type data =
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x12, 0x34 } };
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x12, 0x34 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(1, rtarget.Type());
Expand All @@ -63,7 +63,7 @@ TEST_F(RouteTargetTest, ByteArrayType1_1) {

TEST_F(RouteTargetTest, ByteArrayType1_2) {
RouteTarget::bytes_type data =
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x43, 0x21 } };
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x43, 0x21 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(1, rtarget.Type());
Expand All @@ -73,7 +73,7 @@ TEST_F(RouteTargetTest, ByteArrayType1_2) {

TEST_F(RouteTargetTest, ByteArrayType1_3) {
RouteTarget::bytes_type data =
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x00, 0x00 } };
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0x00, 0x00 } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(1, rtarget.Type());
Expand All @@ -83,7 +83,7 @@ TEST_F(RouteTargetTest, ByteArrayType1_3) {

TEST_F(RouteTargetTest, ByteArrayType1_4) {
RouteTarget::bytes_type data =
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0xFF, 0xFF } };
{ { 0x01, 0x02, 0x0a, 0x01, 0x01, 0x01, 0xFF, 0xFF } };
RouteTarget rtarget(data);
EXPECT_FALSE(rtarget.IsNull());
EXPECT_EQ(1, rtarget.Type());
Expand Down
2 changes: 1 addition & 1 deletion src/bgp/test/bgp_config_listener_test.cc
Expand Up @@ -1987,7 +1987,7 @@ TEST_F(BgpConfigListenerTest, RoutingPolicyUpdate_9) {
}

//
// Validate that routing instance is added to change list when associated
// Validate that routing instance is added to change list when associated
// route-aggregate object is updated
//
TEST_F(BgpConfigListenerTest, RouteAggregate_0) {
Expand Down

0 comments on commit d9edd3c

Please sign in to comment.