diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /drivers/unix/tcp_server_posix.cpp | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
download | redot-engine-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'drivers/unix/tcp_server_posix.cpp')
-rw-r--r-- | drivers/unix/tcp_server_posix.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp index 7e9970453f..9049faebb8 100644 --- a/drivers/unix/tcp_server_posix.cpp +++ b/drivers/unix/tcp_server_posix.cpp @@ -33,32 +33,32 @@ #include <poll.h> +#include <errno.h> +#include <netdb.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> -#include <errno.h> #include <string.h> -#include <netdb.h> #include <sys/types.h> +#include <unistd.h> #ifndef NO_FCNTL - #ifdef __HAIKU__ - #include <fcntl.h> - #else - #include <sys/fcntl.h> - #endif +#ifdef __HAIKU__ +#include <fcntl.h> +#else +#include <sys/fcntl.h> +#endif #else #include <sys/ioctl.h> #endif #ifdef JAVASCRIPT_ENABLED #include <arpa/inet.h> #endif +#include <assert.h> #include <netinet/in.h> #include <sys/socket.h> -#include <assert.h> #include "drivers/unix/socket_helpers.h" -TCP_Server* TCPServerPosix::_create() { +TCP_Server *TCPServerPosix::_create() { return memnew(TCPServerPosix); }; @@ -68,9 +68,9 @@ void TCPServerPosix::make_default() { TCP_Server::_create = TCPServerPosix::_create; }; -Error TCPServerPosix::listen(uint16_t p_port,const IP_Address p_bind_address) { +Error TCPServerPosix::listen(uint16_t p_port, const IP_Address p_bind_address) { - ERR_FAIL_COND_V(listen_sockfd!=-1,ERR_ALREADY_IN_USE); + ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); int sockfd; @@ -95,8 +95,8 @@ Error TCPServerPosix::listen(uint16_t p_port,const IP_Address p_bind_address) { ioctl(sockfd, FIONBIO, &bval); #endif - int reuse=1; - if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) { + int reuse = 1; + if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) { WARN_PRINT("REUSEADDR failed!") } @@ -110,8 +110,7 @@ Error TCPServerPosix::listen(uint16_t p_port,const IP_Address p_bind_address) { close(sockfd); ERR_FAIL_V(FAILED); }; - } - else { + } else { return ERR_ALREADY_IN_USE; }; @@ -177,14 +176,13 @@ void TCPServerPosix::stop() { if (listen_sockfd != -1) { int ret = close(listen_sockfd); - ERR_FAIL_COND(ret!=0); + ERR_FAIL_COND(ret != 0); }; listen_sockfd = -1; sock_type = IP::TYPE_NONE; }; - TCPServerPosix::TCPServerPosix() { listen_sockfd = -1; |