Skip to content

Commit a9a5cf0

Browse files
committed
rename
1 parent 8f8e332 commit a9a5cf0

35 files changed

+534
-535
lines changed

php_swoole.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ extern swoole_object_array swoole_objects;
114114
#define SW_CHECK_RETURN(s) if(s<0){RETURN_FALSE;}else{RETURN_TRUE;}
115115
#define SW_LOCK_CHECK_RETURN(s) if(s==0){RETURN_TRUE;}else{zend_update_property_long(NULL,getThis(),SW_STRL("errCode"),s);RETURN_FALSE;}
116116

117-
#define swoole_php_fatal_error(level, fmt_str, ...) \
117+
#define php_swoole_fatal_error(level, fmt_str, ...) \
118118
php_error_docref(NULL, level, (const char *) (fmt_str), ##__VA_ARGS__)
119119

120-
#define swoole_php_error(level, fmt_str, ...) \
120+
#define php_swoole_error(level, fmt_str, ...) \
121121
if (SWOOLE_G(display_errors) || level == E_ERROR) \
122-
swoole_php_fatal_error(level, fmt_str, ##__VA_ARGS__)
122+
php_swoole_fatal_error(level, fmt_str, ##__VA_ARGS__)
123123

124-
#define swoole_php_sys_error(level, fmt_str, ...) \
125-
swoole_php_error(level, fmt_str ", Error: %s[%d]", ##__VA_ARGS__, strerror(errno), errno)
124+
#define php_swoole_sys_error(level, fmt_str, ...) \
125+
php_swoole_error(level, fmt_str ", Error: %s[%d]", ##__VA_ARGS__, strerror(errno), errno)
126126

127127
#ifdef SW_USE_OPENSSL
128128
#ifndef HAVE_OPENSSL
@@ -450,8 +450,6 @@ ssize_t php_swoole_length_func(swProtocol *protocol, swConnection *conn, char *d
450450
int php_swoole_client_onPackage(swConnection *conn, char *data, uint32_t length);
451451
zend_bool php_swoole_signal_isset_handler(int signo);
452452

453-
int php_coroutine_reactor_can_exit(swReactor *reactor);
454-
455453
#ifdef SW_USE_OPENSSL
456454
void php_swoole_client_check_ssl_setting(swClient *cli, zval *zset);
457455
#endif
@@ -1149,16 +1147,15 @@ static sw_inline void sw_zend_fci_cache_free(void* fci_cache)
11491147
}
11501148

11511149
//----------------------------------Misc API------------------------------------
1152-
1153-
static sw_inline char* sw_php_format_date(char *format, size_t format_len, time_t ts, int localtime)
1150+
static sw_inline char* php_swoole_format_date(char *format, size_t format_len, time_t ts, int localtime)
11541151
{
11551152
zend_string *time = php_format_date(format, format_len, ts, localtime);
11561153
char *return_str = estrndup(ZSTR_VAL(time), ZSTR_LEN(time));
11571154
zend_string_release(time);
11581155
return return_str;
11591156
}
11601157

1161-
static sw_inline char* sw_php_url_encode(char *value, size_t value_len, int* exten)
1158+
static sw_inline char* php_swoole_url_encode(char *value, size_t value_len, int* exten)
11621159
{
11631160
zend_string *str = php_url_encode(value, value_len);
11641161
*exten = ZSTR_LEN(str);
@@ -1167,7 +1164,7 @@ static sw_inline char* sw_php_url_encode(char *value, size_t value_len, int* ext
11671164
return return_str;
11681165
}
11691166

1170-
static sw_inline char* sw_http_build_query(zval *zdata, size_t *length, smart_str *formstr)
1167+
static sw_inline char* php_swoole_http_build_query(zval *zdata, size_t *length, smart_str *formstr)
11711168
{
11721169
if (php_url_encode_hash_ex(HASH_OF(zdata), formstr, NULL, 0, NULL, 0, NULL, 0, NULL, NULL, (int) PHP_QUERY_RFC1738) == FAILURE)
11731170
{
@@ -1186,7 +1183,7 @@ static sw_inline char* sw_http_build_query(zval *zdata, size_t *length, smart_st
11861183
return formstr->s->val;
11871184
}
11881185

1189-
static sw_inline zend_string* sw_get_debug_print_backtrace(zend_long options, zend_long limit)
1186+
static sw_inline zend_string* php_swoole_get_debug_print_backtrace(zend_long options, zend_long limit)
11901187
{
11911188
SW_PHP_OB_START(zoutput) {
11921189
zval fcn, args[2];
@@ -1195,7 +1192,8 @@ static sw_inline zend_string* sw_get_debug_print_backtrace(zend_long options, ze
11951192
ZVAL_LONG(&args[1], limit);
11961193
sw_zend_call_function_ex(&fcn, NULL, 2, args, &zoutput);
11971194
zval_ptr_dtor(&fcn);
1198-
} SW_PHP_OB_END();
1195+
}
1196+
SW_PHP_OB_END();
11991197
if (UNEXPECTED(Z_TYPE_P(&zoutput) != IS_STRING))
12001198
{
12011199
return NULL;

swoole.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static sw_inline uint32_t swoole_get_new_size(uint32_t old_size, int handle)
186186
uint32_t new_size = old_size * 2;
187187
if (handle > SWOOLE_OBJECT_MAX)
188188
{
189-
swoole_php_fatal_error(E_ERROR, "handle %d exceed %d", handle, SWOOLE_OBJECT_MAX);
189+
php_swoole_fatal_error(E_ERROR, "handle %d exceed %d", handle, SWOOLE_OBJECT_MAX);
190190
return 0;
191191
}
192192
while (new_size <= (uint32_t) handle)
@@ -215,7 +215,7 @@ void swoole_set_object_by_handle(uint32_t handle, void *ptr)
215215
new_ptr = sw_realloc(old_ptr, sizeof(void*) * new_size);
216216
if (!new_ptr)
217217
{
218-
swoole_php_fatal_error(E_ERROR, "malloc(%d) failed", (int )(new_size * sizeof(void *)));
218+
php_swoole_fatal_error(E_ERROR, "malloc(%d) failed", (int )(new_size * sizeof(void *)));
219219
return;
220220
}
221221
bzero((char*) new_ptr + (old_size * sizeof(void*)), (new_size - old_size) * sizeof(void*));
@@ -256,7 +256,7 @@ void swoole_set_property_by_handle(uint32_t handle, int property_id, void *ptr)
256256
}
257257
if (new_ptr == NULL)
258258
{
259-
swoole_php_fatal_error(E_ERROR, "malloc(%d) failed", (int )(new_size * sizeof(void *)));
259+
php_swoole_fatal_error(E_ERROR, "malloc(%d) failed", (int )(new_size * sizeof(void *)));
260260
return;
261261
}
262262
if (old_size > 0)
@@ -657,7 +657,7 @@ PHP_MINIT_FUNCTION(swoole)
657657
swoole_objects.array = (void**) sw_calloc(swoole_objects.size, sizeof(void*));
658658
if (!swoole_objects.array)
659659
{
660-
swoole_php_fatal_error(E_ERROR, "malloc([swoole_objects]) failed");
660+
php_swoole_fatal_error(E_ERROR, "malloc([swoole_objects]) failed");
661661
exit(253);
662662
}
663663

@@ -963,7 +963,7 @@ PHP_FUNCTION(swoole_set_process_name)
963963
ZEND_STRL("cli_set_process_title"));
964964
if (!cli_set_process_title)
965965
{
966-
swoole_php_fatal_error(E_WARNING, "swoole_set_process_name only support in CLI mode");
966+
php_swoole_fatal_error(E_WARNING, "swoole_set_process_name only support in CLI mode");
967967
RETURN_FALSE;
968968
}
969969
cli_set_process_title->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -978,7 +978,7 @@ PHP_FUNCTION(swoole_get_local_ip)
978978

979979
if (getifaddrs(&ipaddrs) != 0)
980980
{
981-
swoole_php_sys_error(E_WARNING, "getifaddrs() failed");
981+
php_swoole_sys_error(E_WARNING, "getifaddrs() failed");
982982
RETURN_FALSE;
983983
}
984984
array_init(return_value);
@@ -1031,7 +1031,7 @@ PHP_FUNCTION(swoole_get_local_mac)
10311031

10321032
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
10331033
{
1034-
swoole_php_sys_error(E_WARNING, "new socket failed");
1034+
php_swoole_sys_error(E_WARNING, "new socket failed");
10351035
RETURN_FALSE;
10361036
}
10371037
array_init(return_value);

swoole_async_coro.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ PHP_FUNCTION(swoole_async_set)
195195
{
196196
if (SwooleG.main_reactor != NULL)
197197
{
198-
swoole_php_fatal_error(E_ERROR, "eventLoop has already been created. unable to change settings");
198+
php_swoole_fatal_error(E_ERROR, "eventLoop has already been created. unable to change settings");
199199
RETURN_FALSE;
200200
}
201201

@@ -288,13 +288,13 @@ PHP_FUNCTION(swoole_async_dns_lookup_coro)
288288

289289
if (Z_TYPE_P(domain) != IS_STRING)
290290
{
291-
swoole_php_fatal_error(E_WARNING, "invalid domain name");
291+
php_swoole_fatal_error(E_WARNING, "invalid domain name");
292292
RETURN_FALSE;
293293
}
294294

295295
if (Z_STRLEN_P(domain) == 0)
296296
{
297-
swoole_php_fatal_error(E_WARNING, "domain name empty");
297+
php_swoole_fatal_error(E_WARNING, "domain name empty");
298298
RETURN_FALSE;
299299
}
300300

swoole_buffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void swoole_buffer_recycle(swString *buffer)
9999

100100
static PHP_METHOD(swoole_buffer, __construct)
101101
{
102-
swoole_php_fatal_error(
102+
php_swoole_fatal_error(
103103
E_DEPRECATED, "Class %s is deprecated, it will be removed in v4.5.0",
104104
ZSTR_VAL(swoole_buffer_ce->name)
105105
);
@@ -212,7 +212,7 @@ static PHP_METHOD(swoole_buffer, substr)
212212
}
213213
if (length + offset > buffer->length)
214214
{
215-
swoole_php_error(E_WARNING, "offset(" ZEND_LONG_FMT ", " ZEND_LONG_FMT ") is out of bounds", offset, length);
215+
php_swoole_error(E_WARNING, "offset(" ZEND_LONG_FMT ", " ZEND_LONG_FMT ") is out of bounds", offset, length);
216216
RETURN_FALSE;
217217
}
218218
if (remove)

swoole_channel_coro.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static sw_inline Channel * swoole_get_channel(zval *zobject)
8787
Channel *chan = swoole_channel_coro_fetch_object(Z_OBJ_P(zobject))->chan;
8888
if (UNEXPECTED(!chan))
8989
{
90-
swoole_php_fatal_error(E_ERROR, "you must call Channel constructor first");
90+
php_swoole_fatal_error(E_ERROR, "you must call Channel constructor first");
9191
}
9292
return chan;
9393
}

0 commit comments

Comments
 (0)