summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-10 08:21:07 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-10 08:21:07 +0000
commit9603e288446876c5a9f94f08ad8c123a3344c38f (patch)
tree0d2a03b24ab9e397b3168909702b0121a287147b /sprintf.c
parentf3615ecc42d455d4453410a1c43401b06da46d38 (diff)
* eval.c (return_jump): set return value to the return
destination. separated from localjump_destination(). * eval.c (break_jump): break innermost loop (or thread or proc). * eval.c (rb_yield_0): set exit_value for block break. * eval.c (eval): Only print backtrace if generating the backtrace doesn't generate an exception. [ruby-core:02621] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sprintf.c b/sprintf.c
index e1069a3318..33ec8db608 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -444,6 +444,7 @@ rb_f_sprintf(argc, argv)
long v = 0;
int base, bignum = 0;
int len, pos;
+ VALUE tmp;
switch (*p) {
case 'd':
@@ -544,7 +545,7 @@ rb_f_sprintf(argc, argv)
if (base == 10) {
rb_warning("negative number for %%u specifier");
}
- else if (!(flags&FPREC)) {
+ if (!(flags&(FPREC|FZERO))) {
strcpy(s, "..");
s += 2;
}
@@ -571,8 +572,8 @@ rb_f_sprintf(argc, argv)
}
if (sign) {
- val = rb_big2str(val, base);
- s = RSTRING(val)->ptr;
+ tmp = rb_big2str(val, base);
+ s = RSTRING(tmp)->ptr;
if (s[0] == '-') {
s++;
sc = '-';
@@ -592,8 +593,8 @@ rb_f_sprintf(argc, argv)
val = rb_big_clone(val);
rb_big_2comp(val);
}
- val = rb_big2str(val, base);
- s = RSTRING(val)->ptr;
+ tmp = rb_big2str(val, base);
+ s = RSTRING(tmp)->ptr;
if (*s == '-') {
if (base == 10) {
rb_warning("negative number for %%u specifier");
@@ -601,9 +602,9 @@ rb_f_sprintf(argc, argv)
}
else {
remove_sign_bits(++s, base);
- val = rb_str_new(0, 3+strlen(s));
- t = RSTRING(val)->ptr;
- if (!(flags&FPREC)) {
+ tmp = rb_str_new(0, 3+strlen(s));
+ t = RSTRING(tmp)->ptr;
+ if (!(flags&(FPREC|FZERO))) {
strcpy(t, "..");
t += 2;
}
@@ -619,7 +620,7 @@ rb_f_sprintf(argc, argv)
bignum = 2;
}
}
- s = RSTRING(val)->ptr;
+ s = RSTRING(tmp)->ptr;
format_integer:
pos = -1;