Skip to content

Commit 23a8ed0

Browse files
committed
clang-format
1 parent 97c8507 commit 23a8ed0

File tree

6 files changed

+27
-39
lines changed

6 files changed

+27
-39
lines changed

.clang-format

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AllowShortLoopsOnASingleLine: false
1717
AlwaysBreakAfterDefinitionReturnType: None
1818
AlwaysBreakAfterReturnType: None
1919
AlwaysBreakBeforeMultilineStrings: true
20-
AlwaysBreakTemplateDeclarations: Yes
20+
AlwaysBreakTemplateDeclarations: true
2121
BinPackArguments: false
2222
BinPackParameters: false
2323
BraceWrapping:
@@ -86,13 +86,13 @@ ObjCBlockIndentWidth: 2
8686
ObjCSpaceAfterProperty: false
8787
ObjCSpaceBeforeProtocolList: true
8888
PenaltyBreakAssignment: 2
89-
PenaltyBreakBeforeFirstCallParameter: 10000
89+
PenaltyBreakBeforeFirstCallParameter: 100
9090
PenaltyBreakComment: 300
9191
PenaltyBreakFirstLessLess: 120
9292
PenaltyBreakString: 1000
9393
PenaltyBreakTemplateDeclaration: 10
94-
PenaltyExcessCharacter: 10000
95-
PenaltyReturnTypeOnItsOwnLine: 200
94+
PenaltyExcessCharacter: 1000000
95+
PenaltyReturnTypeOnItsOwnLine: 2000
9696
PointerAlignment: Left
9797
RawStringFormats:
9898
- Language: Cpp

trantor/net/TcpClient.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,8 @@ void TcpClient::newConnection(int sockfd)
152152
std::shared_ptr<TcpConnectionImpl> conn;
153153
if (_sslCtxPtr)
154154
{
155-
conn = std::make_shared<SSLConnection>(_loop,
156-
sockfd,
157-
localAddr,
158-
peerAddr,
159-
_sslCtxPtr,
160-
false);
155+
conn = std::make_shared<SSLConnection>(
156+
_loop, sockfd, localAddr, peerAddr, _sslCtxPtr, false);
161157
}
162158
else
163159
{

trantor/net/TcpServer.cc

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,12 @@ void TcpServer::newConnection(int sockfd, const InetAddress &peer)
8282
}
8383
else
8484
{
85-
newPtr = std::make_shared<TcpConnectionImpl>(ioLoop,
86-
sockfd,
87-
InetAddress(
88-
Socket::getLocalAddr(
89-
sockfd)),
90-
peer);
85+
newPtr = std::make_shared<TcpConnectionImpl>(
86+
ioLoop, sockfd, InetAddress(Socket::getLocalAddr(sockfd)), peer);
9187
}
9288
#else
93-
auto newPtr =
94-
std::make_shared<TcpConnectionImpl>(ioLoop,
95-
sockfd,
96-
InetAddress(
97-
Socket::getLocalAddr(sockfd)),
98-
peer);
89+
auto newPtr = std::make_shared<TcpConnectionImpl>(
90+
ioLoop, sockfd, InetAddress(Socket::getLocalAddr(sockfd)), peer);
9991
#endif
10092

10193
if (_idleTimeout > 0)

trantor/net/inner/TcpConnectionImpl.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ void TcpConnectionImpl::writeCallback()
167167
if (_writeBufferList.front()->_sendFd < 0)
168168
{
169169
// There is data to be sent in the buffer.
170-
auto n = writeInLoop(_writeBufferList.front()
171-
->_msgBuffer->peek(),
172-
_writeBufferList.front()
173-
->_msgBuffer->readableBytes());
170+
auto n = writeInLoop(
171+
_writeBufferList.front()->_msgBuffer->peek(),
172+
_writeBufferList.front()
173+
->_msgBuffer->readableBytes());
174174
_writeBufferList.front()->_msgBuffer->retrieve(n);
175175
if (n >= 0)
176176
{
@@ -348,9 +348,9 @@ void TcpConnectionImpl::sendInLoop(const char *buffer, size_t length)
348348
_writeBufferList.back()->_msgBuffer->readableBytes() >
349349
_highWaterMarkLen)
350350
{
351-
_highWaterMarkCallback(shared_from_this(),
352-
_writeBufferList.back()
353-
->_msgBuffer->readableBytes());
351+
_highWaterMarkCallback(
352+
shared_from_this(),
353+
_writeBufferList.back()->_msgBuffer->readableBytes());
354354
}
355355
}
356356
}

trantor/tests/AsyncFileLoggerTest.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ int main()
77
trantor::AsyncFileLogger asyncFileLogger;
88
asyncFileLogger.setFileName("async_test");
99
asyncFileLogger.startLogging();
10-
trantor::Logger::
11-
setOutputFunction([&](const char *msg,
12-
const uint64_t
13-
len) { asyncFileLogger.output(msg, len); },
14-
[&]() { asyncFileLogger.flush(); });
10+
trantor::Logger::setOutputFunction(
11+
[&](const char *msg, const uint64_t len) {
12+
asyncFileLogger.output(msg, len);
13+
},
14+
[&]() { asyncFileLogger.flush(); });
1515
asyncFileLogger.setFileSizeLimit(100000000);
1616
// LOG_DEBUG<<"debug log!"<<1;
1717
// LOG_TRACE<<"trace log!"<<2;

trantor/tests/AsyncFileLoggerTest1.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ int main()
77
trantor::AsyncFileLogger asyncFileLogger;
88
asyncFileLogger.setFileName("async_test");
99
asyncFileLogger.startLogging();
10-
trantor::Logger::
11-
setOutputFunction([&](const char *msg,
12-
const uint64_t
13-
len) { asyncFileLogger.output(msg, len); },
14-
[&]() { asyncFileLogger.flush(); });
10+
trantor::Logger::setOutputFunction(
11+
[&](const char *msg, const uint64_t len) {
12+
asyncFileLogger.output(msg, len);
13+
},
14+
[&]() { asyncFileLogger.flush(); });
1515
asyncFileLogger.setFileSizeLimit(100000000);
1616
int i = 0;
1717
while (i < 1000000)

0 commit comments

Comments
 (0)