Skip to content

Commit

Permalink
Remove unnecessary casts for void * rvalues
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Nov 22, 2015
1 parent da8aa77 commit fe76f67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 5 additions & 9 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static VALUE rb_raise_mysql2_error(mysql_client_wrapper *wrapper) {

static void *nogvl_init(void *ptr) {
MYSQL *client;
mysql_client_wrapper *wrapper = (mysql_client_wrapper *)ptr;
mysql_client_wrapper *wrapper = ptr;

/* may initialize embedded server and read /etc/services off disk */
client = mysql_init(wrapper->client);
Expand Down Expand Up @@ -224,7 +224,7 @@ static void *nogvl_close(void *ptr) {

/* this is called during GC */
static void rb_mysql_client_free(void *ptr) {
mysql_client_wrapper *wrapper = (mysql_client_wrapper *)ptr;
mysql_client_wrapper *wrapper = ptr;
decr_mysql2_client(wrapper);
}

Expand Down Expand Up @@ -437,10 +437,9 @@ static void *nogvl_read_query_result(void *ptr) {
}

static void *nogvl_do_result(void *ptr, char use_result) {
mysql_client_wrapper *wrapper;
mysql_client_wrapper *wrapper = ptr;
MYSQL_RES *result;

wrapper = (mysql_client_wrapper *)ptr;
if (use_result) {
result = mysql_use_result(wrapper->client);
} else {
Expand Down Expand Up @@ -533,14 +532,13 @@ static VALUE disconnect_and_raise(VALUE self, VALUE error) {
}

static VALUE do_query(void *args) {
struct async_query_args *async_args;
struct async_query_args *async_args = args;
struct timeval tv;
struct timeval* tvp;
long int sec;
int retval;
VALUE read_timeout;

async_args = (struct async_query_args *)args;
read_timeout = rb_iv_get(async_args->self, "@read_timeout");

tvp = NULL;
Expand Down Expand Up @@ -578,11 +576,9 @@ static VALUE do_query(void *args) {
}
#else
static VALUE finish_and_mark_inactive(void *args) {
VALUE self;
VALUE self = args;
MYSQL_RES *result;

self = (VALUE)args;

GET_CLIENT(self);

if (!NIL_P(wrapper->active_thread)) {
Expand Down
6 changes: 3 additions & 3 deletions ext/mysql2/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ static VALUE intern_usec, intern_sec, intern_min, intern_hour, intern_day, inter


static void rb_mysql_stmt_mark(void * ptr) {
mysql_stmt_wrapper* stmt_wrapper = (mysql_stmt_wrapper *)ptr;
mysql_stmt_wrapper* stmt_wrapper = ptr;
if (!stmt_wrapper) return;

rb_gc_mark(stmt_wrapper->client);
}

static void *nogvl_stmt_close(void * ptr) {
mysql_stmt_wrapper *stmt_wrapper = (mysql_stmt_wrapper *)ptr;
mysql_stmt_wrapper *stmt_wrapper = ptr;
if (stmt_wrapper->stmt) {
mysql_stmt_close(stmt_wrapper->stmt);
stmt_wrapper->stmt = NULL;
Expand All @@ -29,7 +29,7 @@ static void *nogvl_stmt_close(void * ptr) {
}

static void rb_mysql_stmt_free(void * ptr) {
mysql_stmt_wrapper* stmt_wrapper = (mysql_stmt_wrapper *)ptr;
mysql_stmt_wrapper* stmt_wrapper = ptr;
decr_mysql2_stmt(stmt_wrapper);
}

Expand Down

0 comments on commit fe76f67

Please sign in to comment.