1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vtm_add_offset: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
This commit is contained in:
卜部昌平 2020-06-19 12:39:16 +09:00
parent 0fc569361b
commit 1c0a97bfad
Notes: git 2020-06-29 11:06:41 +09:00

2
time.c
View file

@ -1967,10 +1967,8 @@ vtm_add_offset(struct vtm *vtm, VALUE off, int sign)
vtm->subsecx = subv(vtm->subsecx, INT2FIX(TIME_SCALE));
sec += 1;
}
goto not_zero_sec;
}
if (sec) {
not_zero_sec:
/* If sec + subsec == 0, don't change vtm->sec.
* It may be 60 which is a leap second. */
sec += vtm->sec;