summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 03:05:22 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 03:05:22 +0000
commitae6d24859a733b8808f7b2d48b53146a4367f3e8 (patch)
tree9d17e05997f7719a53d081489cf7205ecc1e1617 /sprintf.c
parent1872f299e2aaa3c7fd74f59b12dcc63fadda272e (diff)
merge revision(s) 46569: [Backport #9982]
* sprintf.c (GETASTER): should not use the numbered argument to be formatted, raise ArgumentError instead. [ruby-dev:48330] [Bug #9982] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index 18e745593d..15259960fc 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -104,6 +104,9 @@ sign_bits(int base, const char *p)
} while (0)
#define GETARG() (nextvalue != Qundef ? nextvalue : \
+ GETNEXTARG())
+
+#define GETNEXTARG() ( \
posarg == -1 ? \
(rb_raise(rb_eArgError, "unnumbered(%d) mixed with numbered", nextarg), 0) : \
posarg == -2 ? \
@@ -147,7 +150,7 @@ sign_bits(int base, const char *p)
tmp = GETPOSARG(n); \
} \
else { \
- tmp = GETARG(); \
+ tmp = GETNEXTARG(); \
p = t; \
} \
(val) = NUM2INT(tmp); \