diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-19 08:38:11 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-19 08:38:11 +0000 |
commit | b8148f45947eee7461986536114949556f4eda40 (patch) | |
tree | 16ae7f6b7588cc228e0175fe26e4ce15be539c47 /sprintf.c | |
parent | c613f625b7c0c72771d74f86a1177e00290577df (diff) |
2000-06-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -264,13 +264,15 @@ rb_f_sprintf(argc, argv) if (flags & FPREC) { rb_raise(rb_eArgError, "precision given twice"); } + flags |= FPREC; prec = 0; p++; if (*p == '*') { GETASTER(prec); - if (prec > 0) - flags |= FPREC; + if (prec < 0) { /* ignore negative precision */ + flags &= ~FPREC; + } p++; goto retry; } @@ -281,8 +283,6 @@ rb_f_sprintf(argc, argv) if (p >= end) { rb_raise(rb_eArgError, "malformed format string - %%.[0-9]"); } - if (prec > 0) - flags |= FPREC; goto retry; case '\n': |