Skip to content

Commit 206d6ee

Browse files
committed
client: add default value of result to connectionDecodeResponses
Somewhy we cast `nullptr` to the needed class when calling this function and it looks ugly. Let's simply set default value of `result` to `nullptr` not to pass it explicitly. Also, it will simplify the next commit - we will add another optional argument to this function.
1 parent 1458d1a commit 206d6ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Client/Connector.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Connector
9797
* Returns -1 in the case of any error, 0 on success.
9898
*/
9999
int connectionDecodeResponses(Connection<BUFFER, NetProvider> &conn,
100-
Response<BUFFER> *result);
100+
Response<BUFFER> *result = nullptr);
101101

102102
private:
103103
NetProvider m_NetProvider;
@@ -266,7 +266,7 @@ Connector<BUFFER, NetProvider>::waitAll(Connection<BUFFER, NetProvider> &conn,
266266
strerror(errno), errno);
267267
return -1;
268268
}
269-
if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0)
269+
if (connectionDecodeResponses(conn) != 0)
270270
return -1;
271271
bool finish = true;
272272
for (size_t i = last_not_ready; i < futures.size(); ++i) {
@@ -306,7 +306,7 @@ Connector<BUFFER, NetProvider>::waitAny(int timeout)
306306
}
307307
Connection<BUFFER, NetProvider> conn = *m_ReadyToDecode.begin();
308308
assert(hasDataToDecode(conn));
309-
if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0)
309+
if (connectionDecodeResponses(conn) != 0)
310310
return std::nullopt;
311311
return conn;
312312
}
@@ -325,7 +325,7 @@ Connector<BUFFER, NetProvider>::waitCount(Connection<BUFFER, NetProvider> &conn,
325325
strerror(errno), errno);
326326
return -1;
327327
}
328-
if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0)
328+
if (connectionDecodeResponses(conn) != 0)
329329
return -1;
330330
if ((conn.getFutureCount() - ready_futures) >= future_count)
331331
return 0;

0 commit comments

Comments
 (0)