зеркало из https://github.com/github/ruby.git
flo_to_s: 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:
Родитель
41703fcfab
Коммит
bf19820bb3
|
@ -985,6 +985,10 @@ flo_to_s(VALUE flt)
|
|||
memcpy(ptr -= decpt, buf, digs);
|
||||
}
|
||||
else {
|
||||
goto exp;
|
||||
}
|
||||
return s;
|
||||
|
||||
exp:
|
||||
if (digs > 1) {
|
||||
memmove(buf + 2, buf + 1, digs - 1);
|
||||
|
@ -996,7 +1000,6 @@ flo_to_s(VALUE flt)
|
|||
buf[1] = '.';
|
||||
rb_str_cat(s, buf, digs + 1);
|
||||
rb_str_catf(s, "e%+03d", decpt - 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче