Skip to content

Commit

Permalink
Fix unnecessary indent of if block
Browse files Browse the repository at this point in the history
  • Loading branch information
sqex_fukasayu committed Dec 6, 2019
1 parent e2afdd0 commit d4740d3
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions ext/mysql2/result.c
Expand Up @@ -421,29 +421,27 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co

if (seconds == 0) {
val = Qnil;
} else {
if (seconds < MYSQL2_MIN_TIME || seconds > MYSQL2_MAX_TIME) { // use DateTime instead
VALUE offset = INT2NUM(0);
if (args->db_timezone == intern_local) {
} else if (seconds < MYSQL2_MIN_TIME || seconds > MYSQL2_MAX_TIME) { // use DateTime instead
VALUE offset = INT2NUM(0);
if (args->db_timezone == intern_local) {
offset = rb_funcall(cMysql2Client, intern_local_offset, 0);
}
val = rb_funcall(cDateTime, intern_civil, 7, UINT2NUM(ts->year), UINT2NUM(ts->month), UINT2NUM(ts->day), UINT2NUM(ts->hour), UINT2NUM(ts->minute), UINT2NUM(ts->second), offset);
if (!NIL_P(args->app_timezone)) {
if (args->app_timezone == intern_local) {
offset = rb_funcall(cMysql2Client, intern_local_offset, 0);
val = rb_funcall(val, intern_new_offset, 1, offset);
} else { // utc
val = rb_funcall(val, intern_new_offset, 1, opt_utc_offset);
}
val = rb_funcall(cDateTime, intern_civil, 7, UINT2NUM(ts->year), UINT2NUM(ts->month), UINT2NUM(ts->day), UINT2NUM(ts->hour), UINT2NUM(ts->minute), UINT2NUM(ts->second), offset);
if (!NIL_P(args->app_timezone)) {
if (args->app_timezone == intern_local) {
offset = rb_funcall(cMysql2Client, intern_local_offset, 0);
val = rb_funcall(val, intern_new_offset, 1, offset);
} else { // utc
val = rb_funcall(val, intern_new_offset, 1, opt_utc_offset);
}
}
} else {
val = rb_funcall(rb_cTime, args->db_timezone, 7, UINT2NUM(ts->year), UINT2NUM(ts->month), UINT2NUM(ts->day), UINT2NUM(ts->hour), UINT2NUM(ts->minute), UINT2NUM(ts->second), ULONG2NUM(ts->second_part));
if (!NIL_P(args->app_timezone)) {
if (args->app_timezone == intern_local) {
val = rb_funcall(val, intern_localtime, 0);
} else { // utc
val = rb_funcall(val, intern_utc, 0);
}
}
} else {
val = rb_funcall(rb_cTime, args->db_timezone, 7, UINT2NUM(ts->year), UINT2NUM(ts->month), UINT2NUM(ts->day), UINT2NUM(ts->hour), UINT2NUM(ts->minute), UINT2NUM(ts->second), ULONG2NUM(ts->second_part));
if (!NIL_P(args->app_timezone)) {
if (args->app_timezone == intern_local) {
val = rb_funcall(val, intern_localtime, 0);
} else { // utc
val = rb_funcall(val, intern_utc, 0);
}
}
}
Expand Down

0 comments on commit d4740d3

Please sign in to comment.