com php-src: - Remove dead macrom mysql_list_fields() - Small optimizations here and there: ext/mysq lnd/mysqlnd.h ext/mysqlnd/mysqlnd_connection.c
ext/my sqlnd/mysqlnd_libmysql_compat.h ext/mysqlnd/mysqlnd_s tructs.h
| From: | Andrey Hristov | Date: | Mon, 16 Nov 2015 10:55:46 +0000 |
| Subject: | com php-src: - Remove dead macrom mysql_list_fields() - Small optimizations here and there: ext/mysq lnd/mysqlnd.h ext/mysqlnd/mysqlnd_connection.c ext/my sqlnd/mysqlnd_libmysql_compat.h ext/mysqlnd/mysqlnd_s tructs.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89869@lists.php.net to get a copy of this message | ||
Commit: 398caf9336a5f6a71439969c7fd610bfaf522b93
Author: Andrey Hristov <andrey@php.net> Fri, 13 Nov 2015 08:54:23 +0100
Parents: f5be26e04b6de8e00572c671322853ee71a81643
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=398caf9336a5f6a71439969c7fd610bfaf522b93
Log:
- Remove dead macrom mysql_list_fields()
- Small optimizations here and there
Changed paths:
M ext/mysqlnd/mysqlnd.h
M ext/mysqlnd/mysqlnd_connection.c
M ext/mysqlnd/mysqlnd_libmysql_compat.h
M ext/mysqlnd/mysqlnd_structs.h
Diff:
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index 849ac99..ab6955c 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -199,7 +199,6 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn);
#define mysqlnd_savepoint(conn, name) ((conn)->data)->m->tx_savepoint((conn)->data,
(name))
#define mysqlnd_release_savepoint(conn, name)
((conn)->data)->m->tx_savepoint_release((conn)->data, (name))
#define mysqlnd_list_dbs(conn, wild) ((conn)->data)->m->list_method((conn)->data,
wild? "SHOW DATABASES LIKE %s":"SHOW DATABASES", (wild), NULL)
-#define mysqlnd_list_fields(conn,
tab,wild) ((conn)->data)->m->list_fields((conn)->data, (tab), (wild))
#define mysqlnd_list_processes(conn) ((conn)->data)->m->list_method((conn)->data,
"SHOW PROCESSLIST", NULL, NULL)
#define mysqlnd_list_tables(conn, wild) ((conn)->data)->m->list_method((conn)->data,
wild? "SHOW TABLES LIKE %s":"SHOW TABLES", (wild), NULL)
#define
mysqlnd_dump_debug_info(conn) ((conn)->data)->m->server_dump_debug_information((conn)->data)
diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c
index fa1abfc..140073e 100644
--- a/ext/mysqlnd/mysqlnd_connection.c
+++ b/ext/mysqlnd/mysqlnd_connection.c
@@ -1398,6 +1398,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, info)(const MYSQLND_CONN_DATA * const conn)
}
/* }}} */
+
/* {{{ mysqlnd_get_client_info */
PHPAPI const char * mysqlnd_get_client_info()
{
@@ -1821,7 +1822,7 @@ end:
/* {{{ mysqlnd_conn_data::set_client_option_2d */
static enum_func_status
MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * const conn,
- enum_mysqlnd_client_option option,
+ const enum_mysqlnd_client_option option,
const char * const key,
const char * const value
)
@@ -2481,9 +2482,10 @@ MYSQLND_CLASS_METHODS_END;
#include "php_network.h"
/* {{{ mysqlnd_stream_array_to_fd_set */
-MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
+MYSQLND **
+mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
{
- int cnt = 0;
+ unsigned int cnt = 0;
MYSQLND **p = conn_array, **p_p;
MYSQLND **ret = NULL;
@@ -2517,7 +2519,8 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array)
/* {{{ mysqlnd_stream_array_to_fd_set */
-static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t *
max_fd)
+static unsigned int
+mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd)
{
php_socket_t this_fd;
php_stream *stream = NULL;
@@ -2533,17 +2536,19 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set *
fds, p
* */
stream = (*p)->data->vio->data->m.get_stream((*p)->data->vio);
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
- if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT |
PHP_STREAM_CAST_INTERNAL,
- (void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
+ if (stream != NULL &&
+ SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) &&
+ ZEND_VALID_SOCKET(this_fd))
+ {
PHP_SAFE_FD_SET(this_fd, fds);
if (this_fd > *max_fd) {
*max_fd = this_fd;
}
- cnt++;
+ ++cnt;
}
- p++;
+ ++p;
}
DBG_RETURN(cnt ? 1 : 0);
}
@@ -2551,11 +2556,12 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set *
fds, p
/* {{{ mysqlnd_stream_array_from_fd_set */
-static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
+static unsigned int
+mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds)
{
php_socket_t this_fd;
php_stream *stream = NULL;
- int ret = 0;
+ unsigned int ret = 0;
zend_bool disproportion = FALSE;
MYSQLND **fwd = conn_array, **bckwd = conn_array;
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)
if (disproportion) {
*bckwd = *fwd;
}
- bckwd++;
- fwd++;
- ret++;
+ ++bckwd;
+ ++fwd;
+ ++ret;
continue;
}
}
disproportion = TRUE;
- fwd++;
+ ++fwd;
}
*bckwd = NULL;/* NULL-terminate the list */
diff --git a/ext/mysqlnd/mysqlnd_libmysql_compat.h b/ext/mysqlnd/mysqlnd_libmysql_compat.h
index 5a13088..a7d9882 100644
--- a/ext/mysqlnd/mysqlnd_libmysql_compat.h
+++ b/ext/mysqlnd/mysqlnd_libmysql_compat.h
@@ -62,7 +62,6 @@
#define mysql_insert_id(r) mysqlnd_insert_id((r))
#define mysql_kill(r,n) mysqlnd_kill((r), (n))
#define mysql_list_dbs(c, wild) mysqlnd_list_dbs((c), (wild))
-#define mysql_list_fields(c, tab, wild) mysqlnd_list_fields((c), (tab), (wild))
#define mysql_list_processes(c) mysqlnd_list_processes((c))
#define mysql_list_tables(c, wild) mysqlnd_list_tables((c), (wild))
#define mysql_more_results(r) mysqlnd_more_results((r))
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index 62cd644..0a0745d 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.h
@@ -91,7 +91,7 @@ typedef struct st_mysqlnd_field
const char *org_table; /* Org table name, if table was an alias */
const char *db; /* Database for table */
const char *catalog; /* Catalog for table */
- char *def; /* Default value (set by mysql_list_fields) */
+ char *def; /* Default value */
zend_ulong length; /* Width of column (create length) */
zend_ulong max_length; /* Max width for selected set */
unsigned int name_length;
@@ -466,7 +466,7 @@ typedef unsigned int (*func_mysqlnd_conn_data__get_updated_connect_flags)(MYSQL
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);
typedef struct st_mysqlnd_authentication_plugin *
(*func_mysqlnd_conn_data__fetch_auth_plugin_by_name)(const char * const requested_protocol);
-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);
+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);
typedef size_t (*func_mysqlnd_conn_data__negotiate_client_api_capabilities)(MYSQLND_CONN_DATA *
const conn, const size_t flags);