From e63a9901412d465cd90143d658fda8fa938d7f8c Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 18 Apr 2002 08:46:18 +0000 Subject: * re.c (rb_reg_expr_str): should treat backslash specially in escaping. * io.c: complete off_t handling; missing argument for fptr_finalize(); polished rb_scan_args call. * dir.c: wrap multi-statment macro by do { } while (0) * eval.c, numeric,c, sprintf.c, util.c: ditto. * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum, Bignum, nor Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sprintf.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sprintf.c') diff --git a/sprintf.c b/sprintf.c index e9742f3fd5..5f0aeba39f 100644 --- a/sprintf.c +++ b/sprintf.c @@ -6,7 +6,7 @@ $Date$ created at: Fri Oct 15 10:39:26 JST 1993 - Copyright (C) 1993-2001 Yukihiro Matsumoto + Copyright (C) 1993-2002 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -62,23 +62,22 @@ remove_sign_bits(str, base) #define FWIDTH 32 #define FPREC 64 -#define CHECK(l) {\ +#define CHECK(l) \ while (blen + (l) >= bsiz) {\ REALLOC_N(buf, char, bsiz*2);\ bsiz*=2;\ - }\ -} + } -#define PUSH(s, l) { \ +#define PUSH(s, l) do { \ CHECK(l);\ memcpy(&buf[blen], s, l);\ blen += (l);\ -} +} while (0) #define GETARG() \ ((nextarg >= argc) ? (rb_raise(rb_eArgError, "too few argument."), 0) : argv[nextarg++]) -#define GETASTER(val) { \ +#define GETASTER(val) do { \ t = p++; \ n = 0; \ for (; p < end && ISDIGIT(*p); p++) { \ @@ -98,7 +97,7 @@ remove_sign_bits(str, base) p = t; \ } \ val = NUM2INT(tmp); \ -} +} while (0) VALUE rb_f_sprintf(argc, argv) -- cgit v1.2.3