]> granicus.if.org Git - php/commitdiff
- Remove dead macrom mysql_list_fields()
authorAndrey Hristov <andrey@php.net>
Fri, 13 Nov 2015 07:54:23 +0000 (08:54 +0100)
committerAndrey Hristov <andrey@php.net>
Mon, 16 Nov 2015 10:55:46 +0000 (11:55 +0100)
- Small optimizations here and there

ext/mysqlnd/mysqlnd.h
ext/mysqlnd/mysqlnd_connection.c
ext/mysqlnd/mysqlnd_libmysql_compat.h
ext/mysqlnd/mysqlnd_structs.h

index 849ac990a6ac3643374f0b4f748c0467ac2ed85a..ab6955c347517056184e86f7e57a01ebc5d40a45 100644 (file)
@@ -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)
index fa1abfcd1eaf3fe73f7c52a23c995af5f69c2c8f..140073e12cf553c5b0896720a114b2c1e9d22be1 100644 (file)
@@ -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 */
 
index 5a130880df7798b75b52f587d71c05e6035d1b35..a7d98827d4321b12eded98b841d06d39999e3cc3 100644 (file)
@@ -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))
index 62cd64481010f6d15dbf6a104cc6c0c2a39df22c..0a0745d536aa64972b0ffc73aaf7b96a5a12ca10 100644 (file)
@@ -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);