Skip to content

Commit 398caf9

Browse files
committed
- Remove dead macrom mysql_list_fields()
- Small optimizations here and there
1 parent f5be26e commit 398caf9

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

ext/mysqlnd/mysqlnd.h

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn);
199199
#define mysqlnd_savepoint(conn, name) ((conn)->data)->m->tx_savepoint((conn)->data, (name))
200200
#define mysqlnd_release_savepoint(conn, name) ((conn)->data)->m->tx_savepoint_release((conn)->data, (name))
201201
#define mysqlnd_list_dbs(conn, wild) ((conn)->data)->m->list_method((conn)->data, wild? "SHOW DATABASES LIKE %s":"SHOW DATABASES", (wild), NULL)
202-
#define mysqlnd_list_fields(conn, tab,wild) ((conn)->data)->m->list_fields((conn)->data, (tab), (wild))
203202
#define mysqlnd_list_processes(conn) ((conn)->data)->m->list_method((conn)->data, "SHOW PROCESSLIST", NULL, NULL)
204203
#define mysqlnd_list_tables(conn, wild) ((conn)->data)->m->list_method((conn)->data, wild? "SHOW TABLES LIKE %s":"SHOW TABLES", (wild), NULL)
205204
#define mysqlnd_dump_debug_info(conn) ((conn)->data)->m->server_dump_debug_information((conn)->data)

ext/mysqlnd/mysqlnd_connection.c

+20-14
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, info)(const MYSQLND_CONN_DATA * const conn)
13981398
}
13991399
/* }}} */
14001400

1401+
14011402
/* {{{ mysqlnd_get_client_info */
14021403
PHPAPI const char * mysqlnd_get_client_info()
14031404
{
@@ -1821,7 +1822,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
18211822
/* {{{ mysqlnd_conn_data::set_client_option_2d */
18221823
static enum_func_status
18231824
MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * const conn,
1824-
enum_mysqlnd_client_option option,
1825+
const enum_mysqlnd_client_option option,
18251826
const char * const key,
18261827
const char * const value
18271828
)
@@ -2481,9 +2482,10 @@ MYSQLND_CLASS_METHODS_END;
24812482
#include "php_network.h"
24822483

24832484
/* {{{ mysqlnd_stream_array_to_fd_set */
2484-
MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
2485+
MYSQLND **
2486+
mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
24852487
{
2486-
int cnt = 0;
2488+
unsigned int cnt = 0;
24872489
MYSQLND **p = conn_array, **p_p;
24882490
MYSQLND **ret = NULL;
24892491

@@ -2517,7 +2519,8 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
25172519

25182520

25192521
/* {{{ mysqlnd_stream_array_to_fd_set */
2520-
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd)
2522+
static unsigned int
2523+
mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd)
25212524
{
25222525
php_socket_t this_fd;
25232526
php_stream *stream = NULL;
@@ -2533,29 +2536,32 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
25332536
* */
25342537
stream = (*p)->data->vio->data->m.get_stream((*p)->data->vio);
25352538
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
2536-
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
2537-
(void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
2539+
if (stream != NULL &&
2540+
SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) &&
2541+
ZEND_VALID_SOCKET(this_fd))
2542+
{
25382543

25392544
PHP_SAFE_FD_SET(this_fd, fds);
25402545

25412546
if (this_fd > *max_fd) {
25422547
*max_fd = this_fd;
25432548
}
2544-
cnt++;
2549+
++cnt;
25452550
}
2546-
p++;
2551+
++p;
25472552
}
25482553
DBG_RETURN(cnt ? 1 : 0);
25492554
}
25502555
/* }}} */
25512556

25522557

25532558
/* {{{ mysqlnd_stream_array_from_fd_set */
2554-
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
2559+
static unsigned int
2560+
mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
25552561
{
25562562
php_socket_t this_fd;
25572563
php_stream *stream = NULL;
2558-
int ret = 0;
2564+
unsigned int ret = 0;
25592565
zend_bool disproportion = FALSE;
25602566
MYSQLND **fwd = conn_array, **bckwd = conn_array;
25612567
DBG_ENTER("mysqlnd_stream_array_from_fd_set");
@@ -2569,14 +2575,14 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
25692575
if (disproportion) {
25702576
*bckwd = *fwd;
25712577
}
2572-
bckwd++;
2573-
fwd++;
2574-
ret++;
2578+
++bckwd;
2579+
++fwd;
2580+
++ret;
25752581
continue;
25762582
}
25772583
}
25782584
disproportion = TRUE;
2579-
fwd++;
2585+
++fwd;
25802586
}
25812587
*bckwd = NULL;/* NULL-terminate the list */
25822588

ext/mysqlnd/mysqlnd_libmysql_compat.h

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
#define mysql_insert_id(r) mysqlnd_insert_id((r))
6363
#define mysql_kill(r,n) mysqlnd_kill((r), (n))
6464
#define mysql_list_dbs(c, wild) mysqlnd_list_dbs((c), (wild))
65-
#define mysql_list_fields(c, tab, wild) mysqlnd_list_fields((c), (tab), (wild))
6665
#define mysql_list_processes(c) mysqlnd_list_processes((c))
6766
#define mysql_list_tables(c, wild) mysqlnd_list_tables((c), (wild))
6867
#define mysql_more_results(r) mysqlnd_more_results((r))

ext/mysqlnd/mysqlnd_structs.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ typedef struct st_mysqlnd_field
9191
const char *org_table; /* Org table name, if table was an alias */
9292
const char *db; /* Database for table */
9393
const char *catalog; /* Catalog for table */
94-
char *def; /* Default value (set by mysql_list_fields) */
94+
char *def; /* Default value */
9595
zend_ulong length; /* Width of column (create length) */
9696
zend_ulong max_length; /* Max width for selected set */
9797
unsigned int name_length;
@@ -466,7 +466,7 @@ typedef unsigned int (*func_mysqlnd_conn_data__get_updated_connect_flags)(MYSQL
466466
typedef enum_func_status (*func_mysqlnd_conn_data__connect_handshake)(MYSQLND_CONN_DATA * conn, const MYSQLND_CSTRING * const scheme, const MYSQLND_CSTRING * const username, const MYSQLND_CSTRING * const password, const MYSQLND_CSTRING * const database, const unsigned int mysql_flags);
467467
typedef struct st_mysqlnd_authentication_plugin * (*func_mysqlnd_conn_data__fetch_auth_plugin_by_name)(const char * const requested_protocol);
468468

469-
typedef enum_func_status (*func_mysqlnd_conn_data__set_client_option_2d)(MYSQLND_CONN_DATA * const conn, enum_mysqlnd_client_option option, const char * const key, const char * const value);
469+
typedef enum_func_status (*func_mysqlnd_conn_data__set_client_option_2d)(MYSQLND_CONN_DATA * const conn, const enum_mysqlnd_client_option option, const char * const key, const char * const value);
470470

471471

472472
typedef size_t (*func_mysqlnd_conn_data__negotiate_client_api_capabilities)(MYSQLND_CONN_DATA * const conn, const size_t flags);

0 commit comments

Comments
 (0)