From 12bd3950129ec784110003d1fbb04a70e5d59083 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 7 Aug 2023 22:51:37 +0900 Subject: [PATCH] fmt_fp.c: revert 647324ad45c0d779a3c36f0bb7955b8b8fc9f491 C++ complier does not allow jump across local variable declaration, even if we don't access those variables after the destination label. --- src/fmt_fp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fmt_fp.c b/src/fmt_fp.c index a1743a0de..3eed1177e 100644 --- a/src/fmt_fp.c +++ b/src/fmt_fp.c @@ -118,7 +118,9 @@ mrb_format_float(mrb_float f, char *buf, size_t buf_size, char fmt, int prec, ch *s++ = 'N' ^ uc; *s++ = 'A' ^ uc; *s++ = 'N' ^ uc; - goto ret; + ret: + *s = '\0'; + return (int)(s - buf); } } @@ -363,7 +365,7 @@ mrb_format_float(mrb_float f, char *buf, size_t buf_size, char fmt, int prec, ch *s++ = '0' + (e / 10); *s++ = '0' + (e % 10); } - ret: + *s = '\0'; return (int)(s - buf); }