[Lldb-commits] [PATCH] D131543: [LLDB][NFC] Fix the style issue in TCPSocket

Slava Gurevich via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 18:02:13 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG256ba7738ea8: [LLDB][NFC] Fix the style issue in TCPSocket (authored by fixathon).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131543/new/

https://reviews.llvm.org/D131543

Files:
  lldb/source/Host/common/TCPSocket.cpp


Index: lldb/source/Host/common/TCPSocket.cpp
===================================================================
--- lldb/source/Host/common/TCPSocket.cpp
+++ lldb/source/Host/common/TCPSocket.cpp
@@ -167,14 +167,14 @@
 
     address.SetPort(host_port->port);
 
-    if (-1 == llvm::sys::RetryAfterSignal(-1, ::connect, GetNativeSocket(),
-                                          &address.sockaddr(),
-                                          address.GetLength())) {
+    if (llvm::sys::RetryAfterSignal(-1, ::connect, GetNativeSocket(),
+                                    &address.sockaddr(),
+                                    address.GetLength()) == -1) {
       Close();
       continue;
     }
 
-    if (-1 == SetOptionNoDelay()) {
+    if (SetOptionNoDelay() == -1) {
       Close();
       continue;
     }
@@ -210,8 +210,8 @@
     int option_value = 1;
     set_socket_option_arg_type option_value_p =
         reinterpret_cast<set_socket_option_arg_type>(&option_value);
-    if (-1 == ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
-                           sizeof(option_value))) {
+    if (::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
+                     sizeof(option_value)) == -1) {
       CLOSE_SOCKET(fd);
       continue;
     }
@@ -224,10 +224,10 @@
 
     int err =
         ::bind(fd, &listen_address.sockaddr(), listen_address.GetLength());
-    if (-1 != err)
+    if (err != -1)
       err = ::listen(fd, backlog);
 
-    if (-1 == err) {
+    if (err == -1) {
       error = GetLastSocketError();
       CLOSE_SOCKET(fd);
       continue;
@@ -294,7 +294,7 @@
 
     lldb_private::SocketAddress &AddrIn = m_listen_sockets[listen_sock];
     if (!AddrIn.IsAnyAddr() && AcceptAddr != AddrIn) {
-      if (kInvalidSocketValue != sock) {
+      if (sock != kInvalidSocketValue) {
         CLOSE_SOCKET(sock);
         sock = kInvalidSocketValue;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131543.452046.patch
Type: text/x-patch
Size: 1913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220812/42355246/attachment.bin>


More information about the lldb-commits mailing list