summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-23 12:07:23 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-23 12:07:23 +0000
commite8b0f17319d78b7435d84d7875d923117eebc37e (patch)
treee784769fdb709d56709599b9597070d065ef5eed
parent548027ef61c706a1459ab38c43482e1e333844a4 (diff)
* array.c (ary_resize_capa): Remove an unused function.
* array.c, bignum.c, dir.c, enumerator.c, gc.c, io.c, numeric.c, object.c, re.c, string.c, struct.c: Mixing two styles is not a good thing. Stick with the K&R style in 1.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--array.c15
-rw-r--r--bignum.c8
-rw-r--r--dir.c7
-rw-r--r--enumerator.c5
-rw-r--r--gc.c12
-rw-r--r--io.c26
-rw-r--r--numeric.c17
-rw-r--r--object.c7
-rw-r--r--re.c10
-rw-r--r--string.c10
-rw-r--r--struct.c5
12 files changed, 89 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 1723451200..ddb1bbdb56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 23 21:07:09 2009 Akinori MUSHA <[email protected]>
+
+ * array.c (ary_resize_capa): Remove an unused function.
+
+ * array.c, bignum.c, dir.c, enumerator.c, gc.c, io.c, numeric.c,
+ object.c, re.c, string.c, struct.c: Mixing two styles is not a
+ good thing. Stick with the K&R style in 1.8.
+
Sun Mar 22 20:39:38 2009 Nobuyoshi Nakada <[email protected]>
* lib/test/unit.rb: use Kernel.exit to get rid of using
diff --git a/array.c b/array.c
index 0ca0924d1b..94a4dfb98b 100644
--- a/array.c
+++ b/array.c
@@ -43,15 +43,11 @@ memfill(mem, size, val)
}
}
+static void ary_double_capa _((VALUE, long));
static void
-ary_resize_capa(VALUE ary, long capacity)
-{
- REALLOC_N(RARRAY(ary)->ptr, VALUE, capacity);
- RARRAY(ary)->aux.capa = capacity;
-}
-
-static void
-ary_double_capa(VALUE ary, long min)
+ary_double_capa(ary, min)
+ VALUE ary;
+ long min;
{
long new_capa = RARRAY(ary)->aux.capa / 2;
@@ -3334,7 +3330,8 @@ rb_ary_shuffle_bang(ary)
*/
static VALUE
-rb_ary_shuffle(VALUE ary)
+rb_ary_shuffle(ary)
+ VALUE ary;
{
ary = rb_ary_dup(ary);
rb_ary_shuffle_bang(ary);
diff --git a/bignum.c b/bignum.c
index ca73fc0456..6a97456ff6 100644
--- a/bignum.c
+++ b/bignum.c
@@ -757,7 +757,9 @@ rb_big2str0(x, base, trim)
}
VALUE
-rb_big2str(VALUE x, int base)
+rb_big2str(x, base)
+ VALUE x;
+ int base;
{
return rb_big2str0(x, base, Qtrue);
}
@@ -1993,8 +1995,10 @@ rb_big_xor(xx, yy)
return bignorm(z);
}
+static VALUE check_shiftdown _((VALUE, VALUE));
static VALUE
-check_shiftdown(VALUE y, VALUE x)
+check_shiftdown(y, x)
+ VALUE y, x;
{
if (!RBIGNUM(x)->len) return INT2FIX(0);
if (RBIGNUM(y)->len > SIZEOF_LONG / SIZEOF_BDIGITS) {
diff --git a/dir.c b/dir.c
index 710299e7b6..d166fa4ed2 100644
--- a/dir.c
+++ b/dir.c
@@ -1611,8 +1611,13 @@ ruby_brace_glob(str, flags, func, arg)
return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg);
}
+static int push_glob _((VALUE, const char *, int));
+
static int
-push_glob(VALUE ary, const char *str, int flags)
+push_glob(ary, str, flags)
+ VALUE ary;
+ const char *str;
+ int flags;
{
struct glob_args args;
diff --git a/enumerator.c b/enumerator.c
index acf101fcbd..c72002b36a 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -655,8 +655,11 @@ yielder_mark(void *p)
rb_gc_mark(ptr->proc);
}
+static struct yielder *yielder_ptr _((VALUE));
+
static struct yielder *
-yielder_ptr(VALUE obj)
+yielder_ptr(obj)
+ VALUE obj;
{
struct yielder *ptr;
diff --git a/gc.c b/gc.c
index 7eb3a6fd81..e759c2dc1d 100644
--- a/gc.c
+++ b/gc.c
@@ -1630,11 +1630,14 @@ Init_stack(addr)
#endif
}
-void ruby_init_stack(VALUE *addr
#ifdef __ia64
- , void *bsp
+void ruby_init_stack(addr, bsp)
+ VALUE *addr;
+ void *bsp;
+#else
+void ruby_init_stack(addr)
+ VALUE *addr;
#endif
- )
{
if (!rb_gc_stack_start ||
STACK_UPPER(&addr,
@@ -2135,7 +2138,8 @@ id2ref(obj, objid)
*/
VALUE
-rb_obj_id(VALUE obj)
+rb_obj_id(obj)
+ VALUE obj;
{
/*
* 32-bit VALUE space
diff --git a/io.c b/io.c
index 323f6e97d2..dafe0af258 100644
--- a/io.c
+++ b/io.c
@@ -1196,7 +1196,8 @@ read_all(fptr, siz, str)
return str;
}
-void rb_io_set_nonblock(rb_io_t *fptr)
+void rb_io_set_nonblock(fptr)
+ rb_io_t *fptr;
{
int flags;
#ifdef F_GETFL
@@ -1423,7 +1424,8 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io)
*/
static VALUE
-rb_io_write_nonblock(VALUE io, VALUE str)
+rb_io_write_nonblock(io, str)
+ VALUE io, str;
{
rb_io_t *fptr;
FILE *f;
@@ -1700,7 +1702,7 @@ rscheck(rsptr, rslen, rs)
return 1;
}
-static VALUE rb_io_getline(VALUE rs, VALUE io);
+static VALUE rb_io_getline _((VALUE, VALUE));
static VALUE
rb_io_getline(rs, io)
@@ -2137,10 +2139,13 @@ rb_io_bytes(io)
/*
* call-seq:
- * ios.getc => fixnum or nil
+ * ios.getbyte => fixnum or nil
+ * ios.getc => fixnum or nil
*
* Gets the next 8-bit byte (0..255) from <em>ios</em>. Returns
- * <code>nil</code> if called at end of file.
+ * <code>nil</code> if called at end of file. getc() will change and
+ * return a character in 1.9, so if what you exactly mean is a byte,
+ * use getbyte().
*
* f = File.new("testfile")
* f.getc #=> 84
@@ -2197,9 +2202,10 @@ rb_getc(f)
/*
* call-seq:
+ * ios.readbyte => fixnum
* ios.readchar => fixnum
*
- * Reads a character as with <code>IO#getc</code>, but raises an
+ * Reads a byte as with <code>IO#getc</code>, but raises an
* <code>EOFError</code> on end of file.
*/
@@ -2217,9 +2223,10 @@ rb_io_readchar(io)
/*
* call-seq:
- * ios.ungetc(integer) => nil
+ * ios.ungetbyte(integer) => nil
+ * ios.ungetc(integer) => nil
*
- * Pushes back one character (passed as a parameter) onto <em>ios</em>,
+ * Pushes back one byte (passed as a parameter) onto <em>ios</em>,
* such that a subsequent buffered read will return it. Only one character
* may be pushed back before a subsequent read operation (that is,
* you will be able to read only the last of several characters that have been pushed
@@ -3140,7 +3147,7 @@ rb_io_unbuffered(fptr)
rb_io_synchronized(fptr);
}
-static VALUE pipe_open(VALUE pstr, const char *pname, const char *mode);
+static VALUE pipe_open _((VALUE, const char *, const char *));
static VALUE
pipe_open(pstr, pname, mode)
@@ -6011,6 +6018,7 @@ Init_IO()
rb_define_method(rb_cIO, "readchar", rb_io_readchar, 0);
rb_define_method(rb_cIO, "readbyte", rb_io_readchar, 0);
rb_define_method(rb_cIO, "ungetc",rb_io_ungetc, 1);
+ rb_define_method(rb_cIO, "ungetbyte",rb_io_ungetc, 1);
rb_define_method(rb_cIO, "<<", rb_io_addstr, 1);
rb_define_method(rb_cIO, "flush", rb_io_flush, 0);
rb_define_method(rb_cIO, "tell", rb_io_tell, 0);
diff --git a/numeric.c b/numeric.c
index 508c076f34..00eceea3bf 100644
--- a/numeric.c
+++ b/numeric.c
@@ -281,7 +281,7 @@ num_quo(x, y)
}
-static VALUE num_floor(VALUE num);
+static VALUE num_floor _((VALUE));
/*
* call-seq:
@@ -1816,7 +1816,8 @@ int_int_p(num)
*/
static VALUE
-int_odd_p(VALUE num)
+int_odd_p(num)
+ VALUE num;
{
if (rb_funcall(num, '%', 1, INT2FIX(2)) != INT2FIX(0)) {
return Qtrue;
@@ -1832,7 +1833,8 @@ int_odd_p(VALUE num)
*/
static VALUE
-int_even_p(VALUE num)
+int_even_p(num)
+ VALUE num;
{
if (rb_funcall(num, '%', 1, INT2FIX(2)) == INT2FIX(0)) {
return Qtrue;
@@ -1874,7 +1876,8 @@ int_succ(num)
*/
static VALUE
-int_pred(VALUE num)
+int_pred(num)
+ VALUE num;
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) - 1;
@@ -2999,7 +3002,8 @@ fix_zero_p(num)
*/
static VALUE
-fix_odd_p(VALUE num)
+fix_odd_p(num)
+ VALUE num;
{
if (num & 2) {
return Qtrue;
@@ -3015,7 +3019,8 @@ fix_odd_p(VALUE num)
*/
static VALUE
-fix_even_p(VALUE num)
+fix_even_p(num)
+ VALUE num;
{
if (num & 2) {
return Qfalse;
diff --git a/object.c b/object.c
index 7fbbcea6cf..564d907739 100644
--- a/object.c
+++ b/object.c
@@ -1239,7 +1239,8 @@ VALUE rb_proc_new _((VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VA
*/
static VALUE
-sym_to_proc(VALUE sym)
+sym_to_proc(sym)
+ VALUE sym;
{
return rb_proc_new(sym_call, (VALUE)SYM2ID(sym));
}
@@ -2285,7 +2286,9 @@ rb_to_integer(val, method)
}
VALUE
-rb_check_to_integer(VALUE val, const char *method)
+rb_check_to_integer(val, method)
+ VALUE val;
+ const char *method;
{
VALUE v;
diff --git a/re.c b/re.c
index d138021894..b9133f7798 100644
--- a/re.c
+++ b/re.c
@@ -682,8 +682,10 @@ match_alloc(klass)
return (VALUE)match;
}
+static void match_check _((VALUE));
static void
-match_check(VALUE match)
+match_check(match)
+ VALUE match;
{
if (!RMATCH(match)->str) {
rb_raise(rb_eTypeError, "uninitialized Match");
@@ -1366,7 +1368,8 @@ match_string(match)
*/
static VALUE
-match_inspect(VALUE match)
+match_inspect(match)
+ VALUE match;
{
const char *cname = rb_obj_classname(match);
VALUE str;
@@ -2101,7 +2104,8 @@ rb_reg_s_union(self, args0)
* Regexp.union(/dogs/, /cats/i) #=> /(?-mix:dogs)|(?i-mx:cats)/
*/
static VALUE
-rb_reg_s_union_m(VALUE self, VALUE args)
+rb_reg_s_union_m(self, args)
+ VALUE self, args;
{
VALUE v;
if (RARRAY_LEN(args) == 1 &&
diff --git a/string.c b/string.c
index d3b947c550..d1589bede9 100644
--- a/string.c
+++ b/string.c
@@ -514,7 +514,8 @@ rb_str_modify(str)
}
static inline void
-str_discard(VALUE str)
+str_discard(str)
+ VALUE str;
{
if (str_independent(str)) {
xfree(RSTRING_PTR(str));
@@ -716,7 +717,9 @@ rb_str_unlocktmp(str)
}
void
-rb_str_set_len(VALUE str, long len)
+rb_str_set_len(str, len)
+ VALUE str;
+ long len;
{
RSTRING(str)->len = len;
RSTRING(str)->ptr[len] = '\0';
@@ -3961,7 +3964,8 @@ rb_str_each_byte(str)
*/
static VALUE
-rb_str_each_char(VALUE str)
+rb_str_each_char(str)
+ VALUE str;
{
int i, len, n;
const char *ptr;
diff --git a/struct.c b/struct.c
index 29221cebdf..72a2d33e43 100644
--- a/struct.c
+++ b/struct.c
@@ -325,8 +325,11 @@ rb_struct_s_def(argc, argv, klass)
return st;
}
+static size_t num_members _((VALUE));
+
static size_t
-num_members(VALUE klass)
+num_members(klass)
+ VALUE klass;
{
VALUE members;
members = rb_struct_iv_get(klass, "__members__");