ruby-changes:11428
From: knu <ko1@a...>
Date: Mon, 23 Mar 2009 21:07:37 +0900 (JST)
Subject: [ruby-changes:11428] Ruby:r23052 (ruby_1_8): * array.c (ary_resize_capa): Remove an unused function.
knu 2009-03-23 21:07:23 +0900 (Mon, 23 Mar 2009) New Revision: 23052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23052 Log: * 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. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/array.c branches/ruby_1_8/bignum.c branches/ruby_1_8/dir.c branches/ruby_1_8/enumerator.c branches/ruby_1_8/gc.c branches/ruby_1_8/io.c branches/ruby_1_8/numeric.c branches/ruby_1_8/object.c branches/ruby_1_8/re.c branches/ruby_1_8/string.c branches/ruby_1_8/struct.c Index: ruby_1_8/array.c =================================================================== --- ruby_1_8/array.c (revision 23051) +++ ruby_1_8/array.c (revision 23052) @@ -43,16 +43,12 @@ } } +static void ary_double_capa _((VALUE, long)); static void -ary_resize_capa(VALUE ary, long capacity) +ary_double_capa(ary, min) + VALUE ary; + long min; { - REALLOC_N(RARRAY(ary)->ptr, VALUE, capacity); - RARRAY(ary)->aux.capa = capacity; -} - -static void -ary_double_capa(VALUE ary, long min) -{ long new_capa = RARRAY(ary)->aux.capa / 2; if (new_capa < ARY_DEFAULT_SIZE) { @@ -3334,7 +3330,8 @@ */ static VALUE -rb_ary_shuffle(VALUE ary) +rb_ary_shuffle(ary) + VALUE ary; { ary = rb_ary_dup(ary); rb_ary_shuffle_bang(ary); Index: ruby_1_8/numeric.c =================================================================== --- ruby_1_8/numeric.c (revision 23051) +++ ruby_1_8/numeric.c (revision 23052) @@ -281,7 +281,7 @@ } -static VALUE num_floor(VALUE num); +static VALUE num_floor _((VALUE)); /* * call-seq: @@ -1816,7 +1816,8 @@ */ 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 @@ */ 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 @@ */ static VALUE -int_pred(VALUE num) +int_pred(num) + VALUE num; { if (FIXNUM_P(num)) { long i = FIX2LONG(num) - 1; @@ -2999,7 +3002,8 @@ */ static VALUE -fix_odd_p(VALUE num) +fix_odd_p(num) + VALUE num; { if (num & 2) { return Qtrue; @@ -3015,7 +3019,8 @@ */ static VALUE -fix_even_p(VALUE num) +fix_even_p(num) + VALUE num; { if (num & 2) { return Qfalse; Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 23051) +++ ruby_1_8/ChangeLog (revision 23052) @@ -1,3 +1,11 @@ +Mon Mar 23 21:07:09 2009 Akinori MUSHA <knu@i...> + + * 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 <nobu@r...> * lib/test/unit.rb: use Kernel.exit to get rid of using Index: ruby_1_8/re.c =================================================================== --- ruby_1_8/re.c (revision 23051) +++ ruby_1_8/re.c (revision 23052) @@ -682,8 +682,10 @@ 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 @@ */ static VALUE -match_inspect(VALUE match) +match_inspect(match) + VALUE match; { const char *cname = rb_obj_classname(match); VALUE str; @@ -2101,7 +2104,8 @@ * 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 && Index: ruby_1_8/enumerator.c =================================================================== --- ruby_1_8/enumerator.c (revision 23051) +++ ruby_1_8/enumerator.c (revision 23052) @@ -655,8 +655,11 @@ 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; Index: ruby_1_8/object.c =================================================================== --- ruby_1_8/object.c (revision 23051) +++ ruby_1_8/object.c (revision 23052) @@ -1239,7 +1239,8 @@ */ 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 @@ } VALUE -rb_check_to_integer(VALUE val, const char *method) +rb_check_to_integer(val, method) + VALUE val; + const char *method; { VALUE v; Index: ruby_1_8/string.c =================================================================== --- ruby_1_8/string.c (revision 23051) +++ ruby_1_8/string.c (revision 23052) @@ -514,7 +514,8 @@ } static inline void -str_discard(VALUE str) +str_discard(str) + VALUE str; { if (str_independent(str)) { xfree(RSTRING_PTR(str)); @@ -716,7 +717,9 @@ } 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 @@ */ static VALUE -rb_str_each_char(VALUE str) +rb_str_each_char(str) + VALUE str; { int i, len, n; const char *ptr; Index: ruby_1_8/io.c =================================================================== --- ruby_1_8/io.c (revision 23051) +++ ruby_1_8/io.c (revision 23052) @@ -1196,7 +1196,8 @@ 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 @@ */ 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 @@ 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 @@ /* * 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 @@ /* * 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 @@ /* * 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_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 @@ 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); Index: ruby_1_8/bignum.c =================================================================== --- ruby_1_8/bignum.c (revision 23051) +++ ruby_1_8/bignum.c (revision 23052) @@ -757,7 +757,9 @@ } 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 @@ 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) { Index: ruby_1_8/dir.c =================================================================== --- ruby_1_8/dir.c (revision 23051) +++ ruby_1_8/dir.c (revision 23052) @@ -1611,8 +1611,13 @@ 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; Index: ruby_1_8/struct.c =================================================================== --- ruby_1_8/struct.c (revision 23051) +++ ruby_1_8/struct.c (revision 23052) @@ -325,8 +325,11 @@ 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__"); Index: ruby_1_8/gc.c =================================================================== --- ruby_1_8/gc.c (revision 23051) +++ ruby_1_8/gc.c (revision 23052) @@ -1630,11 +1630,14 @@ #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 @@ */ VALUE -rb_obj_id(VALUE obj) +rb_obj_id(obj) + VALUE obj; { /* * 32-bit VALUE space -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/