aboutsummaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-26 18:41:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-26 18:41:57 +0000
commitcfa7b2283b9b53ff8689d510d486f3488d9254d1 (patch)
treef2c28977171ce2ca7994080503440c1605624bc4 /sprintf.c
parent545165770bd397e197da7df4e423f3a88d114a76 (diff)
downloadruby-cfa7b2283b9b53ff8689d510d486f3488d9254d1.tar.gz
sprintf.c: unnumbered asterisk with numbered argument
* 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/trunk@46569 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 9a08764448..56671de731 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -79,6 +79,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 ? \
@@ -125,7 +128,7 @@ sign_bits(int base, const char *p)
tmp = GETPOSARG(n); \
} \
else { \
- tmp = GETARG(); \
+ tmp = GETNEXTARG(); \
p = t; \
} \
(val) = NUM2INT(tmp); \