Skip to content

Commit ffe44b7

Browse files
committed
optimize code
1 parent eafe737 commit ffe44b7

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

ext-src/php_swoole.cc

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ END_EXTERN_C()
5959
#include <arpa/inet.h>
6060
#include <net/if.h>
6161
#include <ifaddrs.h>
62+
#include <sys/ioctl.h>
6263
#endif
6364

6465
#ifdef SW_USE_CURL
@@ -69,10 +70,6 @@ END_EXTERN_C()
6970
#include <net/if_dl.h>
7071
#endif
7172

72-
#ifdef __linux__
73-
#include <sys/ioctl.h>
74-
#endif
75-
7673
#ifdef SW_HAVE_ZLIB
7774
#include <zlib.h>
7875
#endif
@@ -962,17 +959,6 @@ PHP_MINIT_FUNCTION(swoole) {
962959
#endif
963960
SW_REGISTER_LONG_CONSTANT("SWOOLE_IPC_SOCKET", SW_IPC_SOCKET);
964961

965-
/**
966-
* server mode (SWOOLE_PROCESS not available on WIN32)
967-
*/
968-
SW_REGISTER_LONG_CONSTANT("SWOOLE_BASE", swoole::Server::MODE_BASE);
969-
#ifndef _WIN32
970-
SW_REGISTER_LONG_CONSTANT("SWOOLE_PROCESS", swoole::Server::MODE_PROCESS);
971-
#endif
972-
#ifdef SW_THREAD
973-
SW_REGISTER_LONG_CONSTANT("SWOOLE_THREAD", swoole::Server::MODE_THREAD);
974-
#endif
975-
976962
/**
977963
* limit
978964
*/
@@ -1053,13 +1039,15 @@ PHP_MINIT_FUNCTION(swoole) {
10531039
#ifndef _WIN32
10541040
php_swoole_server_minit(module_number);
10551041
php_swoole_server_port_minit(module_number);
1056-
php_swoole_redis_server_minit(module_number);
1057-
php_swoole_http_server_minit(module_number);
10581042
#endif
10591043
php_swoole_http_request_minit(module_number);
10601044
php_swoole_http_response_minit(module_number);
10611045
php_swoole_http_cookie_minit(module_number);
1046+
#ifndef _WIN32
1047+
php_swoole_http_server_minit(module_number);
10621048
php_swoole_websocket_server_minit(module_number);
1049+
php_swoole_redis_server_minit(module_number);
1050+
#endif
10631051
php_swoole_http_server_coro_minit(module_number);
10641052
php_swoole_name_resolver_minit(module_number);
10651053
#ifdef SW_USE_PGSQL
@@ -1733,6 +1721,7 @@ static PHP_FUNCTION(swoole_get_local_ip) {
17331721
if (ifa->ifa_addr == nullptr || !(ifa->ifa_flags & IFF_UP)) {
17341722
continue;
17351723
}
1724+
17361725
if (ifa->ifa_addr->sa_family != family) {
17371726
continue;
17381727
}

0 commit comments

Comments
 (0)