Skip to content

Commit 7b5d7a7

Browse files
vivijustinemarie
authored andcommitted
Style fixes (#505)
Ran `clang-format` on all module and core files using our `.clang-format` file.
1 parent b75a71a commit 7b5d7a7

22 files changed

Lines changed: 127 additions & 148 deletions

core/bessctl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ class BESSControlImpl final : public BESSControl::Service {
15931593

15941594
bool ApiServer::grpc_cb_set_ = false;
15951595

1596-
void ApiServer::Listen(const std::string &host, int port) {
1596+
void ApiServer::Listen(const std::string& host, int port) {
15971597
if (!builder_) {
15981598
builder_ = new grpc::ServerBuilder();
15991599
}

core/bessctl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <string>
55

66
namespace grpc {
7-
class ServerBuilder;
7+
class ServerBuilder;
88
} // namespace grpc
99

1010
// gRPC server encapsulation. Usage:
@@ -17,8 +17,8 @@ class ApiServer {
1717
ApiServer() : builder_(nullptr) {}
1818

1919
// This class is neither copyable nor movable.
20-
ApiServer(const ApiServer&) = delete;
21-
ApiServer& operator=(const ApiServer&) = delete;
20+
ApiServer(const ApiServer &) = delete;
21+
ApiServer &operator=(const ApiServer &) = delete;
2222

2323
// Adds a host:port pair. host can be an ipv6 address.
2424
void Listen(const std::string &host, int port);

core/dpdk.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int determine_default_core() {
157157
int ret = pthread_getaffinity_np(pthread_self(), sizeof(set), &set);
158158
if (ret < 0) {
159159
PLOG(WARNING) << "pthread_getaffinity_np()";
160-
return 0; // Core 0 as a fallback
160+
return 0; // Core 0 as a fallback
161161
}
162162

163163
// Choose the last core available

core/module.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ struct task_result {
2929
typedef uint16_t task_id_t;
3030
typedef uint64_t placement_constraint;
3131

32-
3332
using module_cmd_func_t =
3433
pb_func_t<CommandResponse, Module, google::protobuf::Any>;
3534
using module_init_func_t =

core/module_bench.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DummySourceModule : public Module {
3333

3434
RunNextModule(&batch);
3535

36-
return { .block = false, .packets = batch_size, .bits = 0 };
36+
return {.block = false, .packets = batch_size, .bits = 0};
3737
}
3838

3939
class DummyRelayModule : public Module {

core/modules/arp_responder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using bess::utils::be32_t;
1616
struct arp_entry {
1717
Ethernet::Address mac_addr;
1818
be32_t ip_addr;
19-
uint64_t time; // timestamp used to expire cache entries (in milliseconds)
19+
uint64_t time; // timestamp used to expire cache entries (in milliseconds)
2020
};
2121

2222
// ARP Responder module

core/modules/drr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct task_result DRR::RunTask(void*) {
131131
// the number of bits inserted into the packet batch
132132
uint32_t cnt = batch.cnt();
133133
uint64_t bits_retrieved = (total_bytes + cnt * kPacketOverhead) * 8;
134-
return { .block = (cnt == 0), .packets = cnt, .bits = bits_retrieved };
134+
return {.block = (cnt == 0), .packets = cnt, .bits = bits_retrieved};
135135
}
136136

137137
uint32_t DRR::GetNextBatch(bess::PacketBatch* batch, int* err) {

core/modules/flowgen.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,9 @@ struct task_result FlowGen::RunTask(void *) {
486486
RunNextModule(&batch);
487487

488488
uint32_t cnt = batch.cnt();
489-
return {
490-
.block = (cnt == 0),
491-
.packets = cnt,
492-
.bits = ((template_size_ + pkt_overhead) * cnt) * 8
493-
};
489+
return {.block = (cnt == 0),
490+
.packets = cnt,
491+
.bits = ((template_size_ + pkt_overhead) * cnt) * 8};
494492
}
495493

496494
std::string FlowGen::GetDesc() const {

core/modules/nat.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ NAT::HashTable::Entry *NAT::CreateNewEntry(const Endpoint &src_internal,
125125
src_external.port = be16_t(port);
126126
auto *hash_reverse = map_.Find(src_external);
127127
if (hash_reverse == nullptr) {
128-
found:
128+
found:
129129
// Found an available src_internal <-> src_external mapping
130130
NatEntry forward_entry;
131131
NatEntry reverse_entry;

core/modules/noop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CommandResponse NoOP::Init(const bess::pb::EmptyArg &) {
1111
}
1212

1313
struct task_result NoOP::RunTask(void *) {
14-
return { .block = false, .packets = 0, .bits = 0 };
14+
return {.block = false, .packets = 0, .bits = 0};
1515
}
1616

1717
ADD_MODULE(NoOP, "noop", "creates a task that does nothing")

0 commit comments

Comments
 (0)