summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index b4e32c709e..ae37c65f4c 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -4144,12 +4144,9 @@ get_vp_value:
one = VpCheckGetValue(NewOneWrapLimited(1, 1));
two = VpCheckGetValue(VpCreateRbObject(1, "2", true));
- RB_GC_GUARD(one);
- RB_GC_GUARD(two);
n = prec + BIGDECIMAL_DOUBLE_FIGURES;
vn = SSIZET2NUM(n);
- RB_GC_GUARD(vn);
expo = VpExponent10(vx);
if (expo < 0 || expo >= 3) {
char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4];
@@ -4164,9 +4161,6 @@ get_vp_value:
x2 = BigDecimal_mult2(x, x, vn);
y = x;
d = y;
- RB_GC_GUARD(x2);
- RB_GC_GUARD(y);
- RB_GC_GUARD(d);
i = 1;
while (!VpIsZero((Real*)DATA_PTR(d))) {
SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y));
@@ -4194,6 +4188,13 @@ get_vp_value:
y = BigDecimal_add(y, dy);
}
+ RB_GC_GUARD(one);
+ RB_GC_GUARD(two);
+ RB_GC_GUARD(vn);
+ RB_GC_GUARD(x2);
+ RB_GC_GUARD(y);
+ RB_GC_GUARD(d);
+
return y;
}