Skip to content

Commit 25f4f79

Browse files
Drop unused variables (#18023)
1 parent fcd0f72 commit 25f4f79

File tree

4 files changed

+4
-29
lines changed

4 files changed

+4
-29
lines changed

ext/mysqlnd/mysqlnd_auth.c

-4
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,6 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
487487
}
488488
}
489489
if (ret == PASS) {
490-
ZEND_ASSERT(conn->username.s != user && conn->password.s != passwd);
491-
mysqlnd_set_persistent_string(&conn->username, user, user_len, conn->persistent);
492-
mysqlnd_set_persistent_string(&conn->password, passwd, passwd_len, conn->persistent);
493-
494490
mysqlnd_set_string(&conn->last_message, NULL, 0);
495491
UPSERT_STATUS_RESET(conn->upsert_status);
496492
/* set charset for old servers */

ext/mysqlnd/mysqlnd_commands.c

-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ MYSQLND_METHOD(mysqlnd_command, init_db)(MYSQLND_CONN_DATA * const conn, const M
107107
a protocol of giving back -1. Thus we have to follow it :(
108108
*/
109109
UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
110-
if (ret == PASS) {
111-
mysqlnd_set_persistent_string(&conn->connect_or_select_db, db.s, db.l, conn->persistent);
112-
}
113110

114111
DBG_RETURN(ret);
115112
}

ext/mysqlnd/mysqlnd_connection.c

+4-17
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, free_contents)(MYSQLND_CONN_DATA * conn)
282282

283283
DBG_INF("Freeing memory of members");
284284

285-
mysqlnd_set_persistent_string(&conn->hostname, NULL, 0, pers);
286-
mysqlnd_set_persistent_string(&conn->username, NULL, 0, pers);
287-
mysqlnd_set_persistent_string(&conn->password, NULL, 0, pers);
288-
mysqlnd_set_persistent_string(&conn->connect_or_select_db, NULL, 0, pers);
289-
mysqlnd_set_persistent_string(&conn->unix_socket, NULL, 0, pers);
290285
DBG_INF_FMT("scheme=%s", conn->scheme.s);
291286
mysqlnd_set_persistent_string(&conn->scheme, NULL, 0, pers);
292287

@@ -658,22 +653,16 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
658653
if (transport.s) {
659654
mnd_sprintf_free(transport.s);
660655
transport.s = NULL;
661-
}
662-
663-
if (!conn->scheme.s) {
656+
} else {
664657
goto err; /* OOM */
665658
}
666659

667-
mysqlnd_set_persistent_string(&conn->username, username.s, username.l, conn->persistent);
668-
mysqlnd_set_persistent_string(&conn->password, username.s, password.l, conn->persistent);
669660
conn->port = port;
670-
mysqlnd_set_persistent_string(&conn->connect_or_select_db, database.s, database.l, conn->persistent);
671661

672662
if (!unix_socket && !named_pipe) {
673-
mysqlnd_set_persistent_string(&conn->hostname, hostname.s, hostname.l, conn->persistent);
674663
{
675664
char *p;
676-
mnd_sprintf(&p, 0, "%s via TCP/IP", conn->hostname.s);
665+
mnd_sprintf(&p, 0, "%s via TCP/IP", hostname.s);
677666
if (!p) {
678667
SET_OOM_ERROR(conn->error_info);
679668
goto err; /* OOM */
@@ -682,12 +671,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
682671
mnd_sprintf_free(p);
683672
}
684673
} else {
685-
conn->unix_socket.s = mnd_pestrdup(socket_or_pipe.s, conn->persistent);
686674
if (unix_socket) {
687675
conn->host_info = mnd_pestrdup("Localhost via UNIX socket", conn->persistent);
688676
} else if (named_pipe) {
689677
char *p;
690-
mnd_sprintf(&p, 0, "%s via named pipe", conn->unix_socket.s);
678+
mnd_sprintf(&p, 0, "%s via named pipe", socket_or_pipe.s);
691679
if (!p) {
692680
SET_OOM_ERROR(conn->error_info);
693681
goto err; /* OOM */
@@ -697,11 +685,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
697685
} else {
698686
php_error_docref(NULL, E_WARNING, "Impossible. Should be either socket or a pipe. Report a bug!");
699687
}
700-
if (!conn->unix_socket.s || !conn->host_info) {
688+
if (!socket_or_pipe.s || !conn->host_info) {
701689
SET_OOM_ERROR(conn->error_info);
702690
goto err; /* OOM */
703691
}
704-
conn->unix_socket.l = strlen(conn->unix_socket.s);
705692
}
706693

707694
SET_EMPTY_ERROR(conn->error_info);

ext/mysqlnd/mysqlnd_structs.h

-5
Original file line numberDiff line numberDiff line change
@@ -890,18 +890,13 @@ struct st_mysqlnd_connection_data
890890
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory;
891891

892892
/* Information related */
893-
MYSQLND_STRING hostname;
894-
MYSQLND_STRING unix_socket;
895-
MYSQLND_STRING username;
896-
MYSQLND_STRING password;
897893
MYSQLND_STRING scheme;
898894
uint64_t thread_id;
899895
char *server_version;
900896
char *host_info;
901897
MYSQLND_STRING authentication_plugin_data;
902898
const MYSQLND_CHARSET *charset;
903899
const MYSQLND_CHARSET *greet_charset;
904-
MYSQLND_STRING connect_or_select_db;
905900
MYSQLND_INFILE infile;
906901
unsigned int protocol_version;
907902
unsigned int port;

0 commit comments

Comments
 (0)