summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/sprintf.c b/sprintf.c
index c54e8e8..f5b3e84 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -766,7 +766,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (isnan(fval) || isinf(fval)) {
const char *expr;
- if (isnan(fval)) {
+ if (isnan(fval)) {
expr = "NaN";
}
else {
@@ -789,25 +789,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
blen++;
strncpy(&buf[blen], expr, strlen(expr));
}
- else if (flags & FZERO) {
- if (!isnan(fval) && fval < 0.0) {
- buf[blen++] = '-';
- need--;
- }
- else if (flags & FPLUS) {
- buf[blen++] = '+';
- need--;
- }
- else if (flags & FSPACE) {
- blen++;
- need--;
- }
- if ((need -= strlen(expr)) > 0) {
- memset(buf+blen, '0', need);
- blen += need;
- }
- strncpy(&buf[blen], expr, strlen(expr));
- }
else {
if (!isnan(fval) && fval < 0.0)
buf[blen + need - strlen(expr) - 1] = '-';