Skip to content

Commit 78b43e4

Browse files
committed
fix warning: ISO C90 forbids mixed declarations and code
1 parent 2221c6a commit 78b43e4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ext/mysql2/client.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static void rb_mysql_client_mark(void * wrapper) {
124124
static VALUE rb_raise_mysql2_error(mysql_client_wrapper *wrapper) {
125125
VALUE rb_error_msg = rb_str_new2(mysql_error(wrapper->client));
126126
VALUE rb_sql_state = rb_tainted_str_new2(mysql_sqlstate(wrapper->client));
127+
VALUE e;
127128
#ifdef HAVE_RUBY_ENCODING_H
128129
rb_encoding *default_internal_enc = rb_default_internal_encoding();
129130
rb_encoding *conn_enc = rb_to_encoding(wrapper->encoding);
@@ -136,7 +137,7 @@ static VALUE rb_raise_mysql2_error(mysql_client_wrapper *wrapper) {
136137
}
137138
#endif
138139

139-
VALUE e = rb_exc_new3(cMysql2Error, rb_error_msg);
140+
e = rb_exc_new3(cMysql2Error, rb_error_msg);
140141
rb_funcall(e, intern_error_number_eql, 1, UINT2NUM(mysql_errno(wrapper->client)));
141142
rb_funcall(e, intern_sql_state_eql, 1, rb_sql_state);
142143
rb_exc_raise(e);
@@ -530,11 +531,11 @@ static VALUE finish_and_mark_inactive(void *args) {
530531
* again.
531532
*/
532533
static VALUE rb_mysql_client_abandon_results(VALUE self) {
533-
GET_CLIENT(self);
534-
535534
MYSQL_RES *result;
536535
int ret;
537536

537+
GET_CLIENT(self);
538+
538539
while (mysql_more_results(wrapper->client) == 1) {
539540
ret = mysql_next_result(wrapper->client);
540541
if (ret > 0) {
@@ -810,9 +811,12 @@ static VALUE rb_mysql_client_server_info(VALUE self) {
810811
static VALUE rb_mysql_client_socket(VALUE self) {
811812
GET_CLIENT(self);
812813
#ifndef _WIN32
813-
REQUIRE_CONNECTED(wrapper);
814-
int fd_set_fd = wrapper->client->net.fd;
815-
return INT2NUM(fd_set_fd);
814+
{
815+
int fd_set_fd;
816+
REQUIRE_CONNECTED(wrapper);
817+
fd_set_fd = wrapper->client->net.fd;
818+
return INT2NUM(fd_set_fd);
819+
}
816820
#else
817821
rb_raise(cMysql2Error, "Raw access to the mysql file descriptor isn't supported on Windows");
818822
#endif
@@ -939,8 +943,8 @@ static VALUE rb_mysql_client_more_results(VALUE self)
939943
*/
940944
static VALUE rb_mysql_client_next_result(VALUE self)
941945
{
942-
GET_CLIENT(self);
943946
int ret;
947+
GET_CLIENT(self);
944948
ret = mysql_next_result(wrapper->client);
945949
if (ret > 0) {
946950
rb_raise_mysql2_error(wrapper);

0 commit comments

Comments
 (0)