summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-12 10:44:21 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-12 10:44:21 +0000
commitdda5dc00cff334cac373096d444a0fd59e716124 (patch)
treed9ab9c1dc4cede235a3bbaea653c07f38ea880b9
parent51e25545aeb1555051b95c5b31b4f3ca6ec6b6fe (diff)
* array.c: moved to ANSI function style from K&R function style.
(used protoize on windows, so still K&R remains on #ifdef part of other platforms. And `foo _((boo))' stuff is still there) [ruby-dev:26975] * bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c, prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c, regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c, sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c, version.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog15
-rw-r--r--array.c10
-rw-r--r--bignum.c210
-rw-r--r--class.c208
-rw-r--r--compar.c31
-rw-r--r--dir.c228
-rw-r--r--dln.c26
-rw-r--r--dmyext.c2
-rw-r--r--enum.c166
-rw-r--r--enumerator.c80
-rw-r--r--error.c248
-rw-r--r--eval.c1353
-rw-r--r--file.c456
-rw-r--r--gc.c186
-rw-r--r--hash.c375
-rw-r--r--inits.c2
-rw-r--r--io.c626
-rw-r--r--main.c4
-rw-r--r--marshal.c162
-rw-r--r--math.c68
-rw-r--r--numeric.c336
-rw-r--r--object.c331
-rw-r--r--pack.c40
-rw-r--r--prec.c17
-rw-r--r--process.c271
-rw-r--r--random.c24
-rw-r--r--range.c97
-rw-r--r--re.c285
-rw-r--r--regcomp.c8
-rw-r--r--regenc.c4
-rw-r--r--regerror.c28
-rw-r--r--regexec.c2
-rw-r--r--regparse.c12
-rw-r--r--regparse.h2
-rw-r--r--ruby.c79
-rw-r--r--signal.c69
-rw-r--r--sprintf.c44
-rw-r--r--st.c72
-rw-r--r--string.c547
-rw-r--r--struct.c150
-rw-r--r--time.c212
-rw-r--r--util.h2
-rw-r--r--variable.c425
-rw-r--r--version.c6
44 files changed, 2211 insertions, 5308 deletions
diff --git a/ChangeLog b/ChangeLog
index 6737cf86f6..da47ee1893 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Mon Sep 12 19:26:29 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * array.c: moved to ANSI function style from K&R function style.
+ (used protoize on windows, so still K&R remains on #ifdef part of
+ other platforms. And `foo _((boo))' stuff is still there)
+ [ruby-dev:26975]
+
+ * bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c,
+ enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c,
+ io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c,
+ prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c,
+ regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c,
+ sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c,
+ version.c: ditto.
+
Sun Sep 11 23:23:02 2005 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (starttls): supported the STARTTLS command.
diff --git a/array.c b/array.c
index c77485b9ea..61c27b8f4a 100644
--- a/array.c
+++ b/array.c
@@ -135,13 +135,7 @@ rb_ary_new(void)
return rb_ary_new2(ARY_DEFAULT_SIZE);
}
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
VALUE
rb_ary_new3(long n, ...)
@@ -152,7 +146,7 @@ rb_ary_new3(long n, ...)
ary = rb_ary_new2(n);
- va_init_list(ar, n);
+ va_start(ar, n);
for (i=0; i<n; i++) {
RARRAY(ary)->ptr[i] = va_arg(ar, VALUE);
}
@@ -184,7 +178,7 @@ rb_values_new(long n, ...)
long i;
val = ary_new(rb_cValues, n);
- va_init_list(ar, n);
+ va_start(ar, n);
for (i=0; i<n; i++) {
RARRAY(val)->ptr[i] = va_arg(ar, VALUE);
}
diff --git a/bignum.c b/bignum.c
index 7c1d97bcde..1f88d7316a 100644
--- a/bignum.c
+++ b/bignum.c
@@ -39,10 +39,7 @@ VALUE rb_cBignum;
#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0))
static VALUE
-bignew_1(klass, len, sign)
- VALUE klass;
- long len;
- int sign;
+bignew_1(VALUE klass, long len, int sign)
{
NEWOBJ(big, struct RBignum);
OBJSETUP(big, klass, T_BIGNUM);
@@ -56,8 +53,7 @@ bignew_1(klass, len, sign)
#define bignew(len,sign) bignew_1(rb_cBignum,len,sign)
VALUE
-rb_big_clone(x)
- VALUE x;
+rb_big_clone(VALUE x)
{
VALUE z = bignew_1(CLASS_OF(x), RBIGNUM(x)->len, RBIGNUM(x)->sign);
@@ -88,15 +84,13 @@ get2comp(VALUE x)
}
void
-rb_big_2comp(x) /* get 2's complement */
- VALUE x;
+rb_big_2comp(VALUE x) /* get 2's complement */
{
get2comp(x);
}
static VALUE
-bignorm(x)
- VALUE x;
+bignorm(VALUE x)
{
if (!FIXNUM_P(x)) {
long len = RBIGNUM(x)->len;
@@ -122,15 +116,13 @@ bignorm(x)
}
VALUE
-rb_big_norm(x)
- VALUE x;
+rb_big_norm(VALUE x)
{
return bignorm(x);
}
VALUE
-rb_uint2big(n)
- unsigned long n;
+rb_uint2big(unsigned long n)
{
BDIGIT_DBL num = n;
long i = 0;
@@ -151,8 +143,7 @@ rb_uint2big(n)
}
VALUE
-rb_int2big(n)
- long n;
+rb_int2big(long n)
{
long neg = 0;
VALUE big;
@@ -169,16 +160,14 @@ rb_int2big(n)
}
VALUE
-rb_uint2inum(n)
- unsigned long n;
+rb_uint2inum(unsigned long n)
{
if (POSFIXABLE(n)) return LONG2FIX(n);
return rb_uint2big(n);
}
VALUE
-rb_int2inum(n)
- long n;
+rb_int2inum(long n)
{
if (FIXABLE(n)) return LONG2FIX(n);
return rb_int2big(n);
@@ -187,9 +176,7 @@ rb_int2inum(n)
#ifdef HAVE_LONG_LONG
void
-rb_quad_pack(buf, val)
- char *buf;
- VALUE val;
+rb_quad_pack(char *buf, VALUE val)
{
LONG_LONG q;
@@ -216,9 +203,7 @@ rb_quad_pack(buf, val)
}
VALUE
-rb_quad_unpack(buf, sign)
- const char *buf;
- int sign;
+rb_quad_unpack(const char *buf, int sign)
{
unsigned LONG_LONG q;
long neg = 0;
@@ -313,10 +298,7 @@ rb_quad_unpack(buf, sign)
#endif
VALUE
-rb_cstr_to_inum(str, base, badcheck)
- const char *str;
- int base;
- int badcheck;
+rb_cstr_to_inum(const char *str, int base, int badcheck)
{
const char *s = str;
char *end;
@@ -508,10 +490,7 @@ rb_cstr_to_inum(str, base, badcheck)
}
VALUE
-rb_str_to_inum(str, base, badcheck)
- VALUE str;
- int base;
- int badcheck;
+rb_str_to_inum(VALUE str, int base, int badcheck)
{
char *s;
long len;
@@ -539,8 +518,7 @@ rb_str_to_inum(str, base, badcheck)
#if HAVE_LONG_LONG
VALUE
-rb_ull2big(n)
- unsigned LONG_LONG n;
+rb_ull2big(unsigned LONG_LONG n)
{
BDIGIT_DBL num = n;
long i = 0;
@@ -561,8 +539,7 @@ rb_ull2big(n)
}
VALUE
-rb_ll2big(n)
- LONG_LONG n;
+rb_ll2big(LONG_LONG n)
{
long neg = 0;
VALUE big;
@@ -579,16 +556,14 @@ rb_ll2big(n)
}
VALUE
-rb_ull2inum(n)
- unsigned LONG_LONG n;
+rb_ull2inum(unsigned LONG_LONG n)
{
if (POSFIXABLE(n)) return LONG2FIX(n);
return rb_ull2big(n);
}
VALUE
-rb_ll2inum(n)
- LONG_LONG n;
+rb_ll2inum(LONG_LONG n)
{
if (FIXABLE(n)) return LONG2FIX(n);
return rb_ll2big(n);
@@ -597,26 +572,20 @@ rb_ll2inum(n)
#endif /* HAVE_LONG_LONG */
VALUE
-rb_cstr2inum(str, base)
- const char *str;
- int base;
+rb_cstr2inum(const char *str, int base)
{
return rb_cstr_to_inum(str, base, base==0);
}
VALUE
-rb_str2inum(str, base)
- VALUE str;
- int base;
+rb_str2inum(VALUE str, int base)
{
return rb_str_to_inum(str, base, base==0);
}
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
VALUE
-rb_big2str(x, base)
- VALUE x;
- int base;
+rb_big2str(VALUE x, int base)
{
volatile VALUE t;
BDIGIT *ds;
@@ -712,10 +681,7 @@ rb_big2str(x, base)
*/
static VALUE
-rb_big_to_s(argc, argv, x)
- int argc;
- VALUE *argv;
- VALUE x;
+rb_big_to_s(int argc, VALUE *argv, VALUE x)
{
VALUE b;
int base;
@@ -727,10 +693,7 @@ rb_big_to_s(argc, argv, x)
}
static unsigned long
-big2ulong(x, type, check)
- VALUE x;
- char *type;
- int check;
+big2ulong(VALUE x, char *type, int check)
{
long len = RBIGNUM(x)->len;
BDIGIT_DBL num;
@@ -751,8 +714,7 @@ big2ulong(x, type, check)
}
unsigned long
-rb_big2ulong_pack(x)
- VALUE x;
+rb_big2ulong_pack(VALUE x)
{
unsigned long num = big2ulong(x, "unsigned long", Qfalse);
if (!RBIGNUM(x)->sign) {
@@ -762,8 +724,7 @@ rb_big2ulong_pack(x)
}
unsigned long
-rb_big2ulong(x)
- VALUE x;
+rb_big2ulong(VALUE x)
{
unsigned long num = big2ulong(x, "unsigned long", Qtrue);
@@ -777,8 +738,7 @@ rb_big2ulong(x)
}
long
-rb_big2long(x)
- VALUE x;
+rb_big2long(VALUE x)
{
unsigned long num = big2ulong(x, "long", Qtrue);
@@ -792,9 +752,7 @@ rb_big2long(x)
#if HAVE_LONG_LONG
static unsigned LONG_LONG
-big2ull(x, type)
- VALUE x;
- char *type;
+big2ull(VALUE x, char *type)
{
long len = RBIGNUM(x)->len;
BDIGIT_DBL num;
@@ -812,8 +770,7 @@ big2ull(x, type)
}
unsigned LONG_LONG
-rb_big2ull(x)
- VALUE x;
+rb_big2ull(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "unsigned long long");
@@ -822,8 +779,7 @@ rb_big2ull(x)
}
LONG_LONG
-rb_big2ll(x)
- VALUE x;
+rb_big2ll(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "long long");
@@ -838,8 +794,7 @@ rb_big2ll(x)
#endif /* HAVE_LONG_LONG */
static VALUE
-dbl2big(d)
- double d;
+dbl2big(double d)
{
long i = 0;
BDIGIT c;
@@ -871,15 +826,13 @@ dbl2big(d)
}
VALUE
-rb_dbl2big(d)
- double d;
+rb_dbl2big(double d)
{
return bignorm(dbl2big(d));
}
double
-rb_big2dbl(x)
- VALUE x;
+rb_big2dbl(VALUE x)
{
double d = 0.0;
long i = RBIGNUM(x)->len;
@@ -906,8 +859,7 @@ rb_big2dbl(x)
*/
static VALUE
-rb_big_to_f(x)
- VALUE x;
+rb_big_to_f(VALUE x)
{
return rb_float_new(rb_big2dbl(x));
}
@@ -923,8 +875,7 @@ rb_big_to_f(x)
*/
VALUE
-rb_big_cmp(x, y)
- VALUE x, y;
+rb_big_cmp(VALUE x, VALUE y)
{
long xlen = RBIGNUM(x)->len;
@@ -969,8 +920,7 @@ rb_big_cmp(x, y)
*/
VALUE
-rb_big_eq(x, y)
- VALUE x, y;
+rb_big_eq(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -1008,8 +958,7 @@ rb_big_eq(x, y)
*/
static VALUE
-rb_big_eql(x, y)
- VALUE x, y;
+rb_big_eql(VALUE x, VALUE y)
{
if (TYPE(y) != T_BIGNUM) return Qfalse;
if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse;
@@ -1026,8 +975,7 @@ rb_big_eql(x, y)
*/
static VALUE
-rb_big_uminus(x)
- VALUE x;
+rb_big_uminus(VALUE x)
{
VALUE z = rb_big_clone(x);
@@ -1036,8 +984,6 @@ rb_big_uminus(x)
return bignorm(z);
}
-static VALUE bigadd _((VALUE,VALUE,int));
-
/*
* call-seq:
* ~big => integer
@@ -1051,8 +997,7 @@ static VALUE bigadd _((VALUE,VALUE,int));
*/
static VALUE
-rb_big_neg(x)
- VALUE x;
+rb_big_neg(VALUE x)
{
VALUE z = rb_big_clone(x);
BDIGIT *ds;
@@ -1071,8 +1016,7 @@ rb_big_neg(x)
}
static VALUE
-bigsub(x, y)
- VALUE x, y;
+bigsub(VALUE x, VALUE y)
{
VALUE z = 0;
BDIGIT *zds;
@@ -1118,9 +1062,7 @@ bigsub(x, y)
}
static VALUE
-bigadd(x, y, sign)
- VALUE x, y;
- int sign;
+bigadd(VALUE x, VALUE y, int sign)
{
VALUE z;
BDIGIT_DBL num;
@@ -1170,8 +1112,7 @@ bigadd(x, y, sign)
*/
VALUE
-rb_big_plus(x, y)
- VALUE x, y;
+rb_big_plus(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -1196,8 +1137,7 @@ rb_big_plus(x, y)
*/
VALUE
-rb_big_minus(x, y)
- VALUE x, y;
+rb_big_minus(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -1215,8 +1155,7 @@ rb_big_minus(x, y)
}
static VALUE
-rb_big_mul0(x, y)
- VALUE x, y;
+rb_big_mul0(VALUE x, VALUE y)
{
long i, j;
BDIGIT_DBL n = 0;
@@ -1267,16 +1206,13 @@ rb_big_mul0(x, y)
*/
VALUE
-rb_big_mul(x, y)
- VALUE x, y;
+rb_big_mul(VALUE x, VALUE y)
{
return bignorm(rb_big_mul0(x, y));
}
static void
-bigdivrem(x, y, divp, modp)
- VALUE x, y;
- VALUE *divp, *modp;
+bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
{
long nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len;
long i, j;
@@ -1404,9 +1340,7 @@ bigdivrem(x, y, divp, modp)
}
static void
-bigdivmod(x, y, divp, modp)
- VALUE x, y;
- VALUE *divp, *modp;
+bigdivmod(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
{
VALUE mod;
@@ -1430,8 +1364,7 @@ bigdivmod(x, y, divp, modp)
*/
VALUE
-rb_big_div(x, y)
- VALUE x, y;
+rb_big_div(VALUE x, VALUE y)
{
VALUE z;
@@ -1464,8 +1397,7 @@ rb_big_div(x, y)
*/
VALUE
-rb_big_modulo(x, y)
- VALUE x, y;
+rb_big_modulo(VALUE x, VALUE y)
{
VALUE z;
@@ -1495,8 +1427,7 @@ rb_big_modulo(x, y)
* -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
*/
static VALUE
-rb_big_remainder(x, y)
- VALUE x, y;
+rb_big_remainder(VALUE x, VALUE y)
{
VALUE z;
@@ -1524,8 +1455,7 @@ rb_big_remainder(x, y)
*
*/
VALUE
-rb_big_divmod(x, y)
- VALUE x, y;
+rb_big_divmod(VALUE x, VALUE y)
{
VALUE div, mod;
@@ -1558,8 +1488,7 @@ rb_big_divmod(x, y)
*/
static VALUE
-rb_big_quo(x, y)
- VALUE x, y;
+rb_big_quo(VALUE x, VALUE y)
{
double dx = rb_big2dbl(x);
double dy;
@@ -1597,8 +1526,7 @@ rb_big_quo(x, y)
*/
VALUE
-rb_big_pow(x, y)
- VALUE x, y;
+rb_big_pow(VALUE x, VALUE y)
{
double d;
long yy;
@@ -1647,8 +1575,7 @@ rb_big_pow(x, y)
*/
VALUE
-rb_big_and(xx, yy)
- VALUE xx, yy;
+rb_big_and(VALUE xx, VALUE yy)
{
volatile VALUE x, y, z;
BDIGIT *ds1, *ds2, *zds;
@@ -1703,8 +1630,7 @@ rb_big_and(xx, yy)
*/
VALUE
-rb_big_or(xx, yy)
- VALUE xx, yy;
+rb_big_or(VALUE xx, VALUE yy)
{
volatile VALUE x, y, z;
BDIGIT *ds1, *ds2, *zds;
@@ -1761,8 +1687,7 @@ rb_big_or(xx, yy)
*/
VALUE
-rb_big_xor(xx, yy)
- VALUE xx, yy;
+rb_big_xor(VALUE xx, VALUE yy)
{
volatile VALUE x, y;
VALUE z;
@@ -1824,8 +1749,7 @@ static VALUE rb_big_rshift _((VALUE,VALUE));
*/
VALUE
-rb_big_lshift(x, y)
- VALUE x, y;
+rb_big_lshift(VALUE x, VALUE y)
{
BDIGIT *xds, *zds;
int shift = NUM2INT(y);
@@ -1860,8 +1784,7 @@ rb_big_lshift(x, y)
*/
static VALUE
-rb_big_rshift(x, y)
- VALUE x, y;
+rb_big_rshift(VALUE x, VALUE y)
{
BDIGIT *xds, *zds;
int shift = NUM2INT(y);
@@ -1921,8 +1844,7 @@ rb_big_rshift(x, y)
*/
static VALUE
-rb_big_aref(x, y)
- VALUE x, y;
+rb_big_aref(VALUE x, VALUE y)
{
BDIGIT *xds;
int shift;
@@ -1960,8 +1882,7 @@ rb_big_aref(x, y)
*/
static VALUE
-rb_big_hash(x)
- VALUE x;
+rb_big_hash(VALUE x)
{
long i, len, key;
BDIGIT *digits;
@@ -1978,8 +1899,7 @@ rb_big_hash(x)
*/
static VALUE
-rb_big_coerce(x, y)
- VALUE x, y;
+rb_big_coerce(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
return rb_assoc_new(rb_int2big(FIX2LONG(y)), x);
@@ -2005,8 +1925,7 @@ rb_big_coerce(x, y)
*/
static VALUE
-rb_big_abs(x)
- VALUE x;
+rb_big_abs(VALUE x)
{
if (!RBIGNUM(x)->sign) {
x = rb_big_clone(x);
@@ -2016,9 +1935,7 @@ rb_big_abs(x)
}
VALUE
-rb_big_rand(max, rand_buf)
- VALUE max;
- double *rand_buf;
+rb_big_rand(VALUE max, double *rand_buf)
{
VALUE v;
long len = RBIGNUM(max)->len;
@@ -2049,8 +1966,7 @@ rb_big_rand(max, rand_buf)
*/
static VALUE
-rb_big_size(big)
- VALUE big;
+rb_big_size(VALUE big)
{
return LONG2FIX(RBIGNUM(big)->len*SIZEOF_BDIGITS);
}
@@ -2074,7 +1990,7 @@ rb_big_size(big)
*/
void
-Init_Bignum()
+Init_Bignum(void)
{
rb_cBignum = rb_define_class("Bignum", rb_cInteger);
diff --git a/class.c b/class.c
index a950b44de2..d93d772f03 100644
--- a/class.c
+++ b/class.c
@@ -19,8 +19,7 @@
extern st_table *rb_class_tbl;
VALUE
-rb_class_boot(super)
- VALUE super;
+rb_class_boot(VALUE super)
{
NEWOBJ(klass, struct RClass);
OBJSETUP(klass, rb_cClass, T_CLASS);
@@ -35,8 +34,7 @@ rb_class_boot(super)
}
void
-rb_check_inheritable(super)
- VALUE super;
+rb_check_inheritable(VALUE super)
{
if (TYPE(super) != T_CLASS) {
rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
@@ -48,8 +46,7 @@ rb_check_inheritable(super)
}
VALUE
-rb_class_new(super)
- VALUE super;
+rb_class_new(VALUE super)
{
Check_Type(super, T_CLASS);
rb_check_inheritable(super);
@@ -60,10 +57,7 @@ rb_class_new(super)
}
static int
-clone_method(mid, body, tbl)
- ID mid;
- NODE *body;
- st_table *tbl;
+clone_method(ID mid, NODE *body, st_table *tbl)
{
st_insert(tbl, mid, (st_data_t)NEW_METHOD(body->nd_body, body->nd_noex));
return ST_CONTINUE;
@@ -71,8 +65,7 @@ clone_method(mid, body, tbl)
/* :nodoc: */
VALUE
-rb_mod_init_copy(clone, orig)
- VALUE clone, orig;
+rb_mod_init_copy(VALUE clone, VALUE orig)
{
rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
@@ -99,8 +92,7 @@ rb_mod_init_copy(clone, orig)
/* :nodoc: */
VALUE
-rb_class_init_copy(clone, orig)
- VALUE clone, orig;
+rb_class_init_copy(VALUE clone, VALUE orig)
{
if (RCLASS(clone)->super != 0) {
rb_raise(rb_eTypeError, "already initialized class");
@@ -112,8 +104,7 @@ rb_class_init_copy(clone, orig)
}
VALUE
-rb_singleton_class_clone(obj)
- VALUE obj;
+rb_singleton_class_clone(VALUE obj)
{
VALUE klass = RBASIC(obj)->klass;
@@ -147,8 +138,7 @@ rb_singleton_class_clone(obj)
}
void
-rb_singleton_class_attached(klass, obj)
- VALUE klass, obj;
+rb_singleton_class_attached(VALUE klass, VALUE obj)
{
if (FL_TEST(klass, FL_SINGLETON)) {
if (!RCLASS(klass)->iv_tbl) {
@@ -159,8 +149,7 @@ rb_singleton_class_attached(klass, obj)
}
VALUE
-rb_make_metaclass(obj, super)
- VALUE obj, super;
+rb_make_metaclass(VALUE obj, VALUE super)
{
if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) {
return RBASIC(obj)->klass = rb_cClass;
@@ -183,9 +172,7 @@ rb_make_metaclass(obj, super)
}
VALUE
-rb_define_class_id(id, super)
- ID id;
- VALUE super;
+rb_define_class_id(ID id, VALUE super)
{
VALUE klass;
@@ -197,17 +184,14 @@ rb_define_class_id(id, super)
}
VALUE
-rb_class_inherited(super, klass)
- VALUE super, klass;
+rb_class_inherited(VALUE super, VALUE klass)
{
if (!super) super = rb_cObject;
return rb_funcall(super, rb_intern("inherited"), 1, klass);
}
VALUE
-rb_define_class(name, super)
- const char *name;
- VALUE super;
+rb_define_class(const char *name, VALUE super)
{
VALUE klass;
ID id;
@@ -236,10 +220,7 @@ rb_define_class(name, super)
}
VALUE
-rb_define_class_under(outer, name, super)
- VALUE outer;
- const char *name;
- VALUE super;
+rb_define_class_under(VALUE outer, const char *name, VALUE super)
{
VALUE klass;
ID id;
@@ -268,7 +249,7 @@ rb_define_class_under(outer, name, super)
}
VALUE
-rb_module_new()
+rb_module_new(void)
{
NEWOBJ(mdl, struct RClass);
OBJSETUP(mdl, rb_cModule, T_MODULE);
@@ -282,8 +263,7 @@ rb_module_new()
}
VALUE
-rb_define_module_id(id)
- ID id;
+rb_define_module_id(ID id)
{
VALUE mdl;
@@ -294,8 +274,7 @@ rb_define_module_id(id)
}
VALUE
-rb_define_module(name)
- const char *name;
+rb_define_module(const char *name)
{
VALUE module;
ID id;
@@ -315,9 +294,7 @@ rb_define_module(name)
}
VALUE
-rb_define_module_under(outer, name)
- VALUE outer;
- const char *name;
+rb_define_module_under(VALUE outer, const char *name)
{
VALUE module;
ID id;
@@ -338,8 +315,7 @@ rb_define_module_under(outer, name)
}
static VALUE
-include_class_new(module, super)
- VALUE module, super;
+include_class_new(VALUE module, VALUE super)
{
NEWOBJ(klass, struct RClass);
OBJSETUP(klass, rb_cClass, T_ICLASS);
@@ -366,8 +342,7 @@ include_class_new(module, super)
}
void
-rb_include_module(klass, module)
- VALUE klass, module;
+rb_include_module(VALUE klass, VALUE module)
{
VALUE p, c;
int changed = 0;
@@ -434,8 +409,7 @@ rb_include_module(klass, module)
*/
VALUE
-rb_mod_included_modules(mod)
- VALUE mod;
+rb_mod_included_modules(VALUE mod)
{
VALUE ary = rb_ary_new();
VALUE p;
@@ -468,9 +442,7 @@ rb_mod_included_modules(mod)
*/
VALUE
-rb_mod_include_p(mod, mod2)
- VALUE mod;
- VALUE mod2;
+rb_mod_include_p(VALUE mod, VALUE mod2)
{
VALUE p;
@@ -500,8 +472,7 @@ rb_mod_include_p(mod, mod2)
*/
VALUE
-rb_mod_ancestors(mod)
- VALUE mod;
+rb_mod_ancestors(VALUE mod)
{
VALUE p, ary = rb_ary_new();
@@ -522,11 +493,7 @@ rb_mod_ancestors(mod)
#define VISI_CHECK(x,f) (VISI(x) == (f))
static int
-ins_methods_push(name, type, ary, visi)
- ID name;
- long type;
- VALUE ary;
- long visi;
+ins_methods_push(ID name, long type, VALUE ary, long visi)
{
if (type == -1) return ST_CONTINUE;
switch (visi) {
@@ -546,46 +513,31 @@ ins_methods_push(name, type, ary, visi)
}
static int
-ins_methods_i(name, type, ary)
- ID name;
- long type;
- VALUE ary;
+ins_methods_i(ID name, long type, VALUE ary)
{
return ins_methods_push(name, type, ary, -1); /* everything but private */
}
static int
-ins_methods_prot_i(name, type, ary)
- ID name;
- long type;
- VALUE ary;
+ins_methods_prot_i(ID name, long type, VALUE ary)
{
return ins_methods_push(name, type, ary, NOEX_PROTECTED);
}
static int
-ins_methods_priv_i(name, type, ary)
- ID name;
- long type;
- VALUE ary;
+ins_methods_priv_i(ID name, long type, VALUE ary)
{
return ins_methods_push(name, type, ary, NOEX_PRIVATE);
}
static int
-ins_methods_pub_i(name, type, ary)
- ID name;
- long type;
- VALUE ary;
+ins_methods_pub_i(ID name, long type, VALUE ary)
{
return ins_methods_push(name, type, ary, NOEX_PUBLIC);
}
static int
-method_entry(key, body, list)
- ID key;
- NODE *body;
- st_table *list;
+method_entry(ID key, NODE *body, st_table *list)
{
long type;
@@ -599,11 +551,7 @@ method_entry(key, body, list)
}
static VALUE
-class_instance_method_list(argc, argv, mod, func)
- int argc;
- VALUE *argv;
- VALUE mod;
- int (*func) _((ID, long, VALUE));
+class_instance_method_list(int argc, VALUE *argv, VALUE mod, int (*func) (ID, long, VALUE))
{
VALUE ary;
int recur;
@@ -660,10 +608,7 @@ class_instance_method_list(argc, argv, mod, func)
*/
VALUE
-rb_class_instance_methods(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, ins_methods_i);
}
@@ -678,10 +623,7 @@ rb_class_instance_methods(argc, argv, mod)
*/
VALUE
-rb_class_protected_instance_methods(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, ins_methods_prot_i);
}
@@ -704,10 +646,7 @@ rb_class_protected_instance_methods(argc, argv, mod)
*/
VALUE
-rb_class_private_instance_methods(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, ins_methods_priv_i);
}
@@ -722,10 +661,7 @@ rb_class_private_instance_methods(argc, argv, mod)
*/
VALUE
-rb_class_public_instance_methods(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, ins_methods_pub_i);
}
@@ -763,10 +699,7 @@ rb_class_public_instance_methods(argc, argv, mod)
*/
VALUE
-rb_obj_singleton_methods(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj)
{
VALUE recur, ary, klass;
st_table *list;
@@ -795,49 +728,31 @@ rb_obj_singleton_methods(argc, argv, obj)
}
void
-rb_define_method_id(klass, name, func, argc)
- VALUE klass;
- ID name;
- VALUE (*func)();
- int argc;
+rb_define_method_id(VALUE klass, ID name, VALUE (*func) (/* ??? */), int argc)
{
rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
}
void
-rb_define_method(klass, name, func, argc)
- VALUE klass;
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_method(VALUE klass, const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PUBLIC);
}
void
-rb_define_protected_method(klass, name, func, argc)
- VALUE klass;
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_protected_method(VALUE klass, const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PROTECTED);
}
void
-rb_define_private_method(klass, name, func, argc)
- VALUE klass;
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PRIVATE);
}
void
-rb_undef_method(klass, name)
- VALUE klass;
- const char *name;
+rb_undef_method(VALUE klass, const char *name)
{
rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF);
}
@@ -849,8 +764,7 @@ rb_undef_method(klass, name)
} while (0)
VALUE
-rb_singleton_class(obj)
- VALUE obj;
+rb_singleton_class(VALUE obj)
{
VALUE klass;
@@ -885,77 +799,47 @@ rb_singleton_class(obj)
}
void
-rb_define_singleton_method(obj, name, func, argc)
- VALUE obj;
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_singleton_method(VALUE obj, const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_define_method(rb_singleton_class(obj), name, func, argc);
}
void
-rb_define_module_function(module, name, func, argc)
- VALUE module;
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_module_function(VALUE module, const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_define_private_method(module, name, func, argc);
rb_define_singleton_method(module, name, func, argc);
}
void
-rb_define_global_function(name, func, argc)
- const char *name;
- VALUE (*func)();
- int argc;
+rb_define_global_function(const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_define_module_function(rb_mKernel, name, func, argc);
}
void
-rb_define_alias(klass, name1, name2)
- VALUE klass;
- const char *name1, *name2;
+rb_define_alias(VALUE klass, const char *name1, const char *name2)
{
rb_alias(klass, rb_intern(name1), rb_intern(name2));
}
void
-rb_define_attr(klass, name, read, write)
- VALUE klass;
- const char *name;
- int read, write;
+rb_define_attr(VALUE klass, const char *name, int read, int write)
{
rb_attr(klass, rb_intern(name), read, write, Qfalse);
}
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
int
-#ifdef HAVE_STDARG_PROTOTYPES
rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
-#else
-rb_scan_args(argc, argv, fmt, va_alist)
- int argc;
- const VALUE *argv;
- const char *fmt;
- va_dcl
-#endif
{
int n, i = 0;
const char *p = fmt;
VALUE *var;
va_list vargs;
- va_init_list(vargs, fmt);
+ va_start(vargs, fmt);
if (*p == '*') goto rest_arg;
diff --git a/compar.c b/compar.c
index a3ee684778..fd06cf0c15 100644
--- a/compar.c
+++ b/compar.c
@@ -17,8 +17,7 @@ VALUE rb_mComparable;
static ID cmp;
int
-rb_cmpint(val, a, b)
- VALUE val, a, b;
+rb_cmpint(VALUE val, VALUE a, VALUE b)
{
if (NIL_P(val)) {
rb_cmperr(a, b);
@@ -34,8 +33,7 @@ rb_cmpint(val, a, b)
}
void
-rb_cmperr(x, y)
- VALUE x, y;
+rb_cmperr(VALUE x, VALUE y)
{
const char *classname;
@@ -51,8 +49,7 @@ rb_cmperr(x, y)
}
static VALUE
-cmp_eq(a)
- VALUE *a;
+cmp_eq(VALUE *a)
{
VALUE c = rb_funcall(a[0], cmp, 1, a[1]);
@@ -62,7 +59,7 @@ cmp_eq(a)
}
static VALUE
-cmp_failed()
+cmp_failed(void)
{
return Qnil;
}
@@ -77,8 +74,7 @@ cmp_failed()
*/
static VALUE
-cmp_equal(x, y)
- VALUE x, y;
+cmp_equal(VALUE x, VALUE y)
{
VALUE a[2];
@@ -97,8 +93,7 @@ cmp_equal(x, y)
*/
static VALUE
-cmp_gt(x, y)
- VALUE x, y;
+cmp_gt(VALUE x, VALUE y)
{
VALUE c = rb_funcall(x, cmp, 1, y);
@@ -115,8 +110,7 @@ cmp_gt(x, y)
*/
static VALUE
-cmp_ge(x, y)
- VALUE x, y;
+cmp_ge(VALUE x, VALUE y)
{
VALUE c = rb_funcall(x, cmp, 1, y);
@@ -133,8 +127,7 @@ cmp_ge(x, y)
*/
static VALUE
-cmp_lt(x, y)
- VALUE x, y;
+cmp_lt(VALUE x, VALUE y)
{
VALUE c = rb_funcall(x, cmp, 1, y);
@@ -152,8 +145,7 @@ cmp_lt(x, y)
*/
static VALUE
-cmp_le(x, y)
- VALUE x, y;
+cmp_le(VALUE x, VALUE y)
{
VALUE c = rb_funcall(x, cmp, 1, y);
@@ -177,8 +169,7 @@ cmp_le(x, y)
*/
static VALUE
-cmp_between(x, min, max)
- VALUE x, min, max;
+cmp_between(VALUE x, VALUE min, VALUE max)
{
if (RTEST(cmp_lt(x, min))) return Qfalse;
if (RTEST(cmp_gt(x, max))) return Qfalse;
@@ -223,7 +214,7 @@ cmp_between(x, min, max)
*/
void
-Init_Comparable()
+Init_Comparable(void)
{
rb_mComparable = rb_define_module("Comparable");
rb_define_method(rb_mComparable, "==", cmp_equal, 1);
diff --git a/dir.c b/dir.c
index e2991cac52..6762fbf8e6 100644
--- a/dir.c
+++ b/dir.c
@@ -105,10 +105,7 @@ emx_mblen(p)
# define Inc(p) ((p) = Next(p))
# define Compare(p1, p2) (CompareImpl(p1, p2, nocase))
static int
-CompareImpl(p1, p2, nocase)
- const char *p1;
- const char *p2;
- int nocase;
+CompareImpl(const char *p1, const char *p2, int nocase)
{
const int len1 = Next(p1) - p1;
const int len2 = Next(p2) - p2;
@@ -165,10 +162,10 @@ CompareImpl(p1, p2, nocase)
#endif /* environment */
static char *
-bracket(p, s, flags)
- const char *p; /* pattern (next to '[') */
- const char *s; /* string */
- int flags;
+bracket(
+ const char *p, /* pattern (next to '[') */
+ const char *s, /* string */
+ int flags)
{
const int nocase = flags & FNM_CASEFOLD;
const int escape = !(flags & FNM_NOESCAPE);
@@ -215,10 +212,10 @@ bracket(p, s, flags)
#define RETURN(val) return *pcur = p, *scur = s, (val);
static int
-fnmatch_helper(pcur, scur, flags)
- const char **pcur; /* pattern */
- const char **scur; /* string */
- int flags;
+fnmatch_helper(
+ const char **pcur, /* pattern */
+ const char **scur, /* string */
+ int flags)
{
const int period = !(flags & FNM_DOTMATCH);
const int pathname = flags & FNM_PATHNAME;
@@ -292,10 +289,10 @@ fnmatch_helper(pcur, scur, flags)
}
static int
-fnmatch(p, s, flags)
- const char *p; /* pattern */
- const char *s; /* string */
- int flags;
+fnmatch(
+ const char *p, /* pattern */
+ const char *s, /* string */
+ int flags)
{
const int period = !(flags & FNM_DOTMATCH);
const int pathname = flags & FNM_PATHNAME;
@@ -345,8 +342,7 @@ struct dir_data {
};
static void
-free_dir(dir)
- struct dir_data *dir;
+free_dir(struct dir_data *dir)
{
if (dir) {
if (dir->dir) closedir(dir->dir);
@@ -357,10 +353,8 @@ free_dir(dir)
static VALUE dir_close _((VALUE));
-static VALUE dir_s_alloc _((VALUE));
static VALUE
-dir_s_alloc(klass)
- VALUE klass;
+dir_s_alloc(VALUE klass)
{
struct dir_data *dirp;
VALUE obj = Data_Make_Struct(klass, struct dir_data, 0, free_dir, dirp);
@@ -378,8 +372,7 @@ dir_s_alloc(klass)
* Returns a new directory object for the named directory.
*/
static VALUE
-dir_initialize(dir, dirname)
- VALUE dir, dirname;
+dir_initialize(VALUE dir, VALUE dirname)
{
struct dir_data *dp;
@@ -416,8 +409,7 @@ dir_initialize(dir, dirname)
* block.
*/
static VALUE
-dir_s_open(klass, dirname)
- VALUE klass, dirname;
+dir_s_open(VALUE klass, VALUE dirname)
{
struct dir_data *dp;
VALUE dir = Data_Make_Struct(klass, struct dir_data, 0, free_dir, dp);
@@ -431,7 +423,7 @@ dir_s_open(klass, dirname)
}
static void
-dir_closed()
+dir_closed(void)
{
rb_raise(rb_eIOError, "closed directory");
}
@@ -448,8 +440,7 @@ dir_closed()
* Return a string describing this Dir object.
*/
static VALUE
-dir_inspect(dir)
- VALUE dir;
+dir_inspect(VALUE dir)
{
struct dir_data *dirp;
@@ -474,8 +465,7 @@ dir_inspect(dir)
* d.path #=> ".."
*/
static VALUE
-dir_path(dir)
- VALUE dir;
+dir_path(VALUE dir)
{
struct dir_data *dirp;
@@ -497,8 +487,7 @@ dir_path(dir)
* d.read #=> "config.h"
*/
static VALUE
-dir_read(dir)
- VALUE dir;
+dir_read(VALUE dir)
{
struct dir_data *dirp;
struct dirent *dp;
@@ -536,8 +525,7 @@ dir_read(dir)
* Got main.rb
*/
static VALUE
-dir_each(dir)
- VALUE dir;
+dir_each(VALUE dir)
{
struct dir_data *dirp;
struct dirent *dp;
@@ -566,8 +554,7 @@ dir_each(dir)
* d.tell #=> 12
*/
static VALUE
-dir_tell(dir)
- VALUE dir;
+dir_tell(VALUE dir)
{
#ifdef HAVE_TELLDIR
struct dir_data *dirp;
@@ -596,8 +583,7 @@ dir_tell(dir)
* d.read #=> ".."
*/
static VALUE
-dir_seek(dir, pos)
- VALUE dir, pos;
+dir_seek(VALUE dir, VALUE pos)
{
struct dir_data *dirp;
off_t p = NUM2OFFT(pos);
@@ -626,8 +612,7 @@ dir_seek(dir, pos)
* d.read #=> ".."
*/
static VALUE
-dir_set_pos(dir, pos)
- VALUE dir, pos;
+dir_set_pos(VALUE dir, VALUE pos)
{
dir_seek(dir, pos);
return pos;
@@ -645,8 +630,7 @@ dir_set_pos(dir, pos)
* d.read #=> "."
*/
static VALUE
-dir_rewind(dir)
- VALUE dir;
+dir_rewind(VALUE dir)
{
struct dir_data *dirp;
@@ -666,8 +650,7 @@ dir_rewind(dir)
* d.close #=> nil
*/
static VALUE
-dir_close(dir)
- VALUE dir;
+dir_close(VALUE dir)
{
struct dir_data *dirp;
@@ -679,8 +662,7 @@ dir_close(dir)
}
static void
-dir_chdir(path)
- VALUE path;
+dir_chdir(VALUE path)
{
if (chdir(RSTRING(path)->ptr) < 0)
rb_sys_fail(RSTRING(path)->ptr);
@@ -695,8 +677,7 @@ struct chdir_data {
};
static VALUE
-chdir_yield(args)
- struct chdir_data *args;
+chdir_yield(struct chdir_data *args)
{
dir_chdir(args->new_path);
args->done = Qtrue;
@@ -707,8 +688,7 @@ chdir_yield(args)
}
static VALUE
-chdir_restore(args)
- struct chdir_data *args;
+chdir_restore(struct chdir_data *args)
{
if (args->done) {
chdir_blocking--;
@@ -759,10 +739,7 @@ chdir_restore(args)
* /var/spool/mail
*/
static VALUE
-dir_s_chdir(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+dir_s_chdir(int argc, VALUE *argv, VALUE obj)
{
VALUE path = Qnil;
@@ -810,8 +787,7 @@ dir_s_chdir(argc, argv, obj)
* Dir.getwd #=> "/tmp"
*/
static VALUE
-dir_s_getwd(dir)
- VALUE dir;
+dir_s_getwd(VALUE dir)
{
char *path;
VALUE cwd;
@@ -824,10 +800,8 @@ dir_s_getwd(dir)
return cwd;
}
-static void check_dirname _((volatile VALUE *));
static void
-check_dirname(dir)
- volatile VALUE *dir;
+check_dirname(volatile VALUE *dir)
{
char *path, *pend;
@@ -849,8 +823,7 @@ check_dirname(dir)
* information.
*/
static VALUE
-dir_s_chroot(dir, path)
- VALUE dir, path;
+dir_s_chroot(VALUE dir, VALUE path)
{
#if defined(HAVE_CHROOT) && !defined(__CHECKER__)
check_dirname(&path);
@@ -879,10 +852,7 @@ dir_s_chroot(dir, path)
*
*/
static VALUE
-dir_s_mkdir(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+dir_s_mkdir(int argc, VALUE *argv, VALUE obj)
{
VALUE path, vmode;
int mode;
@@ -911,8 +881,7 @@ dir_s_mkdir(argc, argv, obj)
* <code>SystemCallError</code> if the directory isn't empty.
*/
static VALUE
-dir_s_rmdir(obj, dir)
- VALUE obj, dir;
+dir_s_rmdir(VALUE obj, VALUE dir)
{
check_dirname(&dir);
if (rmdir(RSTRING(dir)->ptr) < 0)
@@ -923,9 +892,7 @@ dir_s_rmdir(obj, dir)
/* System call with warning */
static int
-do_stat(path, pst)
- const char *path;
- struct stat *pst;
+do_stat(const char *path, struct stat *pst)
{
int ret = stat(path, pst);
if (ret < 0 && errno != ENOENT)
@@ -935,9 +902,7 @@ do_stat(path, pst)
}
static int
-do_lstat(path, pst)
- const char *path;
- struct stat *pst;
+do_lstat(const char *path, struct stat *pst)
{
int ret = lstat(path, pst);
if (ret < 0 && errno != ENOENT)
@@ -947,8 +912,7 @@ do_lstat(path, pst)
}
static DIR *
-do_opendir(path)
- const char *path;
+do_opendir(const char *path)
{
DIR *dirp = opendir(path);
if (dirp == NULL && errno != ENOENT && errno != ENOTDIR)
@@ -959,9 +923,7 @@ do_opendir(path)
/* Return nonzero if S has any special globbing chars in it. */
static int
-has_magic(s, flags)
- const char *s;
- int flags;
+has_magic(const char *s, int flags)
{
const int escape = !(flags & FNM_NOESCAPE);
@@ -989,9 +951,7 @@ has_magic(s, flags)
/* Find separator in globbing pattern. */
static char *
-find_dirsep(s, flags)
- const char *s;
- int flags;
+find_dirsep(const char *s, int flags)
{
const int escape = !(flags & FNM_NOESCAPE);
@@ -1027,8 +987,7 @@ find_dirsep(s, flags)
/* Remove escaping baskclashes */
static void
-remove_backslashes(p)
- char *p;
+remove_backslashes(char *p)
{
char *t = p;
char *s = p;
@@ -1060,9 +1019,7 @@ struct glob_pattern {
};
static struct glob_pattern *
-glob_make_pattern(p, flags)
- const char *p;
- int flags;
+glob_make_pattern(const char *p, int flags)
{
struct glob_pattern *list, *tmp, **tail = &list;
int dirsep = 0; /* pattern is terminated with '/' */
@@ -1106,8 +1063,7 @@ glob_make_pattern(p, flags)
}
static void
-glob_free_pattern(list)
- struct glob_pattern *list;
+glob_free_pattern(struct glob_pattern *list)
{
while (list) {
struct glob_pattern *tmp = list;
@@ -1119,10 +1075,7 @@ glob_free_pattern(list)
}
static char *
-join_path(path, dirsep, name)
- const char *path;
- int dirsep;
- const char *name;
+join_path(const char *path, int dirsep, const char *name)
{
long len = strlen(path);
char *buf = ALLOC_N(char, len+strlen(name)+(dirsep?1:0)+1);
@@ -1156,11 +1109,8 @@ struct glob_args {
VALUE v;
};
-static VALUE glob_func_caller _((VALUE));
-
static VALUE
-glob_func_caller(val)
- VALUE val;
+glob_func_caller(VALUE val)
{
struct glob_args *args = (struct glob_args *)val;
@@ -1169,10 +1119,7 @@ glob_func_caller(val)
}
static int
-glob_call_func(func, path, arg)
- void (*func) _((const char *, VALUE));
- const char *path;
- VALUE arg;
+glob_call_func(void (*func) (const char *, VALUE), const char *path, VALUE arg)
{
int status;
struct glob_args args;
@@ -1186,16 +1133,16 @@ glob_call_func(func, path, arg)
}
static int
-glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg)
- const char *path;
- int dirsep; /* '/' should be placed before appending child entry's name to 'path'. */
- enum answer exist; /* Does 'path' indicate an existing entry? */
- enum answer isdir; /* Does 'path' indicate a directory or a symlink to a directory? */
- struct glob_pattern **beg;
- struct glob_pattern **end;
- int flags;
- void (*func) _((const char *, VALUE));
- VALUE arg;
+glob_helper(
+ const char *path,
+ int dirsep, /* '/' should be placed before appending child entry's name to 'path'. */
+ enum answer exist, /* Does 'path' indicate an existing entry? */
+ enum answer isdir, /* Does 'path' indicate a directory or a symlink to a directory? */
+ struct glob_pattern **beg,
+ struct glob_pattern **end,
+ int flags,
+ void (*func) (const char *, VALUE),
+ VALUE arg)
{
struct stat st;
int status = 0;
@@ -1346,11 +1293,7 @@ glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg)
}
static int
-rb_glob2(path, flags, func, arg)
- const char *path;
- int flags;
- void (*func) _((const char *, VALUE));
- VALUE arg;
+rb_glob2(const char *path, int flags, void (*func) (const char *, VALUE), VALUE arg)
{
struct glob_pattern *list;
const char *root, *start;
@@ -1390,49 +1333,34 @@ struct rb_glob_args {
VALUE arg;
};
-static VALUE
-rb_glob_caller(path, a)
- const char *path;
- VALUE a;
+static void
+rb_glob_caller(const char *path, VALUE a)
{
struct rb_glob_args *args = (struct rb_glob_args *)a;
(*args->func)(path, args->arg);
- return Qnil;
}
void
-rb_glob(path, func, arg)
- const char *path;
- void (*func) _((const char*, VALUE));
- VALUE arg;
+rb_glob(const char *path, void (*func) (const char *, VALUE), VALUE arg)
{
struct rb_glob_args args;
int status;
args.func = func;
args.arg = arg;
- status = rb_glob2(path, 0, rb_glob_caller, &args);
+ status = rb_glob2(path, 0, rb_glob_caller, (VALUE)&args);
if (status) rb_jump_tag(status);
}
static void
-push_pattern(path, ary)
- const char *path;
- VALUE ary;
+push_pattern(const char *path, VALUE ary)
{
rb_ary_push(ary, rb_tainted_str_new2(path));
}
static int
-push_glob(VALUE ary, const char *str, long offset, int flags);
-
-static int
-push_glob(ary, str, offset, flags)
- VALUE ary;
- const char *str;
- long offset;
- int flags;
+push_glob(VALUE ary, const char *str, long offset, int flags)
{
const int escape = !(flags & FNM_NOESCAPE);
const char *p = str;
@@ -1488,9 +1416,7 @@ push_glob(ary, str, offset, flags)
}
static VALUE
-rb_push_glob(str, flags) /* '\0' is delimiter */
- VALUE str;
- int flags;
+rb_push_glob(VALUE str, int flags) /* '\0' is delimiter */
{
long offset = 0;
VALUE ary;
@@ -1527,8 +1453,7 @@ rb_push_glob(str, flags) /* '\0' is delimiter */
*
*/
static VALUE
-dir_s_aref(obj, str)
- VALUE obj, str;
+dir_s_aref(VALUE obj, VALUE str)
{
return rb_push_glob(str, 0);
}
@@ -1593,10 +1518,7 @@ dir_s_aref(obj, str)
* Dir.glob(librbfiles) #=> ["lib/song.rb"]
*/
static VALUE
-dir_s_glob(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+dir_s_glob(int argc, VALUE *argv, VALUE obj)
{
VALUE str, rflags;
int flags;
@@ -1610,8 +1532,7 @@ dir_s_glob(argc, argv, obj)
}
static VALUE
-dir_open_dir(path)
- VALUE path;
+dir_open_dir(VALUE path)
{
VALUE dir = rb_funcall(rb_cDir, rb_intern("open"), 1, path);
@@ -1642,8 +1563,7 @@ dir_open_dir(path)
*
*/
static VALUE
-dir_foreach(io, dirname)
- VALUE io, dirname;
+dir_foreach(VALUE io, VALUE dirname)
{
VALUE dir;
@@ -1664,8 +1584,7 @@ dir_foreach(io, dirname)
*
*/
static VALUE
-dir_entries(io, dirname)
- VALUE io, dirname;
+dir_entries(VALUE io, VALUE dirname)
{
VALUE dir;
@@ -1753,10 +1672,7 @@ dir_entries(io, dirname)
* File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
*/
static VALUE
-file_s_fnmatch(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
{
VALUE pattern, path;
VALUE rflags;
@@ -1788,7 +1704,7 @@ file_s_fnmatch(argc, argv, obj)
* (<code>.</code>).
*/
void
-Init_Dir()
+Init_Dir(void)
{
rb_cDir = rb_define_class("Dir", rb_cObject);
diff --git a/dln.c b/dln.c
index 6093b33ce3..6a3f969686 100644
--- a/dln.c
+++ b/dln.c
@@ -89,7 +89,7 @@ char *getenv();
# include <image.h>
#endif
-int eaccess();
+int eaccess(const char *, int);
#ifndef NO_DLN_LOAD
@@ -107,9 +107,7 @@ int eaccess();
#endif
static int
-init_funcname_len(buf, file)
- char **buf;
- const char *file;
+init_funcname_len(char **buf, const char *file)
{
char *p;
const char *slash;
@@ -1161,7 +1159,7 @@ dln_sym(name)
#endif
static const char *
-dln_strerror()
+dln_strerror(void)
{
#ifdef USE_DLN_A_OUT
char *strerror();
@@ -1262,8 +1260,7 @@ aix_loaderror(const char *pathname)
#endif /* NO_DLN_LOAD */
void*
-dln_load(file)
- const char *file;
+dln_load(const char *file)
{
#ifdef NO_DLN_LOAD
rb_raise(rb_eLoadError, "this executable file can't load extension libraries");
@@ -1606,12 +1603,10 @@ dln_load(file)
return 0; /* dummy return */
}
-static char *dln_find_1();
+static char *dln_find_1(char *fname, char *path, int exe_flag);
char *
-dln_find_exe(fname, path)
- const char *fname;
- const char *path;
+dln_find_exe(const char *fname, const char *path)
{
if (!path) {
path = getenv(PATH_ENV);
@@ -1628,9 +1623,7 @@ dln_find_exe(fname, path)
}
char *
-dln_find_file(fname, path)
- const char *fname;
- const char *path;
+dln_find_file(const char *fname, const char *path)
{
#ifndef __MACOS__
if (!path) path = ".";
@@ -1672,10 +1665,7 @@ conv_to_posix_path(win32, posix, len)
static char fbuf[MAXPATHLEN];
static char *
-dln_find_1(fname, path, exe_flag)
- char *fname;
- char *path;
- int exe_flag; /* non 0 if looking for executable. */
+dln_find_1(char *fname, char *path, int exe_flag /* non 0 if looking for executable. */)
{
register char *dp;
register char *ep;
diff --git a/dmyext.c b/dmyext.c
index 4120d493c3..4d273f7faf 100644
--- a/dmyext.c
+++ b/dmyext.c
@@ -1,4 +1,4 @@
void
-Init_ext()
+Init_ext(void)
{
}
diff --git a/enum.c b/enum.c
index 2e8d71f604..662e8da141 100644
--- a/enum.c
+++ b/enum.c
@@ -18,15 +18,13 @@ VALUE rb_mEnumerable;
static ID id_each, id_eqq, id_cmp;
VALUE
-rb_each(obj)
- VALUE obj;
+rb_each(VALUE obj)
{
return rb_funcall(obj, id_each, 0, 0);
}
static VALUE
-grep_i(i, arg)
- VALUE i, *arg;
+grep_i(VALUE i, VALUE *arg)
{
if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
rb_ary_push(arg[1], i);
@@ -35,8 +33,7 @@ grep_i(i, arg)
}
static VALUE
-grep_iter_i(i, arg)
- VALUE i, *arg;
+grep_iter_i(VALUE i, VALUE *arg)
{
if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
rb_ary_push(arg[1], rb_yield(i));
@@ -63,8 +60,7 @@ grep_iter_i(i, arg)
*/
static VALUE
-enum_grep(obj, pat)
- VALUE obj, pat;
+enum_grep(VALUE obj, VALUE pat)
{
VALUE ary = rb_ary_new();
VALUE arg[2];
@@ -78,8 +74,7 @@ enum_grep(obj, pat)
}
static VALUE
-count_i(i, arg)
- VALUE i, *arg;
+count_i(VALUE i, VALUE *arg)
{
if (rb_equal(i, arg[0])) {
arg[1]++;
@@ -88,9 +83,7 @@ count_i(i, arg)
}
static VALUE
-count_iter_i(i, n)
- VALUE i;
- long *n;
+count_iter_i(VALUE i, long *n)
{
if (RTEST(rb_yield(i))) {
(*n)++;
@@ -113,10 +106,7 @@ count_iter_i(i, n)
*/
static VALUE
-enum_count(argc, argv, obj)
- int argc;
- VALUE* argv;
- VALUE obj;
+enum_count(int argc, VALUE *argv, VALUE obj)
{
if (argc == 1) {
VALUE item, args[2];
@@ -139,9 +129,7 @@ enum_count(argc, argv, obj)
}
static VALUE
-find_i(i, memo)
- VALUE i;
- VALUE *memo;
+find_i(VALUE i, VALUE *memo)
{
if (RTEST(rb_yield(i))) {
*memo = i;
@@ -166,10 +154,7 @@ find_i(i, memo)
*/
static VALUE
-enum_find(argc, argv, obj)
- int argc;
- VALUE* argv;
- VALUE obj;
+enum_find(int argc, VALUE *argv, VALUE obj)
{
VALUE memo = Qundef;
VALUE if_none;
@@ -187,8 +172,7 @@ enum_find(argc, argv, obj)
}
static VALUE
-find_all_i(i, ary)
- VALUE i, ary;
+find_all_i(VALUE i, VALUE ary)
{
if (RTEST(rb_yield(i))) {
rb_ary_push(ary, i);
@@ -210,8 +194,7 @@ find_all_i(i, ary)
*/
static VALUE
-enum_find_all(obj)
- VALUE obj;
+enum_find_all(VALUE obj)
{
VALUE ary;
@@ -224,8 +207,7 @@ enum_find_all(obj)
}
static VALUE
-reject_i(i, ary)
- VALUE i, ary;
+reject_i(VALUE i, VALUE ary)
{
if (!RTEST(rb_yield(i))) {
rb_ary_push(ary, i);
@@ -245,8 +227,7 @@ reject_i(i, ary)
*/
static VALUE
-enum_reject(obj)
- VALUE obj;
+enum_reject(VALUE obj)
{
VALUE ary;
@@ -259,8 +240,7 @@ enum_reject(obj)
}
static VALUE
-collect_i(i, ary)
- VALUE i, ary;
+collect_i(VALUE i, VALUE ary)
{
rb_ary_push(ary, rb_yield(i));
@@ -268,8 +248,7 @@ collect_i(i, ary)
}
static VALUE
-collect_all(i, ary)
- VALUE i, ary;
+collect_all(VALUE i, VALUE ary)
{
rb_ary_push(ary, i);
@@ -290,8 +269,7 @@ collect_all(i, ary)
*/
static VALUE
-enum_collect(obj)
- VALUE obj;
+enum_collect(VALUE obj)
{
VALUE ary;
@@ -314,8 +292,7 @@ enum_collect(obj)
* { 'a'=>1, 'b'=>2, 'c'=>3 }.to_a #=> [["a", 1], ["b", 2], ["c", 3]]
*/
static VALUE
-enum_to_a(obj)
- VALUE obj;
+enum_to_a(VALUE obj)
{
VALUE ary = rb_ary_new();
@@ -325,9 +302,7 @@ enum_to_a(obj)
}
static VALUE
-inject_i(i, memo)
- VALUE i;
- VALUE *memo;
+inject_i(VALUE i, VALUE *memo)
{
if (*memo == Qundef) {
*memo = i;
@@ -370,9 +345,7 @@ inject_i(i, memo)
*/
static VALUE
-enum_inject(argc, argv, obj)
- int argc;
- VALUE *argv, obj;
+enum_inject(int argc, VALUE *argv, VALUE obj)
{
VALUE memo = Qundef;
@@ -384,8 +357,7 @@ enum_inject(argc, argv, obj)
}
static VALUE
-partition_i(i, ary)
- VALUE i, *ary;
+partition_i(VALUE i, VALUE *ary)
{
if (RTEST(rb_yield(i))) {
rb_ary_push(ary[0], i);
@@ -409,8 +381,7 @@ partition_i(i, ary)
*/
static VALUE
-enum_partition(obj)
- VALUE obj;
+enum_partition(VALUE obj)
{
VALUE ary[2];
@@ -441,15 +412,13 @@ enum_partition(obj)
*/
static VALUE
-enum_sort(obj)
- VALUE obj;
+enum_sort(VALUE obj)
{
return rb_ary_sort(enum_to_a(obj));
}
static VALUE
-sort_by_i(i, ary)
- VALUE i, ary;
+sort_by_i(VALUE i, VALUE ary)
{
VALUE v;
NODE *memo;
@@ -464,8 +433,7 @@ sort_by_i(i, ary)
}
static int
-sort_by_cmp(aa, bb)
- NODE **aa, **bb;
+sort_by_cmp(NODE **aa, NODE **bb)
{
VALUE a = aa[0]->u1.value;
VALUE b = bb[0]->u1.value;
@@ -543,8 +511,7 @@ sort_by_cmp(aa, bb)
*/
static VALUE
-enum_sort_by(obj)
- VALUE obj;
+enum_sort_by(VALUE obj)
{
VALUE ary;
long i;
@@ -573,9 +540,7 @@ enum_sort_by(obj)
}
static VALUE
-all_iter_i(i, memo)
- VALUE i;
- VALUE *memo;
+all_iter_i(VALUE i, VALUE *memo)
{
if (!RTEST(rb_yield(i))) {
*memo = Qfalse;
@@ -585,9 +550,7 @@ all_iter_i(i, memo)
}
static VALUE
-all_i(i, memo)
- VALUE i;
- VALUE *memo;
+all_i(VALUE i, VALUE *memo)
{
if (!RTEST(i)) {
*memo = Qfalse;
@@ -614,8 +577,7 @@ all_i(i, memo)
*/
static VALUE
-enum_all(obj)
- VALUE obj;
+enum_all(VALUE obj)
{
VALUE result = Qtrue;
@@ -624,9 +586,7 @@ enum_all(obj)
}
static VALUE
-any_iter_i(i, memo)
- VALUE i;
- VALUE *memo;
+any_iter_i(VALUE i, VALUE *memo)
{
if (RTEST(rb_yield(i))) {
*memo = Qtrue;
@@ -636,9 +596,7 @@ any_iter_i(i, memo)
}
static VALUE
-any_i(i, memo)
- VALUE i;
- VALUE *memo;
+any_i(VALUE i, VALUE *memo)
{
if (RTEST(i)) {
*memo = Qtrue;
@@ -666,8 +624,7 @@ any_i(i, memo)
*/
static VALUE
-enum_any(obj)
- VALUE obj;
+enum_any(VALUE obj)
{
VALUE result = Qfalse;
@@ -676,9 +633,7 @@ enum_any(obj)
}
static VALUE
-min_i(i, memo)
- VALUE i;
- VALUE *memo;
+min_i(VALUE i, VALUE *memo)
{
VALUE cmp;
@@ -695,9 +650,7 @@ min_i(i, memo)
}
static VALUE
-min_ii(i, memo)
- VALUE i;
- VALUE *memo;
+min_ii(VALUE i, VALUE *memo)
{
VALUE cmp;
@@ -729,8 +682,7 @@ min_ii(i, memo)
*/
static VALUE
-enum_min(obj)
- VALUE obj;
+enum_min(VALUE obj)
{
VALUE result = Qundef;
@@ -740,9 +692,7 @@ enum_min(obj)
}
static VALUE
-max_i(i, memo)
- VALUE i;
- VALUE *memo;
+max_i(VALUE i, VALUE *memo)
{
VALUE cmp;
@@ -759,9 +709,7 @@ max_i(i, memo)
}
static VALUE
-max_ii(i, memo)
- VALUE i;
- VALUE *memo;
+max_ii(VALUE i, VALUE *memo)
{
VALUE cmp;
@@ -792,8 +740,7 @@ max_ii(i, memo)
*/
static VALUE
-enum_max(obj)
- VALUE obj;
+enum_max(VALUE obj)
{
VALUE result = Qundef;
@@ -803,9 +750,7 @@ enum_max(obj)
}
static VALUE
-min_by_i(i, memo)
- VALUE i;
- VALUE *memo;
+min_by_i(VALUE i, VALUE *memo)
{
VALUE v;
@@ -833,8 +778,7 @@ min_by_i(i, memo)
*/
static VALUE
-enum_min_by(obj)
- VALUE obj;
+enum_min_by(VALUE obj)
{
VALUE memo[2];
@@ -847,9 +791,7 @@ enum_min_by(obj)
}
static VALUE
-max_by_i(i, memo)
- VALUE i;
- VALUE *memo;
+max_by_i(VALUE i, VALUE *memo)
{
VALUE v;
@@ -877,8 +819,7 @@ max_by_i(i, memo)
*/
static VALUE
-enum_max_by(obj)
- VALUE obj;
+enum_max_by(VALUE obj)
{
VALUE memo[2];
@@ -891,9 +832,7 @@ enum_max_by(obj)
}
static VALUE
-member_i(item, memo)
- VALUE item;
- VALUE *memo;
+member_i(VALUE item, VALUE *memo)
{
if (rb_equal(item, memo[0])) {
memo[1] = Qtrue;
@@ -916,8 +855,7 @@ member_i(item, memo)
*/
static VALUE
-enum_member(obj, val)
- VALUE obj, val;
+enum_member(VALUE obj, VALUE val)
{
VALUE memo[2];
@@ -928,9 +866,7 @@ enum_member(obj, val)
}
static VALUE
-each_with_index_i(val, memo)
- VALUE val;
- VALUE *memo;
+each_with_index_i(VALUE val, VALUE *memo)
{
rb_yield_values(2, val, INT2FIX(*memo));
++*memo;
@@ -953,8 +889,7 @@ each_with_index_i(val, memo)
*/
static VALUE
-enum_each_with_index(obj)
- VALUE obj;
+enum_each_with_index(VALUE obj)
{
VALUE memo = 0;
@@ -965,9 +900,7 @@ enum_each_with_index(obj)
}
static VALUE
-zip_i(val, memo)
- VALUE val;
- VALUE *memo;
+zip_i(VALUE val, VALUE *memo)
{
VALUE result = memo[0];
VALUE args = memo[1];
@@ -1013,10 +946,7 @@ zip_i(val, memo)
*/
static VALUE
-enum_zip(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+enum_zip(int argc, VALUE *argv, VALUE obj)
{
int i;
VALUE result;
@@ -1046,7 +976,7 @@ enum_zip(argc, argv, obj)
*/
void
-Init_Enumerable()
+Init_Enumerable(void)
{
rb_mEnumerable = rb_define_module("Enumerable");
diff --git a/enumerator.c b/enumerator.c
index c5bb86dd2f..cc8adf5235 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -24,8 +24,7 @@ static VALUE rb_cEnumerator;
static VALUE sym_each, sym_each_with_index, sym_each_slice, sym_each_cons;
static VALUE
-proc_call(proc, args)
- VALUE proc, args;
+proc_call(VALUE proc, VALUE args)
{
if (TYPE(args) != T_ARRAY) {
args = rb_values_new(1, args);
@@ -34,8 +33,7 @@ proc_call(proc, args)
}
static VALUE
-method_call(method, args)
- VALUE method, args;
+method_call(VALUE method, VALUE args)
{
int argc = 0;
VALUE *argv = 0;
@@ -53,10 +51,8 @@ struct enumerator {
VALUE (*iter)_((VALUE, struct enumerator *));
};
-static void enumerator_mark _((void *));
static void
-enumerator_mark(p)
- void *p;
+enumerator_mark(void *p)
{
struct enumerator *ptr = p;
rb_gc_mark(ptr->method);
@@ -65,8 +61,7 @@ enumerator_mark(p)
}
static struct enumerator *
-enumerator_ptr(obj)
- VALUE obj;
+enumerator_ptr(VALUE obj)
{
struct enumerator *ptr;
@@ -82,11 +77,8 @@ enumerator_ptr(obj)
return ptr;
}
-static VALUE enumerator_iter_i _((VALUE, struct enumerator *));
static VALUE
-enumerator_iter_i(i, e)
- VALUE i;
- struct enumerator *e;
+enumerator_iter_i(VALUE i, struct enumerator *e)
{
return rb_yield(proc_call(e->proc, i));
}
@@ -110,10 +102,7 @@ enumerator_iter_i(i, e)
*
*/
static VALUE
-obj_to_enum(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+obj_to_enum(int argc, VALUE *argv, VALUE obj)
{
VALUE meth = sym_each;
@@ -132,16 +121,13 @@ obj_to_enum(argc, argv, obj)
*
*/
static VALUE
-enumerator_enum_with_index(obj)
- VALUE obj;
+enumerator_enum_with_index(VALUE obj)
{
return rb_enumeratorize(obj, sym_each_with_index, 0, 0);
}
static VALUE
-each_slice_i(val, memo)
- VALUE val;
- VALUE *memo;
+each_slice_i(VALUE val, VALUE *memo)
{
VALUE ary = memo[0];
long size = (long)memo[1];
@@ -172,8 +158,7 @@ each_slice_i(val, memo)
*
*/
static VALUE
-enum_each_slice(obj, n)
- VALUE obj, n;
+enum_each_slice(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
VALUE args[2], ary;
@@ -199,16 +184,13 @@ enum_each_slice(obj, n)
*
*/
static VALUE
-enumerator_enum_slice(obj, n)
- VALUE obj, n;
+enumerator_enum_slice(VALUE obj, VALUE n)
{
return rb_enumeratorize(obj, sym_each_slice, 1, &n);
}
static VALUE
-each_cons_i(val, memo)
- VALUE val;
- VALUE *memo;
+each_cons_i(VALUE val, VALUE *memo)
{
VALUE ary = memo[0];
long size = (long)memo[1];
@@ -244,8 +226,7 @@ each_cons_i(val, memo)
*
*/
static VALUE
-enum_each_cons(obj, n)
- VALUE obj, n;
+enum_each_cons(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
VALUE args[2];
@@ -267,16 +248,13 @@ enum_each_cons(obj, n)
*
*/
static VALUE
-enumerator_enum_cons(obj, n)
- VALUE obj, n;
+enumerator_enum_cons(VALUE obj, VALUE n)
{
return rb_enumeratorize(obj, sym_each_cons, 1, &n);
}
-static VALUE enumerator_allocate _((VALUE));
static VALUE
-enumerator_allocate(klass)
- VALUE klass;
+enumerator_allocate(VALUE klass)
{
struct enumerator *ptr;
return Data_Make_Struct(rb_cEnumerator, struct enumerator,
@@ -284,10 +262,7 @@ enumerator_allocate(klass)
}
VALUE
-enumerator_init(enum_obj, obj, meth, argc, argv)
- VALUE enum_obj, obj, meth;
- int argc;
- VALUE *argv;
+enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
{
struct enumerator *ptr = enumerator_ptr(enum_obj);
@@ -320,10 +295,7 @@ enumerator_init(enum_obj, obj, meth, argc, argv)
*
*/
static VALUE
-enumerator_initialize(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+enumerator_initialize(int argc, VALUE *argv, VALUE obj)
{
VALUE recv, meth = sym_each;
@@ -338,18 +310,13 @@ enumerator_initialize(argc, argv, obj)
}
VALUE
-rb_enumeratorize(obj, meth, argc, argv)
- VALUE obj, meth;
- int argc;
- VALUE *argv;
+rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
{
return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv);
}
-static VALUE enumerator_iter _((VALUE));
static VALUE
-enumerator_iter(memo)
- VALUE memo;
+enumerator_iter(VALUE memo)
{
struct enumerator *e = (struct enumerator *)memo;
@@ -365,8 +332,7 @@ enumerator_iter(memo)
*
*/
static VALUE
-enumerator_each(obj)
- VALUE obj;
+enumerator_each(VALUE obj)
{
struct enumerator *e = enumerator_ptr(obj);
@@ -374,8 +340,7 @@ enumerator_each(obj)
}
static VALUE
-enumerator_with_index_i(val, memo)
- VALUE val, *memo;
+enumerator_with_index_i(VALUE val, VALUE *memo)
{
val = rb_yield_values(2, val, INT2FIX(*memo));
++*memo;
@@ -391,8 +356,7 @@ enumerator_with_index_i(val, memo)
*
*/
static VALUE
-enumerator_with_index(obj)
- VALUE obj;
+enumerator_with_index(VALUE obj)
{
struct enumerator *e = enumerator_ptr(obj);
VALUE memo = 0;
@@ -402,7 +366,7 @@ enumerator_with_index(obj)
}
void
-Init_Enumerator()
+Init_Enumerator(void)
{
rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -1);
rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -1);
diff --git a/error.c b/error.c
index 059ccc9030..d6dbee6e8f 100644
--- a/error.c
+++ b/error.c
@@ -15,13 +15,7 @@
#include "st.h"
#include <stdio.h>
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -34,9 +28,7 @@ extern const char ruby_version[], ruby_release_date[], ruby_platform[];
int ruby_nerrs;
static int
-err_position(buf, len)
- char *buf;
- long len;
+err_position(char *buf, long len)
{
ruby_set_current_source();
if (!ruby_sourcefile) {
@@ -51,11 +43,7 @@ err_position(buf, len)
}
static void
-err_snprintf(buf, len, fmt, args)
- char *buf;
- long len;
- const char *fmt;
- va_list args;
+err_snprintf(char *buf, long len, const char *fmt, va_list args)
{
long n;
@@ -67,9 +55,7 @@ err_snprintf(buf, len, fmt, args)
static void err_append _((const char*));
static void
-err_print(fmt, args)
- const char *fmt;
- va_list args;
+err_print(const char *fmt, va_list args)
{
char buf[BUFSIZ];
@@ -78,44 +64,30 @@ err_print(fmt, args)
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_compile_error(const char *fmt, ...)
-#else
-rb_compile_error(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list args;
- va_init_list(args, fmt);
+ va_start(args, fmt);
err_print(fmt, args);
va_end(args);
ruby_nerrs++;
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_compile_error_append(const char *fmt, ...)
-#else
-rb_compile_error_append(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list args;
char buf[BUFSIZ];
- va_init_list(args, fmt);
+ va_start(args, fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
err_append(buf);
}
static void
-warn_print(fmt, args)
- const char *fmt;
- va_list args;
+warn_print(const char *fmt, va_list args)
{
char buf[BUFSIZ];
int len;
@@ -127,13 +99,7 @@ warn_print(fmt, args)
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_warn(const char *fmt, ...)
-#else
-rb_warn(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
char buf[BUFSIZ];
va_list args;
@@ -142,20 +108,14 @@ rb_warn(fmt, va_alist)
snprintf(buf, BUFSIZ, "warning: %s", fmt);
- va_init_list(args, fmt);
+ va_start(args, fmt);
warn_print(buf, args);
va_end(args);
}
/* rb_warning() reports only in verbose mode */
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_warning(const char *fmt, ...)
-#else
-rb_warning(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
char buf[BUFSIZ];
va_list args;
@@ -164,7 +124,7 @@ rb_warning(fmt, va_alist)
snprintf(buf, BUFSIZ, "warning: %s", fmt);
- va_init_list(args, fmt);
+ va_start(args, fmt);
warn_print(buf, args);
va_end(args);
}
@@ -178,8 +138,7 @@ rb_warning(fmt, va_alist)
*/
static VALUE
-rb_warn_m(self, mesg)
- VALUE self, mesg;
+rb_warn_m(VALUE self, VALUE mesg)
{
if (!NIL_P(ruby_verbose)) {
rb_io_write(rb_stderr, mesg);
@@ -189,13 +148,7 @@ rb_warn_m(self, mesg)
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_bug(const char *fmt, ...)
-#else
-rb_bug(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
char buf[BUFSIZ];
va_list args;
@@ -205,7 +158,7 @@ rb_bug(fmt, va_alist)
if (fwrite(buf, 1, len, out) == len ||
fwrite(buf, 1, len, (out = stdout)) == len) {
fputs("[BUG] ", out);
- va_init_list(args, fmt);
+ va_start(args, fmt);
vfprintf(out, fmt, args);
va_end(args);
fprintf(out, "\nruby %s (%s) [%s]\n\n",
@@ -245,9 +198,7 @@ static struct types {
};
void
-rb_check_type(x, t)
- VALUE x;
- int t;
+rb_check_type(VALUE x, int t)
{
struct types *type = builtin_types;
@@ -315,25 +266,19 @@ VALUE rb_mErrno;
static VALUE eNOERROR;
VALUE
-rb_exc_new(etype, ptr, len)
- VALUE etype;
- const char *ptr;
- long len;
+rb_exc_new(VALUE etype, const char *ptr, long len)
{
return rb_funcall(etype, rb_intern("new"), 1, rb_str_new(ptr, len));
}
VALUE
-rb_exc_new2(etype, s)
- VALUE etype;
- const char *s;
+rb_exc_new2(VALUE etype, const char *s)
{
return rb_exc_new(etype, s, strlen(s));
}
VALUE
-rb_exc_new3(etype, str)
- VALUE etype, str;
+rb_exc_new3(VALUE etype, VALUE str)
{
StringValue(str);
return rb_funcall(etype, rb_intern("new"), 1, str);
@@ -348,10 +293,7 @@ rb_exc_new3(etype, str)
*/
static VALUE
-exc_initialize(argc, argv, exc)
- int argc;
- VALUE *argv;
- VALUE exc;
+exc_initialize(int argc, VALUE *argv, VALUE exc)
{
VALUE arg;
@@ -376,10 +318,7 @@ exc_initialize(argc, argv, exc)
*/
static VALUE
-exc_exception(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+exc_exception(int argc, VALUE *argv, VALUE self)
{
VALUE exc;
@@ -400,8 +339,7 @@ exc_exception(argc, argv, self)
*/
static VALUE
-exc_to_s(exc)
- VALUE exc;
+exc_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
@@ -421,8 +359,7 @@ exc_to_s(exc)
*/
static VALUE
-exc_message(exc)
- VALUE exc;
+exc_message(VALUE exc)
{
return rb_funcall(exc, rb_intern("to_s"), 0, 0);
}
@@ -435,8 +372,7 @@ exc_message(exc)
*/
static VALUE
-exc_inspect(exc)
- VALUE exc;
+exc_inspect(VALUE exc)
{
VALUE str, klass;
@@ -486,8 +422,7 @@ exc_inspect(exc)
*/
static VALUE
-exc_backtrace(exc)
- VALUE exc;
+exc_backtrace(VALUE exc)
{
ID bt = rb_intern("bt");
@@ -496,8 +431,7 @@ exc_backtrace(exc)
}
static VALUE
-check_backtrace(bt)
- VALUE bt;
+check_backtrace(VALUE bt)
{
long i;
static char *err = "backtrace must be Array of String";
@@ -529,9 +463,7 @@ check_backtrace(bt)
*/
static VALUE
-exc_set_backtrace(exc, bt)
- VALUE exc;
- VALUE bt;
+exc_set_backtrace(VALUE exc, VALUE bt)
{
return rb_iv_set(exc, "bt", check_backtrace(bt));
}
@@ -546,9 +478,7 @@ exc_set_backtrace(exc, bt)
*/
static VALUE
-exc_equal(exc, obj)
- VALUE exc;
- VALUE obj;
+exc_equal(VALUE exc, VALUE obj)
{
ID id_mesg = rb_intern("mesg");
@@ -570,10 +500,7 @@ exc_equal(exc, obj)
*/
static VALUE
-exit_initialize(argc, argv, exc)
- int argc;
- VALUE *argv;
- VALUE exc;
+exit_initialize(int argc, VALUE *argv, VALUE exc)
{
VALUE status = INT2FIX(EXIT_SUCCESS);
if (argc > 0 && FIXNUM_P(argv[0])) {
@@ -594,8 +521,7 @@ exit_initialize(argc, argv, exc)
*/
static VALUE
-exit_status(exc)
- VALUE exc;
+exit_status(VALUE exc)
{
return rb_attr_get(exc, rb_intern("status"));
}
@@ -609,8 +535,7 @@ exit_status(exc)
*/
static VALUE
-exit_success_p(exc)
- VALUE exc;
+exit_success_p(VALUE exc)
{
VALUE status = rb_attr_get(exc, rb_intern("status"));
if (NIL_P(status)) return Qtrue;
@@ -619,20 +544,13 @@ exit_success_p(exc)
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_name_error(ID id, const char *fmt, ...)
-#else
-rb_name_error(id, fmt, va_alist)
- ID id;
- const char *fmt;
- va_dcl
-#endif
{
VALUE exc, argv[2];
va_list args;
char buf[BUFSIZ];
- va_init_list(args, fmt);
+ va_start(args, fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
@@ -652,10 +570,7 @@ rb_name_error(id, fmt, va_alist)
*/
static VALUE
-name_err_initialize(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+name_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE name;
@@ -673,8 +588,7 @@ name_err_initialize(argc, argv, self)
*/
static VALUE
-name_err_name(self)
- VALUE self;
+name_err_name(VALUE self)
{
return rb_attr_get(self, rb_intern("name"));
}
@@ -687,8 +601,7 @@ name_err_name(self)
*/
static VALUE
-name_err_to_s(exc)
- VALUE exc;
+name_err_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
VALUE str = mesg;
@@ -713,10 +626,7 @@ name_err_to_s(exc)
*/
static VALUE
-nometh_err_initialize(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+nometh_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE args = (argc > 2) ? argv[--argc] : Qnil;
name_err_initialize(argc, argv, self);
@@ -726,16 +636,14 @@ nometh_err_initialize(argc, argv, self)
/* :nodoc: */
static void
-name_err_mesg_mark(ptr)
- VALUE *ptr;
+name_err_mesg_mark(VALUE *ptr)
{
rb_gc_mark_locations(ptr, ptr+3);
}
/* :nodoc: */
static VALUE
-name_err_mesg_new(obj, mesg, recv, method)
- VALUE obj, mesg, recv, method;
+name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
{
VALUE *ptr = ALLOC_N(VALUE, 3);
@@ -747,8 +655,7 @@ name_err_mesg_new(obj, mesg, recv, method)
/* :nodoc: */
static VALUE
-name_err_mesg_equal(obj1, obj2)
- VALUE obj1, obj2;
+name_err_mesg_equal(VALUE obj1, VALUE obj2)
{
VALUE *ptr1, *ptr2;
int i;
@@ -768,8 +675,7 @@ name_err_mesg_equal(obj1, obj2)
/* :nodoc: */
static VALUE
-name_err_mesg_to_str(obj)
- VALUE obj;
+name_err_mesg_to_str(VALUE obj)
{
VALUE *ptr, mesg;
Data_Get_Struct(obj, VALUE, ptr);
@@ -815,8 +721,7 @@ name_err_mesg_to_str(obj)
/* :nodoc: */
static VALUE
-name_err_mesg_load(klass, str)
- VALUE klass, str;
+name_err_mesg_load(VALUE klass, VALUE str)
{
return str;
}
@@ -830,15 +735,13 @@ name_err_mesg_load(klass, str)
*/
static VALUE
-nometh_err_args(self)
- VALUE self;
+nometh_err_args(VALUE self)
{
return rb_attr_get(self, rb_intern("args"));
}
void
-rb_invalid_str(str, type)
- const char *str, *type;
+rb_invalid_str(const char *str, const char *type)
{
VALUE s = rb_str_inspect(rb_str_new2(str));
@@ -879,9 +782,7 @@ rb_invalid_str(str, type)
static st_table *syserr_tbl;
static VALUE
-set_syserr(n, name)
- int n;
- const char *name;
+set_syserr(int n, const char *name)
{
VALUE error;
@@ -897,8 +798,7 @@ set_syserr(n, name)
}
static VALUE
-get_syserr(n)
- int n;
+get_syserr(int n)
{
VALUE error;
@@ -923,10 +823,7 @@ get_syserr(n)
*/
static VALUE
-syserr_initialize(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+syserr_initialize(int argc, VALUE *argv, VALUE self)
{
#if !defined(_WIN32) && !defined(__VMS)
char *strerror();
@@ -977,8 +874,7 @@ syserr_initialize(argc, argv, self)
*/
static VALUE
-syserr_errno(self)
- VALUE self;
+syserr_errno(VALUE self)
{
return rb_attr_get(self, rb_intern("errno"));
}
@@ -992,8 +888,7 @@ syserr_errno(self)
*/
static VALUE
-syserr_eqq(self, exc)
- VALUE self, exc;
+syserr_eqq(VALUE self, VALUE exc)
{
VALUE num, e;
@@ -1022,8 +917,7 @@ syserr_eqq(self, exc)
* Returns default SystemCallError class.
*/
static VALUE
-errno_missing(self, id)
- VALUE self, id;
+errno_missing(VALUE self, VALUE id)
{
return eNOERROR;
}
@@ -1039,7 +933,7 @@ errno_missing(self, id)
*/
void
-Init_Exception()
+Init_Exception(void)
{
rb_eException = rb_define_class("Exception", rb_cObject);
rb_define_singleton_method(rb_eException, "exception", rb_class_new_instance, -1);
@@ -1103,44 +997,31 @@ Init_Exception()
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_raise(VALUE exc, const char *fmt, ...)
-#else
-rb_raise(exc, fmt, va_alist)
- VALUE exc;
- const char *fmt;
- va_dcl
-#endif
{
va_list args;
char buf[BUFSIZ];
- va_init_list(args,fmt);
+ va_start(args,fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
rb_exc_raise(rb_exc_new2(exc, buf));
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_loaderror(const char *fmt, ...)
-#else
-rb_loaderror(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list args;
char buf[BUFSIZ];
- va_init_list(args, fmt);
+ va_start(args, fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
rb_exc_raise(rb_exc_new2(rb_eLoadError, buf));
}
void
-rb_notimplement()
+rb_notimplement(void)
{
rb_raise(rb_eNotImpError,
"The %s() function is unimplemented on this machine",
@@ -1148,18 +1029,12 @@ rb_notimplement()
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_fatal(const char *fmt, ...)
-#else
-rb_fatal(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list args;
char buf[BUFSIZ];
- va_init_list(args, fmt);
+ va_start(args, fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
@@ -1168,8 +1043,7 @@ rb_fatal(fmt, va_alist)
}
void
-rb_sys_fail(mesg)
- const char *mesg;
+rb_sys_fail(const char *mesg)
{
int n = errno;
VALUE arg;
@@ -1184,13 +1058,7 @@ rb_sys_fail(mesg)
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
rb_sys_warning(const char *fmt, ...)
-#else
-rb_sys_warning(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
char buf[BUFSIZ];
va_list args;
@@ -1203,35 +1071,32 @@ rb_sys_warning(fmt, va_alist)
snprintf(buf, BUFSIZ, "warning: %s", fmt);
snprintf(buf+strlen(buf), BUFSIZ-strlen(buf), ": %s", strerror(errno_save));
- va_init_list(args, fmt);
+ va_start(args, fmt);
warn_print(buf, args);
va_end(args);
errno = errno_save;
}
void
-rb_load_fail(path)
- const char *path;
+rb_load_fail(const char *path)
{
rb_loaderror("%s -- %s", strerror(errno), path);
}
void
-rb_error_frozen(what)
- const char *what;
+rb_error_frozen(const char *what)
{
rb_raise(rb_eRuntimeError, "can't modify frozen %s", what);
}
void
-rb_check_frozen(obj)
- VALUE obj;
+rb_check_frozen(VALUE obj)
{
if (OBJ_FROZEN(obj)) rb_error_frozen(rb_obj_classname(obj));
}
void
-Init_syserr()
+Init_syserr(void)
{
#ifdef EPERM
set_syserr(EPERM, "EPERM");
@@ -1603,8 +1468,7 @@ Init_syserr()
}
static void
-err_append(s)
- const char *s;
+err_append(const char *s)
{
extern VALUE ruby_errinfo;
diff --git a/eval.c b/eval.c
index 97fd255672..ae9fe80dd4 100644
--- a/eval.c
+++ b/eval.c
@@ -63,13 +63,7 @@ void *alloca ();
# endif /* HAVE_ALLOCA_H */
#endif /* __GNUC__ */
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
#ifndef HAVE_STRING_H
char *strrchr _((const char*,const char));
@@ -233,8 +227,7 @@ static VALUE safe_getter _((void));
static void safe_setter _((VALUE val));
void
-rb_secure(level)
- int level;
+rb_secure(int level)
{
if (level <= ruby_safe_level) {
if (ruby_frame->callee) {
@@ -248,15 +241,13 @@ rb_secure(level)
}
void
-rb_secure_update(obj)
- VALUE obj;
+rb_secure_update(VALUE obj)
{
if (!OBJ_TAINTED(obj)) rb_secure(4);
}
void
-rb_check_safe_obj(x)
- VALUE x;
+rb_check_safe_obj(VALUE x)
{
if (ruby_safe_level > 0 && OBJ_TAINTED(x)){
if (ruby_frame->callee) {
@@ -271,8 +262,7 @@ rb_check_safe_obj(x)
}
void
-rb_check_safe_str(x)
- VALUE x;
+rb_check_safe_str(VALUE x)
{
rb_check_safe_obj(x);
if (TYPE(x)!= T_STRING) {
@@ -283,9 +273,7 @@ rb_check_safe_str(x)
NORETURN(static void print_undef _((VALUE, ID)));
static void
-print_undef(klass, id)
- VALUE klass;
- ID id;
+print_undef(VALUE klass, ID id)
{
rb_name_error(id, "undefined method `%s' for %s `%s'",
rb_id2name(id),
@@ -312,7 +300,7 @@ static struct cache_entry cache[CACHE_SIZE];
static int ruby_running = 0;
void
-rb_clear_cache()
+rb_clear_cache(void)
{
struct cache_entry *ent, *end;
@@ -325,9 +313,7 @@ rb_clear_cache()
}
static void
-rb_clear_cache_for_undef(klass, id)
- VALUE klass;
- ID id;
+rb_clear_cache_for_undef(VALUE klass, ID id)
{
struct cache_entry *ent, *end;
@@ -342,8 +328,7 @@ rb_clear_cache_for_undef(klass, id)
}
static void
-rb_clear_cache_by_id(id)
- ID id;
+rb_clear_cache_by_id(ID id)
{
struct cache_entry *ent, *end;
@@ -358,8 +343,7 @@ rb_clear_cache_by_id(id)
}
void
-rb_clear_cache_by_class(klass)
- VALUE klass;
+rb_clear_cache_by_class(VALUE klass)
{
struct cache_entry *ent, *end;
@@ -383,11 +367,7 @@ static ID __id__, __send__, respond_to;
#define NOEX_WITH_SAFE(n) NOEX_WITH(n, ruby_safe_level)
void
-rb_add_method(klass, mid, node, noex)
- VALUE klass;
- ID mid;
- NODE *node;
- int noex;
+rb_add_method(VALUE klass, ID mid, NODE *node, int noex)
{
NODE *body;
@@ -421,26 +401,21 @@ rb_add_method(klass, mid, node, noex)
}
void
-rb_define_alloc_func(klass, func)
- VALUE klass;
- VALUE (*func) _((VALUE));
+rb_define_alloc_func(VALUE klass, VALUE (*func) (VALUE))
{
Check_Type(klass, T_CLASS);
rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, NEW_CFUNC(func, 0), NOEX_PRIVATE);
}
void
-rb_undef_alloc_func(klass)
- VALUE klass;
+rb_undef_alloc_func(VALUE klass)
{
Check_Type(klass, T_CLASS);
rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, 0, NOEX_UNDEF);
}
static NODE*
-search_method(klass, id, origin)
- VALUE klass, *origin;
- ID id;
+search_method(VALUE klass, ID id, VALUE *origin)
{
NODE *body;
@@ -455,10 +430,7 @@ search_method(klass, id, origin)
}
static NODE*
-rb_get_method_body(klassp, idp, noexp)
- VALUE *klassp;
- ID *idp;
- int *noexp;
+rb_get_method_body(VALUE *klassp, ID *idp, int *noexp)
{
ID id = *idp;
VALUE klass = *klassp;
@@ -516,9 +488,7 @@ rb_get_method_body(klassp, idp, noexp)
}
NODE*
-rb_method_node(klass, id)
- VALUE klass;
- ID id;
+rb_method_node(VALUE klass, ID id)
{
int noex;
struct cache_entry *ent;
@@ -532,9 +502,7 @@ rb_method_node(klass, id)
}
static void
-remove_method(klass, mid)
- VALUE klass;
- ID mid;
+remove_method(VALUE klass, ID mid)
{
NODE *body;
@@ -563,9 +531,7 @@ remove_method(klass, mid)
}
void
-rb_remove_method(klass, name)
- VALUE klass;
- const char *name;
+rb_remove_method(VALUE klass, const char *name)
{
remove_method(klass, rb_intern(name));
}
@@ -579,10 +545,7 @@ rb_remove_method(klass, name)
*/
static VALUE
-rb_mod_remove_method(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
{
int i;
@@ -596,26 +559,19 @@ rb_mod_remove_method(argc, argv, mod)
#undef rb_enable_super
void
-rb_disable_super(klass, name)
- VALUE klass;
- const char *name;
+rb_disable_super(VALUE klass, const char *name)
{
/* obsolete - no use */
}
void
-rb_enable_super(klass, name)
- VALUE klass;
- const char *name;
+rb_enable_super(VALUE klass, const char *name)
{
rb_warning("rb_enable_super() is obsolete");
}
static void
-rb_export_method(klass, name, noex)
- VALUE klass;
- ID name;
- ID noex;
+rb_export_method(VALUE klass, ID name, ID noex)
{
NODE *body;
VALUE origin;
@@ -641,10 +597,7 @@ rb_export_method(klass, name, noex)
}
int
-rb_method_boundp(klass, id, ex)
- VALUE klass;
- ID id;
- int ex;
+rb_method_boundp(VALUE klass, ID id, int ex)
{
struct cache_entry *ent;
int noex;
@@ -666,10 +619,7 @@ rb_method_boundp(klass, id, ex)
}
void
-rb_attr(klass, id, read, write, ex)
- VALUE klass;
- ID id;
- int read, write, ex;
+rb_attr(VALUE klass, ID id, int read, int write, int ex)
{
const char *name;
char *buf;
@@ -815,10 +765,7 @@ struct RVarmap *ruby_dyna_vars;
#define DVAR_DONT_RECYCLE FL_USER2
static struct RVarmap*
-new_dvar(id, value, prev)
- ID id;
- VALUE value;
- struct RVarmap *prev;
+new_dvar(ID id, VALUE value, struct RVarmap *prev)
{
NEWOBJ(vars, struct RVarmap);
OBJSETUP(vars, 0, T_VARMAP);
@@ -830,8 +777,7 @@ new_dvar(id, value, prev)
}
VALUE
-rb_dvar_defined(id)
- ID id;
+rb_dvar_defined(ID id)
{
struct RVarmap *vars = ruby_dyna_vars;
@@ -843,8 +789,7 @@ rb_dvar_defined(id)
}
VALUE
-rb_dvar_curr(id)
- ID id;
+rb_dvar_curr(ID id)
{
struct RVarmap *vars = ruby_dyna_vars;
@@ -857,8 +802,7 @@ rb_dvar_curr(id)
}
VALUE
-rb_dvar_ref(id)
- ID id;
+rb_dvar_ref(ID id)
{
struct RVarmap *vars = ruby_dyna_vars;
@@ -872,18 +816,13 @@ rb_dvar_ref(id)
}
void
-rb_dvar_push(id, value)
- ID id;
- VALUE value;
+rb_dvar_push(ID id, VALUE value)
{
ruby_dyna_vars = new_dvar(id, value, ruby_dyna_vars);
}
static void
-dvar_asgn_internal(id, value, curr)
- ID id;
- VALUE value;
- int curr;
+dvar_asgn_internal(ID id, VALUE value, int curr)
{
int n = 0;
struct RVarmap *vars = ruby_dyna_vars;
@@ -910,24 +849,19 @@ dvar_asgn_internal(id, value, curr)
}
static inline void
-dvar_asgn(id, value)
- ID id;
- VALUE value;
+dvar_asgn(ID id, VALUE value)
{
dvar_asgn_internal(id, value, 0);
}
static inline void
-dvar_asgn_curr(id, value)
- ID id;
- VALUE value;
+dvar_asgn_curr(ID id, VALUE value)
{
dvar_asgn_internal(id, value, 1);
}
VALUE *
-rb_svar(cnt)
- int cnt;
+rb_svar(int cnt)
{
struct RVarmap *vars = ruby_dyna_vars;
ID id;
@@ -1143,7 +1077,7 @@ static void call_trace_func _((rb_event_t,NODE*,VALUE,ID,VALUE));
#endif
void
-ruby_set_current_source()
+ruby_set_current_source(void)
{
if (ruby_current_node) {
ruby_sourcefile = ruby_current_node->nd_file;
@@ -1152,18 +1086,12 @@ ruby_set_current_source()
}
static void
-#ifdef HAVE_STDARG_PROTOTYPES
warn_printf(const char *fmt, ...)
-#else
-warn_printf(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
char buf[BUFSIZ];
va_list args;
- va_init_list(args, fmt);
+ va_start(args, fmt);
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
rb_write_error(buf);
@@ -1173,7 +1101,7 @@ warn_printf(fmt, va_alist)
#define warn_print2(x,l) rb_write_error2(x,l)
static void
-error_pos()
+error_pos(void)
{
ruby_set_current_source();
if (ruby_sourcefile) {
@@ -1191,8 +1119,7 @@ error_pos()
}
static VALUE
-get_backtrace(info)
- VALUE info;
+get_backtrace(VALUE info)
{
if (NIL_P(info)) return Qnil;
info = rb_funcall(info, rb_intern("backtrace"), 0);
@@ -1201,14 +1128,13 @@ get_backtrace(info)
}
static void
-set_backtrace(info, bt)
- VALUE info, bt;
+set_backtrace(VALUE info, VALUE bt)
{
rb_funcall(info, rb_intern("set_backtrace"), 1, bt);
}
static void
-error_print()
+error_print(void)
{
VALUE errat = Qnil; /* OK */
volatile VALUE eclass, e;
@@ -1329,7 +1255,7 @@ void Init_ext _((void));
#ifdef HAVE_NATIVETHREAD
static rb_nativethread_t ruby_thid;
int
-is_ruby_native_thread()
+is_ruby_native_thread(void)
{
return NATIVETHREAD_EQUAL(ruby_thid, NATIVETHREAD_CURRENT());
}
@@ -1347,7 +1273,7 @@ ruby_native_thread_kill(sig)
NORETURN(static void rb_thread_start_1 _((void)));
void
-ruby_init()
+ruby_init(void)
{
static int initialized = 0;
static struct FRAME frame;
@@ -1405,9 +1331,7 @@ ruby_init()
}
static VALUE
-eval_node(self, node)
- VALUE self;
- NODE *node;
+eval_node(VALUE self, NODE *node)
{
if (!node) return Qnil;
if (nd_type(node) == NODE_PRELUDE) {
@@ -1423,23 +1347,21 @@ int ruby_in_eval;
static void rb_thread_cleanup _((void));
static void rb_thread_wait_other_threads _((void));
-static int thread_set_raised();
-static int thread_reset_raised();
+static int thread_set_raised(void);
+static int thread_reset_raised(void);
static VALUE exception_error;
static VALUE sysstack_error;
static int
-sysexit_status(err)
- VALUE err;
+sysexit_status(VALUE err)
{
VALUE st = rb_iv_get(err, "status");
return NUM2INT(st);
}
static int
-error_handle(ex)
- int ex;
+error_handle(int ex)
{
int status = EXIT_FAILURE;
@@ -1498,9 +1420,7 @@ error_handle(ex)
}
void
-ruby_options(argc, argv)
- int argc;
- char **argv;
+ruby_options(int argc, char **argv)
{
int state;
@@ -1523,7 +1443,7 @@ ruby_options(argc, argv)
void rb_exec_end_proc _((void));
static void
-ruby_finalize_0()
+ruby_finalize_0(void)
{
PUSH_TAG(PROT_NONE);
if (EXEC_TAG() == 0) {
@@ -1534,7 +1454,7 @@ ruby_finalize_0()
}
static void
-ruby_finalize_1()
+ruby_finalize_1(void)
{
signal(SIGINT, SIG_DFL);
ruby_errinfo = 0;
@@ -1544,15 +1464,14 @@ ruby_finalize_1()
}
void
-ruby_finalize()
+ruby_finalize(void)
{
ruby_finalize_0();
ruby_finalize_1();
}
int
-ruby_cleanup(ex)
- int ex;
+ruby_cleanup(int ex)
{
int state;
volatile VALUE err = ruby_errinfo;
@@ -1589,7 +1508,7 @@ ruby_cleanup(ex)
extern NODE *ruby_eval_tree;
static int
-ruby_exec_internal()
+ruby_exec_internal(void)
{
int state;
@@ -1609,7 +1528,7 @@ ruby_exec_internal()
}
int
-ruby_exec()
+ruby_exec(void)
{
volatile NODE *tmp;
@@ -1618,14 +1537,13 @@ ruby_exec()
}
void
-ruby_stop(ex)
- int ex;
+ruby_stop(int ex)
{
exit(ruby_cleanup(ex));
}
void
-ruby_run()
+ruby_run(void)
{
int state;
static int ex;
@@ -1637,8 +1555,7 @@ ruby_run()
}
static void
-compile_error(at)
- const char *at;
+compile_error(const char *at)
{
VALUE str;
@@ -1656,8 +1573,7 @@ compile_error(at)
}
VALUE
-rb_eval_string(str)
- const char *str;
+rb_eval_string(const char *str)
{
VALUE v;
NODE *oldsrc = ruby_current_node;
@@ -1671,17 +1587,13 @@ rb_eval_string(str)
}
VALUE
-rb_eval_string_protect(str, state)
- const char *str;
- int *state;
+rb_eval_string_protect(const char *str, int *state)
{
return rb_protect((VALUE (*)_((VALUE)))rb_eval_string, (VALUE)str, state);
}
VALUE
-rb_eval_string_wrap(str, state)
- const char *str;
- int *state;
+rb_eval_string_wrap(const char *str, int *state)
{
int status;
VALUE self = ruby_top_self;
@@ -1717,10 +1629,7 @@ rb_eval_string_wrap(str, state)
NORETURN(static void localjump_error(const char*, VALUE, int));
static void
-localjump_error(mesg, value, reason)
- const char *mesg;
- VALUE value;
- int reason;
+localjump_error(const char *mesg, VALUE value, int reason)
{
VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
ID id;
@@ -1751,8 +1660,7 @@ localjump_error(mesg, value, reason)
* Returns the exit value associated with this +LocalJumpError+.
*/
static VALUE
-localjump_xvalue(exc)
- VALUE exc;
+localjump_xvalue(VALUE exc)
{
return rb_iv_get(exc, "@exit_value");
}
@@ -1766,17 +1674,14 @@ localjump_xvalue(exc)
*/
static VALUE
-localjump_reason(exc)
- VALUE exc;
+localjump_reason(VALUE exc)
{
return rb_iv_get(exc, "@reason");
}
NORETURN(static void jump_tag_but_local_jump _((int,VALUE)));
static void
-jump_tag_but_local_jump(state, val)
- int state;
- VALUE val;
+jump_tag_but_local_jump(int state, VALUE val)
{
if (val == Qundef) val = prot_tag->retval;
@@ -1805,9 +1710,7 @@ jump_tag_but_local_jump(state, val)
}
VALUE
-rb_eval_cmd(cmd, arg, level)
- VALUE cmd, arg;
- int level;
+rb_eval_cmd(VALUE cmd, VALUE arg, int level)
{
int state;
VALUE val = Qnil; /* OK */
@@ -1860,10 +1763,7 @@ rb_eval_cmd(cmd, arg, level)
#define ruby_cbase (ruby_cref->nd_clss)
static VALUE
-ev_const_defined(cref, id, self)
- NODE *cref;
- ID id;
- VALUE self;
+ev_const_defined(NODE *cref, ID id, VALUE self)
{
NODE *cbase = cref;
VALUE result;
@@ -1884,10 +1784,7 @@ ev_const_defined(cref, id, self)
}
static VALUE
-ev_const_get(cref, id, self)
- NODE *cref;
- ID id;
- VALUE self;
+ev_const_get(NODE *cref, ID id, VALUE self)
{
NODE *cbase = cref;
VALUE result;
@@ -1909,7 +1806,7 @@ ev_const_get(cref, id, self)
}
static VALUE
-cvar_cbase()
+cvar_cbase(void)
{
NODE *cref = ruby_cref;
@@ -1941,7 +1838,7 @@ cvar_cbase()
*/
static VALUE
-rb_mod_nesting()
+rb_mod_nesting(void)
{
NODE *cbase = ruby_cref;
VALUE ary = rb_ary_new();
@@ -1971,7 +1868,7 @@ rb_mod_nesting()
*/
static VALUE
-rb_mod_s_constants()
+rb_mod_s_constants(void)
{
NODE *cbase = ruby_cref;
void *data = 0;
@@ -1990,8 +1887,7 @@ rb_mod_s_constants()
}
void
-rb_frozen_class_p(klass)
- VALUE klass;
+rb_frozen_class_p(VALUE klass)
{
char *desc = "something(?!)";
@@ -2012,9 +1908,7 @@ rb_frozen_class_p(klass)
}
void
-rb_undef(klass, id)
- VALUE klass;
- ID id;
+rb_undef(VALUE klass, ID id)
{
VALUE origin;
NODE *body;
@@ -2104,10 +1998,7 @@ rb_undef(klass, id)
*/
static VALUE
-rb_mod_undef_method(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_mod_undef_method(int argc, VALUE *argv, VALUE mod)
{
int i;
@@ -2118,9 +2009,7 @@ rb_mod_undef_method(argc, argv, mod)
}
void
-rb_alias(klass, name, def)
- VALUE klass;
- ID name, def;
+rb_alias(VALUE klass, ID name, ID def)
{
VALUE origin;
NODE *orig, *body, *node;
@@ -2190,17 +2079,14 @@ rb_alias(klass, name, def)
*/
static VALUE
-rb_mod_alias_method(mod, newname, oldname)
- VALUE mod, newname, oldname;
+rb_mod_alias_method(VALUE mod, VALUE newname, VALUE oldname)
{
rb_alias(mod, rb_to_id(newname), rb_to_id(oldname));
return mod;
}
static NODE*
-copy_node_scope(node, rval)
- NODE *node;
- NODE *rval;
+copy_node_scope(NODE *node, NODE *rval)
{
NODE *copy = NEW_NODE(NODE_SCOPE,0,rval,node->nd_next);
@@ -2278,11 +2164,7 @@ copy_node_scope(node, rval)
static const char* is_defined _((VALUE, NODE*, char*, int));
static char*
-arg_defined(self, node, buf, type)
- VALUE self;
- NODE *node;
- char *buf;
- char *type;
+arg_defined(VALUE self, NODE *node, char *buf, char *type)
{
int argc;
int i;
@@ -2305,11 +2187,7 @@ arg_defined(self, node, buf, type)
}
static const char*
-is_defined(self, node, buf, noeval)
- VALUE self;
- NODE *node; /* OK */
- char *buf;
- int noeval;
+is_defined(VALUE self, NODE *node /* OK */, char *buf, int noeval)
{
VALUE val; /* OK */
int state;
@@ -2488,11 +2366,10 @@ is_defined(self, node, buf, noeval)
static int handle_rescue _((VALUE,NODE*));
-static void blk_free();
+static void blk_free(struct BLOCK *data);
static VALUE
-rb_obj_is_proc(proc)
- VALUE proc;
+rb_obj_is_proc(VALUE proc)
{
if (TYPE(proc) == T_DATA && RDATA(proc)->dfree == (RUBY_DATA_FUNC)blk_free) {
return Qtrue;
@@ -2501,9 +2378,7 @@ rb_obj_is_proc(proc)
}
void
-rb_add_event_hook(func, events)
- rb_event_hook_func_t func;
- rb_event_t events;
+rb_add_event_hook(rb_event_hook_func_t func, rb_event_t events)
{
rb_event_hook_t *hook;
@@ -2515,8 +2390,7 @@ rb_add_event_hook(func, events)
}
int
-rb_remove_event_hook(func)
- rb_event_hook_func_t func;
+rb_remove_event_hook(rb_event_hook_func_t func)
{
rb_event_hook_t *prev, *hook;
@@ -2584,8 +2458,7 @@ rb_remove_event_hook(func)
static VALUE
-set_trace_func(obj, trace)
- VALUE obj, trace;
+set_trace_func(VALUE obj, VALUE trace)
{
rb_event_hook_t *hook;
@@ -2632,12 +2505,7 @@ get_event_name(rb_event_t event)
}
static void
-call_trace_func(event, node, self, id, klass)
- rb_event_t event;
- NODE *node;
- VALUE self;
- ID id;
- VALUE klass; /* OK */
+call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass /* OK */)
{
int state, raised;
struct FRAME *prev;
@@ -2698,8 +2566,7 @@ call_trace_func(event, node, self, id, klass)
}
static VALUE
-avalue_to_svalue(v)
- VALUE v;
+avalue_to_svalue(VALUE v)
{
VALUE tmp, top;
@@ -2724,8 +2591,7 @@ avalue_to_svalue(v)
}
static VALUE
-svalue_to_avalue(v)
- VALUE v;
+svalue_to_avalue(VALUE v)
{
VALUE tmp, top;
@@ -2745,9 +2611,7 @@ svalue_to_avalue(v)
}
static VALUE
-svalue_to_mrhs(v, lhs)
- VALUE v;
- NODE *lhs;
+svalue_to_mrhs(VALUE v, NODE *lhs)
{
VALUE tmp;
@@ -2764,8 +2628,7 @@ svalue_to_mrhs(v, lhs)
}
static VALUE
-avalue_splat(v)
- VALUE v;
+avalue_splat(VALUE v)
{
if (RARRAY(v)->len == 0) {
return Qundef;
@@ -2777,8 +2640,7 @@ avalue_splat(v)
}
static VALUE
-splat_value(v)
- VALUE v;
+splat_value(VALUE v)
{
VALUE tmp = rb_check_array_type(v);
@@ -2788,9 +2650,7 @@ splat_value(v)
}
static VALUE
-class_prefix(self, cpath)
- VALUE self;
- NODE *cpath;
+class_prefix(VALUE self, NODE *cpath)
{
if (!cpath) {
rb_bug("class path missing");
@@ -2829,8 +2689,7 @@ NORETURN(static void break_jump _((VALUE)));
NORETURN(static void unknown_node _((NODE * volatile)));
static void
-unknown_node(node)
- NODE *volatile node;
+unknown_node(NODE *volatile node)
{
ruby_current_node = 0;
if (node->flags == 0) {
@@ -2845,9 +2704,7 @@ unknown_node(node)
}
static VALUE
-rb_eval(self, n)
- VALUE self;
- NODE *n;
+rb_eval(VALUE self, NODE *n)
{
NODE * volatile contnode = 0;
NODE * volatile node = n;
@@ -4103,9 +3960,7 @@ rb_eval(self, n)
}
static VALUE
-module_setup(module, n)
- VALUE module;
- NODE *n;
+module_setup(VALUE module, NODE *n)
{
NODE * volatile node = n->nd_body;
int state;
@@ -4157,9 +4012,7 @@ module_setup(module, n)
static NODE *basic_respond_to = 0;
int
-rb_respond_to(obj, id)
- VALUE obj;
- ID id;
+rb_respond_to(VALUE obj, ID id)
{
VALUE klass = CLASS_OF(obj);
if (rb_method_node(klass, respond_to) == basic_respond_to &&
@@ -4183,10 +4036,7 @@ rb_respond_to(obj, id)
*/
static VALUE
-rb_obj_respond_to(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_respond_to(int argc, VALUE *argv, VALUE obj)
{
VALUE mid, priv;
ID id;
@@ -4226,8 +4076,7 @@ rb_obj_respond_to(argc, argv, obj)
*/
static VALUE
-rb_mod_method_defined(mod, mid)
- VALUE mod, mid;
+rb_mod_method_defined(VALUE mod, VALUE mid)
{
return rb_method_boundp(mod, rb_to_id(mid), 1);
}
@@ -4261,8 +4110,7 @@ rb_mod_method_defined(mod, mid)
*/
static VALUE
-rb_mod_public_method_defined(mod, mid)
- VALUE mod, mid;
+rb_mod_public_method_defined(VALUE mod, VALUE mid)
{
ID id = rb_to_id(mid);
int noex;
@@ -4301,8 +4149,7 @@ rb_mod_public_method_defined(mod, mid)
*/
static VALUE
-rb_mod_private_method_defined(mod, mid)
- VALUE mod, mid;
+rb_mod_private_method_defined(VALUE mod, VALUE mid)
{
ID id = rb_to_id(mid);
int noex;
@@ -4341,8 +4188,7 @@ rb_mod_private_method_defined(mod, mid)
*/
static VALUE
-rb_mod_protected_method_defined(mod, mid)
- VALUE mod, mid;
+rb_mod_protected_method_defined(VALUE mod, VALUE mid)
{
ID id = rb_to_id(mid);
int noex;
@@ -4356,9 +4202,7 @@ rb_mod_protected_method_defined(mod, mid)
NORETURN(static VALUE terminate_process _((int, VALUE)));
static VALUE
-terminate_process(status, mesg)
- int status;
- VALUE mesg;
+terminate_process(int status, VALUE mesg)
{
VALUE args[2];
args[0] = INT2NUM(status);
@@ -4368,8 +4212,7 @@ terminate_process(status, mesg)
}
void
-rb_exit(status)
- int status;
+rb_exit(int status)
{
if (prot_tag) {
terminate_process(status, rb_str_new("exit", 4));
@@ -4418,9 +4261,7 @@ rb_exit(status)
*/
VALUE
-rb_f_exit(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_exit(int argc, VALUE *argv)
{
VALUE status;
int istatus;
@@ -4462,9 +4303,7 @@ rb_f_exit(argc, argv)
*/
VALUE
-rb_f_abort(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_abort(int argc, VALUE *argv)
{
rb_secure(4);
if (argc == 0) {
@@ -4485,7 +4324,7 @@ rb_f_abort(argc, argv)
}
void
-rb_iter_break()
+rb_iter_break(void)
{
break_jump(Qnil);
}
@@ -4494,9 +4333,7 @@ NORETURN(static void rb_longjmp _((int, VALUE)));
static VALUE make_backtrace _((void));
static void
-rb_longjmp(tag, mesg)
- int tag;
- VALUE mesg;
+rb_longjmp(int tag, VALUE mesg)
{
VALUE at;
@@ -4559,21 +4396,19 @@ rb_longjmp(tag, mesg)
}
void
-rb_exc_raise(mesg)
- VALUE mesg;
+rb_exc_raise(VALUE mesg)
{
rb_longjmp(TAG_RAISE, mesg);
}
void
-rb_exc_fatal(mesg)
- VALUE mesg;
+rb_exc_fatal(VALUE mesg)
{
rb_longjmp(TAG_FATAL, mesg);
}
void
-rb_interrupt()
+rb_interrupt(void)
{
rb_raise(rb_eInterrupt, "");
}
@@ -4603,18 +4438,14 @@ rb_interrupt()
*/
static VALUE
-rb_f_raise(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_raise(int argc, VALUE *argv)
{
rb_raise_jump(rb_make_exception(argc, argv));
return Qnil; /* not reached */
}
static VALUE
-rb_make_exception(argc, argv)
- int argc;
- VALUE *argv;
+rb_make_exception(int argc, VALUE *argv)
{
VALUE mesg;
ID exception;
@@ -4659,8 +4490,7 @@ rb_make_exception(argc, argv)
}
static void
-rb_raise_jump(mesg)
- VALUE mesg;
+rb_raise_jump(VALUE mesg)
{
if (ruby_frame != top_frame) {
PUSH_FRAME(); /* fake frame */
@@ -4672,14 +4502,13 @@ rb_raise_jump(mesg)
}
void
-rb_jump_tag(tag)
- int tag;
+rb_jump_tag(int tag)
{
JUMP_TAG(tag);
}
int
-rb_block_given_p()
+rb_block_given_p(void)
{
if (ruby_frame->iter == ITER_CUR && ruby_block)
return Qtrue;
@@ -4687,7 +4516,7 @@ rb_block_given_p()
}
int
-rb_iterator_p()
+rb_iterator_p(void)
{
return rb_block_given_p();
}
@@ -4715,7 +4544,7 @@ rb_iterator_p()
static VALUE
-rb_f_block_given_p()
+rb_f_block_given_p(void)
{
if (ruby_frame->prev && ruby_frame->prev->iter == ITER_CUR && ruby_block)
return Qtrue;
@@ -4726,9 +4555,7 @@ static VALUE rb_eThreadError;
NORETURN(static void proc_jump_error(int, VALUE));
static void
-proc_jump_error(state, result)
- int state;
- VALUE result;
+proc_jump_error(int state, VALUE result)
{
char mesg[32];
char *statement;
@@ -4749,8 +4576,7 @@ proc_jump_error(state, result)
NORETURN(static void return_jump(VALUE));
static void
-return_jump(retval)
- VALUE retval;
+return_jump(VALUE retval)
{
struct tag *tt = prot_tag;
int yield = Qfalse;
@@ -4777,8 +4603,7 @@ return_jump(retval)
}
static void
-break_jump(retval)
- VALUE retval;
+break_jump(VALUE retval)
{
struct tag *tt = prot_tag;
@@ -4808,7 +4633,7 @@ static VALUE bmcall _((VALUE, VALUE));
static int method_arity _((VALUE));
void
-rb_need_block()
+rb_need_block(void)
{
if (!rb_block_given_p()) {
localjump_error("no block given", Qnil, 0);
@@ -4816,9 +4641,7 @@ rb_need_block()
}
static VALUE
-rb_yield_0(val, self, klass, flags, avalue)
- VALUE val, self, klass; /* OK */
- int flags, avalue;
+rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags, int avalue)
{
NODE *node, *var;
volatile VALUE result = Qnil;
@@ -5069,20 +4892,13 @@ rb_yield_0(val, self, klass, flags, avalue)
}
VALUE
-rb_yield(val)
- VALUE val;
+rb_yield(VALUE val)
{
return rb_yield_0(val, 0, 0, 0, Qfalse);
}
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_yield_values(int n, ...)
-#else
-rb_yield_values(n, va_alist)
- int n;
- va_dcl
-#endif
{
int i;
va_list args;
@@ -5092,7 +4908,7 @@ rb_yield_values(n, va_alist)
return rb_yield_0(Qundef, 0, 0, 0, Qfalse);
}
val = rb_values_new2(n, 0);
- va_init_list(args, n);
+ va_start(args, n);
for (i=0; i<n; i++) {
RARRAY(val)->ptr[i] = va_arg(args, VALUE);
}
@@ -5102,8 +4918,7 @@ rb_yield_values(n, va_alist)
}
VALUE
-rb_yield_splat(values)
- VALUE values;
+rb_yield_splat(VALUE values)
{
int avalue = Qfalse;
@@ -5133,7 +4948,7 @@ rb_yield_splat(values)
*/
static VALUE
-rb_f_loop()
+rb_f_loop(void)
{
for (;;) {
rb_yield_0(Qundef, 0, 0, 0, Qfalse);
@@ -5143,11 +4958,7 @@ rb_f_loop()
}
static VALUE
-massign(self, node, val, pcall)
- VALUE self;
- NODE *node;
- VALUE val;
- int pcall;
+massign(VALUE self, NODE *node, VALUE val, int pcall)
{
NODE *list;
long i = 0, len;
@@ -5190,11 +5001,7 @@ massign(self, node, val, pcall)
}
static void
-assign(self, lhs, val, pcall)
- VALUE self;
- NODE *lhs;
- VALUE val;
- int pcall;
+assign(VALUE self, NODE *lhs, VALUE val, int pcall)
{
ruby_current_node = lhs;
if (val == Qundef) {
@@ -5288,9 +5095,7 @@ assign(self, lhs, val, pcall)
}
VALUE
-rb_iterate(it_proc, data1, bl_proc, data2)
- VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
- VALUE data1, data2;
+rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1, VALUE (*bl_proc) (/* ??? */), VALUE data2)
{
int state;
volatile VALUE retval = Qnil;
@@ -5327,9 +5132,7 @@ rb_iterate(it_proc, data1, bl_proc, data2)
}
static int
-handle_rescue(self, node)
- VALUE self;
- NODE *node;
+handle_rescue(VALUE self, NODE *node)
{
int argc; VALUE *argv; /* used in SETUP_ARGS */
TMP_PROTECT;
@@ -5353,14 +5156,7 @@ handle_rescue(self, node)
}
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_rescue2(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*r_proc)(ANYARGS), VALUE data2, ...)
-#else
-rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
- VALUE (*b_proc)(ANYARGS), (*r_proc)(ANYARGS);
- VALUE data1, data2;
- va_dcl
-#endif
{
int state;
volatile VALUE result;
@@ -5382,7 +5178,7 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
case TAG_RAISE:
if (handle) break;
handle = Qfalse;
- va_init_list(args, data2);
+ va_start(args, data2);
while (eclass = va_arg(args, VALUE)) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
handle = Qtrue;
@@ -5409,9 +5205,7 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
}
VALUE
-rb_rescue(b_proc, data1, r_proc, data2)
- VALUE (*b_proc)(), (*r_proc)();
- VALUE data1, data2;
+rb_rescue(VALUE (*b_proc) (/* ??? */), VALUE data1, VALUE (*r_proc) (/* ??? */), VALUE data2)
{
return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, (VALUE)0);
}
@@ -5419,10 +5213,7 @@ rb_rescue(b_proc, data1, r_proc, data2)
static VALUE cont_protect;
VALUE
-rb_protect(proc, data, state)
- VALUE (*proc) _((VALUE));
- VALUE data;
- int *state;
+rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
{
VALUE result = Qnil; /* OK */
int status;
@@ -5448,11 +5239,7 @@ rb_protect(proc, data, state)
}
VALUE
-rb_ensure(b_proc, data1, e_proc, data2)
- VALUE (*b_proc)();
- VALUE data1;
- VALUE (*e_proc)();
- VALUE data2;
+rb_ensure(VALUE (*b_proc) (/* ??? */), VALUE data1, VALUE (*e_proc) (/* ??? */), VALUE data2)
{
int state;
volatile VALUE result = Qnil;
@@ -5471,9 +5258,7 @@ rb_ensure(b_proc, data1, e_proc, data2)
}
VALUE
-rb_with_disable_interrupt(proc, data)
- VALUE (*proc)();
- VALUE data;
+rb_with_disable_interrupt(VALUE (*proc) (/* ??? */), VALUE data)
{
VALUE result = Qnil; /* OK */
int status;
@@ -5497,7 +5282,7 @@ rb_with_disable_interrupt(proc, data)
}
static inline void
-stack_check()
+stack_check(void)
{
static int overflowing = 0;
@@ -5552,10 +5337,7 @@ static int last_call_status;
*/
static VALUE
-rb_method_missing(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_method_missing(int argc, VALUE *argv, VALUE obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
@@ -5607,12 +5389,7 @@ rb_method_missing(argc, argv, obj)
}
static VALUE
-method_missing(obj, id, argc, argv, call_status)
- VALUE obj;
- ID id;
- int argc;
- const VALUE *argv;
- int call_status;
+method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
{
VALUE *nargv;
@@ -5635,11 +5412,7 @@ method_missing(obj, id, argc, argv, call_status)
}
static inline VALUE
-call_cfunc(func, recv, len, argc, argv)
- VALUE (*func)();
- VALUE recv;
- int len, argc;
- VALUE *argv;
+call_cfunc(VALUE (*func) (/* ??? */), VALUE recv, int len, int argc, VALUE *argv)
{
if (len >= 0 && argc != len) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
@@ -5723,12 +5496,7 @@ call_cfunc(func, recv, len, argc, argv)
}
static int
-formal_assign(recv, node, argc, argv, local_vars)
- VALUE recv;
- NODE *node;
- int argc;
- VALUE *argv;
- VALUE *local_vars;
+formal_assign(VALUE recv, NODE *node, int argc, VALUE *argv, VALUE *local_vars)
{
int i;
int nopt = 0;
@@ -5800,14 +5568,8 @@ formal_assign(recv, node, argc, argv, local_vars)
}
static VALUE
-rb_call0(klass, recv, id, oid, argc, argv, body, flags)
- VALUE klass, recv;
- ID id;
- ID oid;
- int argc; /* OK */
- VALUE *argv; /* OK */
- NODE * volatile body;
- int flags;
+rb_call0(VALUE klass, VALUE recv, ID id, ID oid,
+ int argc /* OK */, VALUE *argv /* OK */, NODE *volatile body, int flags)
{
NODE *b2; /* OK */
volatile VALUE result = Qnil;
@@ -5998,12 +5760,8 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
}
static VALUE
-rb_call(klass, recv, mid, argc, argv, scope)
- VALUE klass, recv;
- ID mid;
- int argc; /* OK */
- const VALUE *argv; /* OK */
- int scope;
+rb_call(VALUE klass, VALUE recv, ID mid,
+ int argc /* OK */, const VALUE *argv /* OK */, int scope)
{
NODE *body; /* OK */
int noex;
@@ -6054,10 +5812,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
}
VALUE
-rb_apply(recv, mid, args)
- VALUE recv;
- ID mid;
- VALUE args;
+rb_apply(VALUE recv, ID mid, VALUE args)
{
int argc;
VALUE *argv;
@@ -6069,11 +5824,7 @@ rb_apply(recv, mid, args)
}
static VALUE
-send_fcall(argc, argv, recv, scope)
- int argc;
- VALUE *argv;
- VALUE recv;
- int scope;
+send_fcall(int argc, VALUE *argv, VALUE recv, int scope)
{
VALUE vid;
@@ -6111,10 +5862,7 @@ send_fcall(argc, argv, recv, scope)
*/
static VALUE
-rb_f_send(argc, argv, recv)
- int argc;
- VALUE *argv;
- VALUE recv;
+rb_f_send(int argc, VALUE *argv, VALUE recv)
{
int scope = (ruby_frame->flags & FRAME_FUNC) ? 1 : 0;
@@ -6134,28 +5882,17 @@ rb_f_send(argc, argv, recv)
*/
static VALUE
-rb_f_fcall(argc, argv, recv)
- int argc;
- VALUE *argv;
- VALUE recv;
+rb_f_fcall(int argc, VALUE *argv, VALUE recv)
{
return send_fcall(argc, argv, recv, 1);
}
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_funcall(VALUE recv, ID mid, int n, ...)
-#else
-rb_funcall(recv, mid, n, va_alist)
- VALUE recv;
- ID mid;
- int n;
- va_dcl
-#endif
{
VALUE *argv;
va_list ar;
- va_init_list(ar, n);
+ va_start(ar, n);
if (n > 0) {
long i;
@@ -6175,29 +5912,19 @@ rb_funcall(recv, mid, n, va_alist)
}
VALUE
-rb_funcall2(recv, mid, argc, argv)
- VALUE recv;
- ID mid;
- int argc;
- const VALUE *argv;
+rb_funcall2(VALUE recv, ID mid, int argc, const VALUE *argv)
{
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
}
VALUE
-rb_funcall3(recv, mid, argc, argv)
- VALUE recv;
- ID mid;
- int argc;
- const VALUE *argv;
+rb_funcall3(VALUE recv, ID mid, int argc, const VALUE *argv)
{
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
}
VALUE
-rb_call_super(argc, argv)
- int argc;
- const VALUE *argv;
+rb_call_super(int argc, const VALUE *argv)
{
VALUE result, self, klass;
@@ -6217,8 +5944,7 @@ rb_call_super(argc, argv)
}
static VALUE
-backtrace(lev)
- int lev;
+backtrace(int lev)
{
struct FRAME *frame = ruby_frame;
VALUE str;
@@ -6294,9 +6020,7 @@ backtrace(lev)
*/
static VALUE
-rb_f_caller(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_caller(int argc, VALUE *argv)
{
VALUE level;
int lev;
@@ -6311,7 +6035,7 @@ rb_f_caller(argc, argv)
}
void
-rb_backtrace()
+rb_backtrace(void)
{
long i;
VALUE ary;
@@ -6323,22 +6047,19 @@ rb_backtrace()
}
static VALUE
-make_backtrace()
+make_backtrace(void)
{
return backtrace(-1);
}
ID
-rb_frame_this_func()
+rb_frame_this_func(void)
{
return ruby_frame->this_func;
}
static NODE*
-compile(src, file, line)
- VALUE src;
- char *file;
- int line;
+compile(VALUE src, char *file, int line)
{
NODE *node;
int critical;
@@ -6355,10 +6076,7 @@ compile(src, file, line)
}
static VALUE
-eval(self, src, scope, file, line)
- VALUE self, src, scope;
- char *file;
- int line;
+eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
{
struct BLOCK *data = NULL;
volatile VALUE result = Qnil;
@@ -6512,10 +6230,7 @@ eval(self, src, scope, file, line)
*/
static VALUE
-rb_f_eval(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+rb_f_eval(int argc, VALUE *argv, VALUE self)
{
VALUE src, scope, vfile, vline;
char *file = "(eval)";
@@ -6557,10 +6272,7 @@ rb_f_eval(argc, argv, self)
/* function to call func under the specified class/module context */
static VALUE
-exec_under(func, under, cbase, args)
- VALUE (*func)();
- VALUE under, cbase;
- void *args;
+exec_under(VALUE (*func) (VALUE), VALUE under, VALUE cbase, VALUE args)
{
VALUE val = Qnil; /* OK */
int state;
@@ -6594,18 +6306,16 @@ exec_under(func, under, cbase, args)
}
static VALUE
-eval_under_i(args)
- VALUE *args;
+eval_under_i(VALUE arg)
{
+ VALUE *args = (VALUE *)arg;
+
return eval(args[0], args[1], Qnil, (char*)args[2], (int)args[3]);
}
/* string eval under the class/module context */
static VALUE
-eval_under(under, self, src, file, line)
- VALUE under, self, src;
- const char *file;
- int line;
+eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
{
VALUE args[4];
@@ -6619,29 +6329,24 @@ eval_under(under, self, src, file, line)
args[1] = src;
args[2] = (VALUE)file;
args[3] = (VALUE)line;
- return exec_under(eval_under_i, under, under, args);
+ return exec_under(eval_under_i, under, under, (VALUE)args);
}
static VALUE
-yield_under_i(self)
- VALUE self;
+yield_under_i(VALUE self)
{
return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
}
/* block eval under the class/module context */
static VALUE
-yield_under(under, self)
- VALUE under, self;
+yield_under(VALUE under, VALUE self)
{
return exec_under(yield_under_i, under, 0, self);
}
static VALUE
-specific_eval(argc, argv, klass, self)
- int argc;
- VALUE *argv;
- VALUE klass, self;
+specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
{
if (rb_block_given_p()) {
if (argc > 0) {
@@ -6701,10 +6406,7 @@ specific_eval(argc, argv, klass, self)
*/
VALUE
-rb_obj_instance_eval(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
{
VALUE klass;
@@ -6742,10 +6444,7 @@ rb_obj_instance_eval(argc, argv, self)
*/
VALUE
-rb_mod_module_eval(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
{
return specific_eval(argc, argv, mod, mod);
}
@@ -6755,9 +6454,7 @@ VALUE rb_load_path;
NORETURN(static void load_failed _((VALUE)));
void
-rb_load(fname, wrap)
- VALUE fname;
- int wrap;
+rb_load(VALUE fname, int wrap)
{
VALUE tmp;
int state;
@@ -6857,10 +6554,7 @@ rb_load(fname, wrap)
}
void
-rb_load_protect(fname, wrap, state)
- VALUE fname;
- int wrap;
- int *state;
+rb_load_protect(VALUE fname, int wrap, int *state)
{
int status;
@@ -6891,9 +6585,7 @@ rb_load_protect(fname, wrap, state)
static VALUE
-rb_f_load(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_load(int argc, VALUE *argv)
{
VALUE fname, wrap;
@@ -6914,9 +6606,7 @@ static st_table *loading_tbl;
#endif
static int
-rb_feature_p(feature, ext, rb)
- const char *feature, *ext;
- int rb;
+rb_feature_p(const char *feature, const char *ext, int rb)
{
VALUE v;
char *f, *e;
@@ -6960,8 +6650,7 @@ static const char *const loadable_ext[] = {
static int search_required _((VALUE, VALUE *));
int
-rb_provided(feature)
- const char *feature;
+rb_provided(const char *feature)
{
int i;
char *buf;
@@ -6989,22 +6678,19 @@ rb_provided(feature)
}
static void
-rb_provide_feature(feature)
- VALUE feature;
+rb_provide_feature(VALUE feature)
{
rb_ary_push(rb_features, feature);
}
void
-rb_provide(feature)
- const char *feature;
+rb_provide(const char *feature)
{
rb_provide_feature(rb_str_new2(feature));
}
static int
-load_wait(ftptr)
- char *ftptr;
+load_wait(char *ftptr)
{
st_data_t th;
@@ -7041,15 +6727,13 @@ load_wait(ftptr)
*/
VALUE
-rb_f_require(obj, fname)
- VALUE obj, fname;
+rb_f_require(VALUE obj, VALUE fname)
{
return rb_require_safe(fname, ruby_safe_level);
}
static int
-search_required(fname, path)
- VALUE fname, *path;
+search_required(VALUE fname, VALUE *path)
{
VALUE tmp;
char *ext, *ftptr;
@@ -7127,16 +6811,13 @@ search_required(fname, path)
}
static void
-load_failed(fname)
- VALUE fname;
+load_failed(VALUE fname)
{
rb_raise(rb_eLoadError, "no such file to load -- %s", RSTRING(fname)->ptr);
}
VALUE
-rb_require_safe(fname, safe)
- VALUE fname;
- int safe;
+rb_require_safe(VALUE fname, int safe)
{
VALUE result = Qnil;
volatile VALUE errinfo = ruby_errinfo;
@@ -7219,8 +6900,7 @@ rb_require_safe(fname, safe)
}
VALUE
-rb_require(fname)
- const char *fname;
+rb_require(const char *fname)
{
VALUE fn = rb_str_new2(fname);
OBJ_FREEZE(fn);
@@ -7228,8 +6908,7 @@ rb_require(fname)
}
static void
-secure_visibility(self)
- VALUE self;
+secure_visibility(VALUE self)
{
if (ruby_safe_level >= 4 && !OBJ_TAINTED(self)) {
rb_raise(rb_eSecurityError, "Insecure: can't change method visibility");
@@ -7237,11 +6916,7 @@ secure_visibility(self)
}
static void
-set_method_visibility(self, argc, argv, ex)
- VALUE self;
- int argc;
- VALUE *argv;
- ID ex;
+set_method_visibility(VALUE self, int argc, VALUE *argv, ID ex)
{
int i;
@@ -7263,10 +6938,7 @@ set_method_visibility(self, argc, argv, ex)
*/
static VALUE
-rb_mod_public(argc, argv, module)
- int argc;
- VALUE *argv;
- VALUE module;
+rb_mod_public(int argc, VALUE *argv, VALUE module)
{
secure_visibility(module);
if (argc == 0) {
@@ -7289,10 +6961,7 @@ rb_mod_public(argc, argv, module)
*/
static VALUE
-rb_mod_protected(argc, argv, module)
- int argc;
- VALUE *argv;
- VALUE module;
+rb_mod_protected(int argc, VALUE *argv, VALUE module)
{
secure_visibility(module);
if (argc == 0) {
@@ -7324,10 +6993,7 @@ rb_mod_protected(argc, argv, module)
*/
static VALUE
-rb_mod_private(argc, argv, module)
- int argc;
- VALUE *argv;
- VALUE module;
+rb_mod_private(int argc, VALUE *argv, VALUE module)
{
secure_visibility(module);
if (argc == 0) {
@@ -7347,10 +7013,7 @@ rb_mod_private(argc, argv, module)
*/
static VALUE
-rb_mod_public_method(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_mod_public_method(int argc, VALUE *argv, VALUE obj)
{
set_method_visibility(CLASS_OF(obj), argc, argv, NOEX_PUBLIC);
return obj;
@@ -7373,10 +7036,7 @@ rb_mod_public_method(argc, argv, obj)
*/
static VALUE
-rb_mod_private_method(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_mod_private_method(int argc, VALUE *argv, VALUE obj)
{
set_method_visibility(CLASS_OF(obj), argc, argv, NOEX_PRIVATE);
return obj;
@@ -7393,17 +7053,13 @@ rb_mod_private_method(argc, argv, obj)
*/
static VALUE
-top_public(argc, argv)
- int argc;
- VALUE *argv;
+top_public(int argc, VALUE *argv)
{
return rb_mod_public(argc, argv, rb_cObject);
}
static VALUE
-top_private(argc, argv)
- int argc;
- VALUE *argv;
+top_private(int argc, VALUE *argv)
{
return rb_mod_private(argc, argv, rb_cObject);
}
@@ -7445,10 +7101,7 @@ top_private(argc, argv)
*/
static VALUE
-rb_mod_modfunc(argc, argv, module)
- int argc;
- VALUE *argv;
- VALUE module;
+rb_mod_modfunc(int argc, VALUE *argv, VALUE module)
{
int i;
ID id;
@@ -7501,8 +7154,7 @@ rb_mod_modfunc(argc, argv, module)
*/
static VALUE
-rb_mod_append_features(module, dest)
- VALUE module, dest;
+rb_mod_append_features(VALUE module, VALUE dest)
{
switch (TYPE(dest)) {
case T_CLASS:
@@ -7525,10 +7177,7 @@ rb_mod_append_features(module, dest)
*/
static VALUE
-rb_mod_include(argc, argv, module)
- int argc;
- VALUE *argv;
- VALUE module;
+rb_mod_include(int argc, VALUE *argv, VALUE module)
{
int i;
@@ -7541,10 +7190,7 @@ rb_mod_include(argc, argv, module)
}
void
-rb_obj_call_init(obj, argc, argv)
- VALUE obj;
- int argc;
- VALUE *argv;
+rb_obj_call_init(VALUE obj, int argc, VALUE *argv)
{
PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
rb_funcall2(obj, init, argc, argv);
@@ -7552,8 +7198,7 @@ rb_obj_call_init(obj, argc, argv)
}
void
-rb_extend_object(obj, module)
- VALUE obj, module;
+rb_extend_object(VALUE obj, VALUE module)
{
rb_include_module(rb_singleton_class(obj), module);
}
@@ -7586,8 +7231,7 @@ rb_extend_object(obj, module)
*/
static VALUE
-rb_mod_extend_object(mod, obj)
- VALUE mod, obj;
+rb_mod_extend_object(VALUE mod, VALUE obj)
{
rb_extend_object(obj, mod);
return obj;
@@ -7619,10 +7263,7 @@ rb_mod_extend_object(mod, obj)
*/
static VALUE
-rb_obj_extend(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_extend(int argc, VALUE *argv, VALUE obj)
{
int i;
@@ -7647,10 +7288,7 @@ rb_obj_extend(argc, argv, obj)
*/
static VALUE
-top_include(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+top_include(int argc, VALUE *argv, VALUE self)
{
rb_secure(4);
if (ruby_wrapper) {
@@ -7660,14 +7298,11 @@ top_include(argc, argv, self)
return rb_mod_include(argc, argv, rb_cObject);
}
-VALUE rb_f_trace_var();
-VALUE rb_f_untrace_var();
+VALUE rb_f_trace_var(int, VALUE *);
+VALUE rb_f_untrace_var(int, VALUE *);
static void
-errinfo_setter(val, id, var)
- VALUE val;
- ID id;
- VALUE *var;
+errinfo_setter(VALUE val, ID id, VALUE *var)
{
if (!NIL_P(val) && !rb_obj_is_kind_of(val, rb_eException)) {
rb_raise(rb_eTypeError, "assigning non-exception to $!");
@@ -7676,17 +7311,13 @@ errinfo_setter(val, id, var)
}
static VALUE
-errat_getter(id)
- ID id;
+errat_getter(ID id)
{
return get_backtrace(ruby_errinfo);
}
static void
-errat_setter(val, id, var)
- VALUE val;
- ID id;
- VALUE *var;
+errat_setter(VALUE val, ID id, VALUE *var)
{
if (NIL_P(ruby_errinfo)) {
rb_raise(rb_eArgError, "$! not set");
@@ -7708,7 +7339,7 @@ errat_setter(val, id, var)
*/
static VALUE
-rb_f_local_variables()
+rb_f_local_variables(void)
{
ID *tbl;
int n, i;
@@ -7748,9 +7379,7 @@ struct end_proc_data {
static struct end_proc_data *end_procs, *ephemeral_end_procs, *tmp_end_procs;
void
-rb_set_end_proc(func, data)
- void (*func) _((VALUE));
- VALUE data;
+rb_set_end_proc(void (*func) (VALUE), VALUE data)
{
struct end_proc_data *link = ALLOC(struct end_proc_data);
struct end_proc_data **list;
@@ -7765,7 +7394,7 @@ rb_set_end_proc(func, data)
}
void
-rb_mark_end_proc()
+rb_mark_end_proc(void)
{
struct end_proc_data *link;
@@ -7786,11 +7415,8 @@ rb_mark_end_proc()
}
}
-static void call_end_proc _((VALUE data));
-
static void
-call_end_proc(data)
- VALUE data;
+call_end_proc(VALUE data)
{
PUSH_ITER(ITER_NOT);
PUSH_FRAME();
@@ -7805,7 +7431,7 @@ call_end_proc(data)
}
static void
-rb_f_END()
+rb_f_END(void)
{
PUSH_FRAME();
ruby_frame->argc = 0;
@@ -7836,7 +7462,7 @@ rb_f_END()
*/
static VALUE
-rb_f_at_exit()
+rb_f_at_exit(void)
{
VALUE proc;
@@ -7849,7 +7475,7 @@ rb_f_at_exit()
}
void
-rb_exec_end_proc()
+rb_exec_end_proc(void)
{
struct end_proc_data *link, *tmp;
int status;
@@ -7895,7 +7521,7 @@ rb_exec_end_proc()
}
void
-Init_eval()
+Init_eval(void)
{
init = rb_intern("initialize");
eqq = rb_intern("===");
@@ -8009,10 +7635,7 @@ Init_eval()
*/
static VALUE
-rb_mod_autoload(mod, sym, file)
- VALUE mod;
- VALUE sym;
- VALUE file;
+rb_mod_autoload(VALUE mod, VALUE sym, VALUE file)
{
ID id = rb_to_id(sym);
@@ -8035,8 +7658,7 @@ rb_mod_autoload(mod, sym, file)
*/
static VALUE
-rb_mod_autoload_p(mod, sym)
- VALUE mod, sym;
+rb_mod_autoload_p(VALUE mod, VALUE sym)
{
return rb_autoload_p(mod, rb_to_id(sym));
}
@@ -8053,10 +7675,7 @@ rb_mod_autoload_p(mod, sym)
*/
static VALUE
-rb_f_autoload(obj, sym, file)
- VALUE obj;
- VALUE sym;
- VALUE file;
+rb_f_autoload(VALUE obj, VALUE sym, VALUE file)
{
return rb_mod_autoload(ruby_cbase, sym, file);
}
@@ -8073,16 +7692,14 @@ rb_f_autoload(obj, sym, file)
*/
static VALUE
-rb_f_autoload_p(obj, sym)
- VALUE obj;
- VALUE sym;
+rb_f_autoload_p(VALUE obj, VALUE sym)
{
/* use ruby_cbase as same as rb_f_autoload. */
return rb_mod_autoload_p(ruby_cbase, sym);
}
void
-Init_load()
+Init_load(void)
{
rb_load_path = rb_ary_new();
rb_define_readonly_variable("$:", &rb_load_path);
@@ -8106,8 +7723,7 @@ Init_load()
}
static void
-scope_dup(scope)
- struct SCOPE *scope;
+scope_dup(struct SCOPE *scope)
{
volatile ID *tbl;
VALUE *vars;
@@ -8126,8 +7742,7 @@ scope_dup(scope)
}
static void
-blk_mark(data)
- struct BLOCK *data;
+blk_mark(struct BLOCK *data)
{
while (data) {
rb_gc_mark_frame(&data->frame);
@@ -8144,8 +7759,7 @@ blk_mark(data)
}
static void
-frame_free(frame)
- struct FRAME *frame;
+frame_free(struct FRAME *frame)
{
struct FRAME *tmp;
@@ -8158,8 +7772,7 @@ frame_free(frame)
}
static void
-blk_free(data)
- struct BLOCK *data;
+blk_free(struct BLOCK *data)
{
void *tmp;
@@ -8172,8 +7785,7 @@ blk_free(data)
}
static void
-frame_dup(frame)
- struct FRAME *frame;
+frame_dup(struct FRAME *frame)
{
struct FRAME *tmp;
@@ -8188,8 +7800,7 @@ frame_dup(frame)
}
static void
-blk_copy_prev(block)
- struct BLOCK *block;
+blk_copy_prev(struct BLOCK *block)
{
struct BLOCK *tmp;
struct RVarmap* vars;
@@ -8212,8 +7823,7 @@ blk_copy_prev(block)
static void
-blk_dup(dup, orig)
- struct BLOCK *dup, *orig;
+blk_dup(struct BLOCK *dup, struct BLOCK *orig)
{
MEMCPY(dup, orig, struct BLOCK, 1);
frame_dup(&dup->frame);
@@ -8231,8 +7841,7 @@ blk_dup(dup, orig)
*/
static VALUE
-proc_clone(self)
- VALUE self;
+proc_clone(VALUE self)
{
struct BLOCK *orig, *data;
VALUE bind;
@@ -8250,8 +7859,7 @@ proc_clone(self)
*/
static VALUE
-proc_dup(self)
- VALUE self;
+proc_dup(VALUE self)
{
struct BLOCK *orig, *data;
VALUE bind;
@@ -8280,8 +7888,7 @@ proc_dup(self)
*/
static VALUE
-rb_f_binding(self)
- VALUE self;
+rb_f_binding(VALUE self)
{
struct BLOCK *data, *p;
struct RVarmap *vars;
@@ -8337,10 +7944,7 @@ rb_f_binding(self)
*/
static VALUE
-bind_eval(argc, argv, bind)
- int argc;
- VALUE *argv;
- VALUE bind;
+bind_eval(int argc, VALUE *argv, VALUE bind)
{
struct BLOCK *data;
VALUE args[4];
@@ -8362,8 +7966,7 @@ bind_eval(argc, argv, bind)
#define proc_safe_level_p(data) (!(RBASIC(data)->flags & PROC_NOSAFE))
static void
-proc_save_safe_level(data)
- VALUE data;
+proc_save_safe_level(VALUE data)
{
if (ruby_safe_level >= 3) {
int safe = ruby_safe_level;
@@ -8373,24 +7976,20 @@ proc_save_safe_level(data)
}
static int
-proc_get_safe_level(data)
- VALUE data;
+proc_get_safe_level(VALUE data)
{
return (RBASIC(data)->flags & PROC_TMASK) >> PROC_TSHIFT;
}
static void
-proc_set_safe_level(data)
- VALUE data;
+proc_set_safe_level(VALUE data)
{
if (!proc_safe_level_p(data)) return;
ruby_safe_level = proc_get_safe_level(data);
}
static VALUE
-proc_alloc(klass, proc)
- VALUE klass;
- int proc;
+proc_alloc(VALUE klass, int proc)
{
volatile VALUE block;
struct BLOCK *data, *p;
@@ -8462,10 +8061,7 @@ proc_alloc(klass, proc)
*/
static VALUE
-proc_s_new(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+proc_s_new(int argc, VALUE *argv, VALUE klass)
{
VALUE block = proc_alloc(klass, Qfalse);
@@ -8481,13 +8077,13 @@ proc_s_new(argc, argv, klass)
*/
VALUE
-rb_block_proc()
+rb_block_proc(void)
{
return proc_alloc(rb_cProc, Qfalse);
}
VALUE
-rb_f_lambda()
+rb_f_lambda(void)
{
rb_warn("rb_f_lambda() is deprecated; use rb_block_proc() instead");
return proc_alloc(rb_cProc, Qtrue);
@@ -8502,14 +8098,13 @@ rb_f_lambda()
*/
static VALUE
-proc_lambda()
+proc_lambda(void)
{
return proc_alloc(rb_cProc, Qtrue);
}
static int
-block_orphan(data)
- struct BLOCK *data;
+block_orphan(struct BLOCK *data)
{
if (data->scope->flags & SCOPE_NOSTACK) {
return 1;
@@ -8521,9 +8116,7 @@ block_orphan(data)
}
static VALUE
-proc_invoke(proc, args, self, klass)
- VALUE proc, args; /* OK */
- VALUE self, klass;
+proc_invoke(VALUE proc, VALUE args /* OK */, VALUE self, VALUE klass)
{
struct BLOCK * volatile old_block;
struct BLOCK _block;
@@ -8642,15 +8235,13 @@ proc_invoke(proc, args, self, klass)
*/
VALUE
-rb_proc_call(proc, args)
- VALUE proc, args; /* OK */
+rb_proc_call(VALUE proc, VALUE args /* OK */)
{
return proc_invoke(proc, args, Qundef, 0);
}
int
-rb_proc_arity(proc)
- VALUE proc;
+rb_proc_arity(VALUE proc)
{
struct BLOCK *data;
NODE *var, *list;
@@ -8708,8 +8299,7 @@ rb_proc_arity(proc)
*/
static VALUE
-proc_arity(proc)
- VALUE proc;
+proc_arity(VALUE proc)
{
int arity = rb_proc_arity(proc);
return INT2FIX(arity);
@@ -8724,8 +8314,7 @@ proc_arity(proc)
*/
static VALUE
-proc_eq(self, other)
- VALUE self, other;
+proc_eq(VALUE self, VALUE other)
{
struct BLOCK *data, *data2;
@@ -8752,8 +8341,7 @@ proc_eq(self, other)
*/
static VALUE
-proc_hash(self)
- VALUE self;
+proc_hash(VALUE self)
{
struct BLOCK *data;
long hash;
@@ -8776,8 +8364,7 @@ proc_hash(self)
*/
static VALUE
-proc_to_s(self)
- VALUE self;
+proc_to_s(VALUE self)
{
struct BLOCK *data;
NODE *node;
@@ -8807,8 +8394,7 @@ proc_to_s(self)
*/
static VALUE
-proc_to_self(self)
- VALUE self;
+proc_to_self(VALUE self)
{
return self;
}
@@ -8831,8 +8417,7 @@ proc_to_self(self)
*/
static VALUE
-proc_binding(proc)
- VALUE proc;
+proc_binding(VALUE proc)
{
struct BLOCK *orig, *data;
VALUE bind;
@@ -8853,10 +8438,7 @@ proc_binding(proc)
}
static VALUE
-rb_block_pass(func, arg, proc)
- VALUE (*func) _((VALUE));
- VALUE arg;
- VALUE proc;
+rb_block_pass(VALUE (*func) (VALUE), VALUE arg, VALUE proc)
{
VALUE b;
struct BLOCK _block;
@@ -8947,16 +8529,13 @@ struct block_arg {
};
static VALUE
-call_block(arg)
- struct block_arg *arg;
+call_block(struct block_arg *arg)
{
return rb_eval(arg->self, arg->iter);
}
static VALUE
-block_pass(self, node)
- VALUE self;
- NODE *node;
+block_pass(VALUE self, NODE *node)
{
struct block_arg arg;
arg.self = self;
@@ -8974,8 +8553,7 @@ struct METHOD {
};
static void
-bm_mark(data)
- struct METHOD *data;
+bm_mark(struct METHOD *data)
{
rb_gc_mark(data->rklass);
rb_gc_mark(data->klass);
@@ -8984,9 +8562,7 @@ bm_mark(data)
}
static VALUE
-mnew(klass, obj, id, mklass)
- VALUE klass, obj, mklass;
- ID id;
+mnew(VALUE klass, VALUE obj, ID id, VALUE mklass)
{
VALUE method;
NODE *body;
@@ -9058,8 +8634,7 @@ mnew(klass, obj, id, mklass)
static VALUE
-method_eq(method, other)
- VALUE method, other;
+method_eq(VALUE method, VALUE other)
{
struct METHOD *m1, *m2;
@@ -9086,8 +8661,7 @@ method_eq(method, other)
*/
static VALUE
-method_hash(method)
- VALUE method;
+method_hash(VALUE method)
{
struct METHOD *m;
long hash;
@@ -9111,8 +8685,7 @@ method_hash(method)
*/
static VALUE
-method_unbind(obj)
- VALUE obj;
+method_unbind(VALUE obj)
{
VALUE method;
struct METHOD *orig, *data;
@@ -9159,9 +8732,7 @@ method_unbind(obj)
*/
VALUE
-rb_obj_method(obj, vid)
- VALUE obj;
- VALUE vid;
+rb_obj_method(VALUE obj, VALUE vid)
{
return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod);
}
@@ -9199,9 +8770,7 @@ rb_obj_method(obj, vid)
*/
static VALUE
-rb_mod_method(mod, vid)
- VALUE mod;
- VALUE vid;
+rb_mod_method(VALUE mod, VALUE vid)
{
return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod);
}
@@ -9211,8 +8780,7 @@ rb_mod_method(mod, vid)
*/
static VALUE
-method_clone(self)
- VALUE self;
+method_clone(VALUE self)
{
VALUE clone;
struct METHOD *orig, *data;
@@ -9239,10 +8807,7 @@ method_clone(self)
*/
VALUE
-rb_method_call(argc, argv, method)
- int argc;
- VALUE *argv;
- VALUE method;
+rb_method_call(int argc, VALUE *argv, VALUE method)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;
@@ -9356,8 +8921,7 @@ rb_method_call(argc, argv, method)
*/
static VALUE
-umethod_bind(method, recv)
- VALUE method, recv;
+umethod_bind(VALUE method, VALUE recv)
{
struct METHOD *data, *bound;
@@ -9381,8 +8945,7 @@ umethod_bind(method, recv)
}
int
-rb_node_arity(body)
- NODE *body;
+rb_node_arity(NODE *body)
{
int n;
@@ -9446,16 +9009,14 @@ rb_node_arity(body)
*/
static VALUE
-method_arity_m(method)
- VALUE method;
+method_arity_m(VALUE method)
{
int n = method_arity(method);
return INT2FIX(n);
}
static int
-method_arity(method)
- VALUE method;
+method_arity(VALUE method)
{
struct METHOD *data;
@@ -9464,18 +9025,14 @@ method_arity(method)
}
int
-rb_mod_method_arity(mod, id)
- VALUE mod;
- ID id;
+rb_mod_method_arity(VALUE mod, ID id)
{
NODE *node = rb_method_node(mod, id);
return rb_node_arity(node);
}
int
-rb_obj_method_arity(obj, id)
- VALUE obj;
- ID id;
+rb_obj_method_arity(VALUE obj, ID id)
{
return rb_mod_method_arity(CLASS_OF(obj), id);
}
@@ -9491,8 +9048,7 @@ rb_obj_method_arity(obj, id)
*/
static VALUE
-method_inspect(method)
- VALUE method;
+method_inspect(VALUE method)
{
struct METHOD *data;
VALUE str;
@@ -9539,8 +9095,7 @@ method_inspect(method)
}
static VALUE
-mproc(method)
- VALUE method;
+mproc(VALUE method)
{
VALUE proc;
@@ -9555,8 +9110,7 @@ mproc(method)
}
static VALUE
-bmcall(args, method)
- VALUE args, method;
+bmcall(VALUE args, VALUE method)
{
volatile VALUE a;
@@ -9565,9 +9119,9 @@ bmcall(args, method)
}
VALUE
-rb_proc_new(func, val)
- VALUE (*func)(ANYARGS); /* VALUE yieldarg[, VALUE procarg] */
- VALUE val;
+rb_proc_new(
+ VALUE (*func)(ANYARGS), /* VALUE yieldarg[, VALUE procarg] */
+ VALUE val)
{
struct BLOCK *data;
VALUE proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
@@ -9585,8 +9139,7 @@ rb_proc_new(func, val)
*/
static VALUE
-method_proc(method)
- VALUE method;
+method_proc(VALUE method)
{
VALUE proc;
struct METHOD *mdata;
@@ -9607,8 +9160,7 @@ method_proc(method)
}
static VALUE
-rb_obj_is_method(m)
- VALUE m;
+rb_obj_is_method(VALUE m)
{
if (TYPE(m) == T_DATA && RDATA(m)->dmark == (RUBY_DATA_FUNC)bm_mark) {
return Qtrue;
@@ -9654,10 +9206,7 @@ rb_obj_is_method(m)
*/
static VALUE
-rb_mod_define_method(argc, argv, mod)
- int argc;
- VALUE *argv;
- VALUE mod;
+rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
{
ID id;
VALUE body;
@@ -9741,7 +9290,7 @@ rb_mod_define_method(argc, argv, mod)
*/
void
-Init_Proc()
+Init_Proc(void)
{
rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError);
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
@@ -9840,7 +9389,7 @@ Init_Proc()
*/
void
-Init_Binding()
+Init_Binding(void)
{
rb_cBinding = rb_define_class("Binding", rb_cObject);
rb_undef_alloc_func(rb_cBinding);
@@ -9875,7 +9424,7 @@ typedef unsigned long DWORD;
#endif
static inline DWORD
-win32_get_exception_list()
+win32_get_exception_list(void)
{
DWORD p;
# if defined _MSC_VER
@@ -9902,8 +9451,7 @@ win32_get_exception_list()
}
static inline void
-win32_set_exception_list(p)
- DWORD p;
+win32_set_exception_list(DWORD p)
{
# if defined _MSC_VER
# ifdef _M_IX86
@@ -10187,7 +9735,7 @@ struct thread_status_t {
0)
static int
-thread_set_raised()
+thread_set_raised(void)
{
if (curr_thread->flags & THREAD_RAISED) return 1;
curr_thread->flags |= THREAD_RAISED;
@@ -10195,7 +9743,7 @@ thread_set_raised()
}
static int
-thread_reset_raised()
+thread_reset_raised(void)
{
if (!(curr_thread->flags & THREAD_RAISED)) return 0;
curr_thread->flags &= ~THREAD_RAISED;
@@ -10204,19 +9752,15 @@ thread_reset_raised()
static void rb_thread_ready _((rb_thread_t));
-static VALUE run_trap_eval _((VALUE));
static VALUE
-run_trap_eval(arg)
- VALUE arg;
+run_trap_eval(VALUE arg)
{
VALUE *p = (VALUE *)arg;
return rb_eval_cmd(p[0], p[1], (int)p[2]);
}
static VALUE
-rb_trap_eval(cmd, sig, safe)
- VALUE cmd;
- int sig, safe;
+rb_trap_eval(VALUE cmd, int sig, int safe)
{
int state;
VALUE val = Qnil; /* OK */
@@ -10247,8 +9791,7 @@ rb_trap_eval(cmd, sig, safe)
}
static const char *
-thread_status_name(status)
- enum thread_status status;
+thread_status_name(enum thread_status status)
{
switch (status) {
case THREAD_RUNNABLE:
@@ -10266,8 +9809,7 @@ thread_status_name(status)
/* $SAFE accessor */
void
-rb_set_safe_level(level)
- int level;
+rb_set_safe_level(int level)
{
if (level > ruby_safe_level) {
if (level > SAFE_LEVEL_MAX) level = SAFE_LEVEL_MAX;
@@ -10277,14 +9819,13 @@ rb_set_safe_level(level)
}
static VALUE
-safe_getter()
+safe_getter(void)
{
return INT2NUM(ruby_safe_level);
}
static void
-safe_setter(val)
- VALUE val;
+safe_setter(VALUE val)
{
int level = NUM2INT(val);
@@ -10299,7 +9840,7 @@ safe_setter(val)
/* Return the current time as a floating-point number */
static double
-timeofday()
+timeofday(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -10310,8 +9851,7 @@ timeofday()
#define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr))
static void
-thread_mark(th)
- rb_thread_t th;
+thread_mark(rb_thread_t th)
{
struct FRAME *frame;
struct BLOCK *block;
@@ -10376,7 +9916,7 @@ static struct {
} new_thread;
void
-rb_gc_mark_threads()
+rb_gc_mark_threads(void)
{
rb_thread_t th;
@@ -10395,8 +9935,7 @@ rb_gc_mark_threads()
}
static void
-thread_free(th)
- rb_thread_t th;
+thread_free(rb_thread_t th)
{
if (th->stk_ptr) free(th->stk_ptr);
th->stk_ptr = 0;
@@ -10416,8 +9955,7 @@ thread_free(th)
}
static rb_thread_t
-rb_thread_check(data)
- VALUE data;
+rb_thread_check(VALUE data)
{
if (TYPE(data) != T_DATA || RDATA(data)->dmark != (RUBY_DATA_FUNC)thread_mark) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
@@ -10445,8 +9983,7 @@ static char *th_signm;
extern VALUE *rb_gc_stack_start;
static void
-rb_thread_save_context(th)
- rb_thread_t th;
+rb_thread_save_context(rb_thread_t th)
{
VALUE *pos;
int len;
@@ -10516,8 +10053,7 @@ rb_thread_save_context(th)
}
static int
-rb_thread_switch(n)
- int n;
+rb_thread_switch(int n)
{
rb_trap_immediate = (curr_thread->flags&(1<<8))?1:0;
switch (n) {
@@ -10564,9 +10100,7 @@ NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
NOINLINE(static void stack_extend _((rb_thread_t, int)));
static void
-stack_extend(th, exit)
- rb_thread_t th;
- int exit;
+stack_extend(rb_thread_t th, int exit)
{
VALUE space[1024];
@@ -10575,9 +10109,7 @@ stack_extend(th, exit)
}
static void
-rb_thread_restore_context(th, exit)
- rb_thread_t th;
- int exit;
+rb_thread_restore_context(rb_thread_t th, int exit)
{
VALUE v;
static rb_thread_t tmp;
@@ -10653,8 +10185,7 @@ rb_thread_restore_context(th, exit)
}
static void
-rb_thread_ready(th)
- rb_thread_t th;
+rb_thread_ready(rb_thread_t th)
{
th->wait_for = 0;
if (th->status != THREAD_TO_KILL) {
@@ -10663,8 +10194,7 @@ rb_thread_ready(th)
}
static void
-rb_thread_die(th)
- rb_thread_t th;
+rb_thread_die(rb_thread_t th)
{
th->thgroup = 0;
th->status = THREAD_KILLED;
@@ -10673,8 +10203,7 @@ rb_thread_die(th)
}
static void
-rb_thread_remove(th)
- rb_thread_t th;
+rb_thread_remove(rb_thread_t th)
{
if (th->status == THREAD_KILLED) return;
@@ -10685,15 +10214,13 @@ rb_thread_remove(th)
}
static int
-rb_thread_dead(th)
- rb_thread_t th;
+rb_thread_dead(rb_thread_t th)
{
return th->status == THREAD_KILLED;
}
void
-rb_thread_fd_close(fd)
- int fd;
+rb_thread_fd_close(int fd)
{
rb_thread_t th;
@@ -10712,9 +10239,7 @@ rb_thread_fd_close(fd)
NORETURN(static void rb_thread_main_jump _((VALUE, int)));
static void
-rb_thread_main_jump(err, tag)
- VALUE err;
- int tag;
+rb_thread_main_jump(VALUE err, int tag)
{
curr_thread = main_thread;
th_raise_exception = err;
@@ -10724,7 +10249,7 @@ rb_thread_main_jump(err, tag)
NORETURN(static void rb_thread_deadlock _((void)));
static void
-rb_thread_deadlock()
+rb_thread_deadlock(void)
{
char msg[21+SIZEOF_LONG*2];
VALUE e;
@@ -10738,9 +10263,7 @@ rb_thread_deadlock()
}
static void
-copy_fds(dst, src, max)
- rb_fdset_t *dst, *src;
- int max;
+copy_fds(rb_fdset_t *dst, rb_fdset_t *src, int max)
{
int n = 0;
int i;
@@ -10755,9 +10278,7 @@ copy_fds(dst, src, max)
}
static int
-match_fds(dst, src, max)
- rb_fdset_t *dst, *src;
- int max;
+match_fds(rb_fdset_t *dst, rb_fdset_t *src, int max)
{
int i;
@@ -10772,9 +10293,7 @@ match_fds(dst, src, max)
}
static int
-intersect_fds(src, dst, max)
- rb_fdset_t *src, *dst;
- int max;
+intersect_fds(rb_fdset_t *src, rb_fdset_t *dst, int max)
{
int i, n = 0;
@@ -10795,9 +10314,7 @@ intersect_fds(src, dst, max)
}
static int
-find_bad_fds(dst, src, max)
- rb_fdset_t *dst, *src;
- int max;
+find_bad_fds(rb_fdset_t *dst, rb_fdset_t *src, int max)
{
int i, test = Qfalse;
@@ -10812,7 +10329,7 @@ find_bad_fds(dst, src, max)
}
void
-rb_thread_schedule()
+rb_thread_schedule(void)
{
rb_thread_t next; /* OK */
rb_thread_t th;
@@ -11077,8 +10594,7 @@ rb_thread_schedule()
}
void
-rb_thread_wait_fd(fd)
- int fd;
+rb_thread_wait_fd(int fd)
{
if (rb_thread_critical) return;
if (curr_thread == curr_thread->next) return;
@@ -11091,8 +10607,7 @@ rb_thread_wait_fd(fd)
}
int
-rb_thread_fd_writable(fd)
- int fd;
+rb_thread_fd_writable(int fd)
{
if (rb_thread_critical) return Qtrue;
if (curr_thread == curr_thread->next) return Qtrue;
@@ -11110,8 +10625,7 @@ rb_thread_fd_writable(fd)
}
void
-rb_thread_wait_for(time)
- struct timeval time;
+rb_thread_wait_for(struct timeval time)
{
double date;
@@ -11166,16 +10680,13 @@ rb_thread_wait_for(time)
void rb_thread_sleep_forever _((void));
int
-rb_thread_alone()
+rb_thread_alone(void)
{
return curr_thread == curr_thread->next;
}
int
-rb_thread_select(max, read, write, except, timeout)
- int max;
- fd_set *read, *write, *except;
- struct timeval *timeout;
+rb_thread_select(int max, fd_set *read, fd_set *write, fd_set *except, struct timeval *timeout)
{
#ifndef linux
double limit;
@@ -11261,12 +10772,8 @@ rb_thread_select(max, read, write, except, timeout)
return curr_thread->select_value;
}
-static int rb_thread_join _((rb_thread_t, double));
-
static int
-rb_thread_join(th, limit)
- rb_thread_t th;
- double limit;
+rb_thread_join(rb_thread_t th, double limit)
{
enum thread_status last_status = THREAD_RUNNABLE;
@@ -11348,10 +10855,7 @@ rb_thread_join(th, limit)
*/
static VALUE
-rb_thread_join_m(argc, argv, thread)
- int argc;
- VALUE *argv;
- VALUE thread;
+rb_thread_join_m(int argc, VALUE *argv, VALUE thread)
{
VALUE limit;
double delay = DELAY_INFTY;
@@ -11375,7 +10879,7 @@ rb_thread_join_m(argc, argv, thread)
*/
VALUE
-rb_thread_current()
+rb_thread_current(void)
{
return curr_thread->thread;
}
@@ -11391,7 +10895,7 @@ rb_thread_current()
*/
VALUE
-rb_thread_main()
+rb_thread_main(void)
{
return main_thread->thread;
}
@@ -11418,7 +10922,7 @@ rb_thread_main()
*/
VALUE
-rb_thread_list()
+rb_thread_list(void)
{
rb_thread_t th;
VALUE ary = rb_ary_new();
@@ -11455,8 +10959,7 @@ rb_thread_list()
*/
VALUE
-rb_thread_wakeup(thread)
- VALUE thread;
+rb_thread_wakeup(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -11489,8 +10992,7 @@ rb_thread_wakeup(thread)
*/
VALUE
-rb_thread_run(thread)
- VALUE thread;
+rb_thread_run(VALUE thread)
{
rb_thread_wakeup(thread);
if (!rb_thread_critical) rb_thread_schedule();
@@ -11512,8 +11014,7 @@ rb_thread_run(thread)
*/
VALUE
-rb_thread_kill(thread)
- VALUE thread;
+rb_thread_kill(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -11546,8 +11047,7 @@ rb_thread_kill(thread)
*/
static VALUE
-rb_thread_s_kill(obj, th)
- VALUE obj, th;
+rb_thread_s_kill(VALUE obj, VALUE th)
{
return rb_thread_kill(th);
}
@@ -11564,7 +11064,7 @@ rb_thread_s_kill(obj, th)
*/
static VALUE
-rb_thread_exit()
+rb_thread_exit(void)
{
return rb_thread_kill(curr_thread->thread);
}
@@ -11591,7 +11091,7 @@ rb_thread_exit()
*/
static VALUE
-rb_thread_pass()
+rb_thread_pass(void)
{
rb_thread_schedule();
return Qnil;
@@ -11618,7 +11118,7 @@ rb_thread_pass()
*/
VALUE
-rb_thread_stop()
+rb_thread_stop(void)
{
enum thread_status last_status = THREAD_RUNNABLE;
@@ -11635,10 +11135,10 @@ rb_thread_stop()
return Qnil;
}
-struct timeval rb_time_timeval();
+struct timeval rb_time_timeval(VALUE time);
void
-rb_thread_polling()
+rb_thread_polling(void)
{
if (curr_thread != curr_thread->next) {
curr_thread->status = THREAD_STOPPED;
@@ -11649,8 +11149,7 @@ rb_thread_polling()
}
void
-rb_thread_sleep(sec)
- int sec;
+rb_thread_sleep(int sec)
{
if (curr_thread == curr_thread->next) {
TRAP_BEG;
@@ -11662,7 +11161,7 @@ rb_thread_sleep(sec)
}
void
-rb_thread_sleep_forever()
+rb_thread_sleep_forever(void)
{
int thr_critical = rb_thread_critical;
if (curr_thread == curr_thread->next ||
@@ -11693,8 +11192,7 @@ rb_thread_sleep_forever()
*/
static VALUE
-rb_thread_priority(thread)
- VALUE thread;
+rb_thread_priority(VALUE thread)
{
return INT2NUM(rb_thread_check(thread)->priority);
}
@@ -11724,8 +11222,7 @@ rb_thread_priority(thread)
*/
static VALUE
-rb_thread_priority_set(thread, prio)
- VALUE thread, prio;
+rb_thread_priority_set(VALUE thread, VALUE prio)
{
rb_thread_t th;
@@ -11751,8 +11248,7 @@ rb_thread_priority_set(thread, prio)
*/
static VALUE
-rb_thread_safe_level(thread)
- VALUE thread;
+rb_thread_safe_level(VALUE thread)
{
rb_thread_t th;
@@ -11780,7 +11276,7 @@ static VALUE thgroup_default;
*/
static VALUE
-rb_thread_s_abort_exc()
+rb_thread_s_abort_exc(void)
{
return ruby_thread_abort?Qtrue:Qfalse;
}
@@ -11811,8 +11307,7 @@ rb_thread_s_abort_exc()
*/
static VALUE
-rb_thread_s_abort_exc_set(self, val)
- VALUE self, val;
+rb_thread_s_abort_exc_set(VALUE self, VALUE val)
{
rb_secure(4);
ruby_thread_abort = RTEST(val);
@@ -11830,8 +11325,7 @@ rb_thread_s_abort_exc_set(self, val)
*/
static VALUE
-rb_thread_abort_exc(thread)
- VALUE thread;
+rb_thread_abort_exc(VALUE thread)
{
return rb_thread_check(thread)->abort?Qtrue:Qfalse;
}
@@ -11847,8 +11341,7 @@ rb_thread_abort_exc(thread)
*/
static VALUE
-rb_thread_abort_exc_set(thread, val)
- VALUE thread, val;
+rb_thread_abort_exc_set(VALUE thread, VALUE val)
{
rb_secure(4);
rb_thread_check(thread)->abort = RTEST(val);
@@ -11867,8 +11360,7 @@ rb_thread_abort_exc_set(thread, val)
*/
VALUE
-rb_thread_group(thread)
- VALUE thread;
+rb_thread_group(VALUE thread)
{
VALUE group = rb_thread_check(thread)->thgroup;
if (!group) {
@@ -11928,8 +11420,7 @@ rb_thread_group(thread)
} while (0)
static rb_thread_t
-rb_thread_alloc(klass)
- VALUE klass;
+rb_thread_alloc(VALUE klass)
{
rb_thread_t th;
struct RVarmap *vars;
@@ -12039,8 +11530,7 @@ NORETURN(static void rb_thread_terminated _((rb_thread_t, int, enum thread_statu
static VALUE rb_thread_yield _((VALUE, rb_thread_t));
static void
-push_thread_anchor(ip)
- struct ruby_env *ip;
+push_thread_anchor(struct ruby_env *ip)
{
ip->tag = prot_tag;
ip->frame = ruby_frame;
@@ -12053,15 +11543,13 @@ push_thread_anchor(ip)
}
static void
-pop_thread_anchor(ip)
- struct ruby_env *ip;
+pop_thread_anchor(struct ruby_env *ip)
{
curr_thread->anchor = ip->prev;
}
static void
-thread_insert(th)
- rb_thread_t th;
+thread_insert(rb_thread_t th)
{
if (!th->next) {
/* merge in thread list */
@@ -12075,10 +11563,7 @@ thread_insert(th)
}
static VALUE
-rb_thread_start_0(fn, arg, th)
- VALUE (*fn)();
- void *arg;
- rb_thread_t th;
+rb_thread_start_0(VALUE (*fn) (/* ??? */), VALUE arg, rb_thread_t th)
{
volatile rb_thread_t th_save = th;
volatile VALUE thread = th->thread;
@@ -12161,10 +11646,7 @@ rb_thread_start_0(fn, arg, th)
}
static void
-rb_thread_terminated(th, state, status)
- rb_thread_t th;
- int state;
- enum thread_status status;
+rb_thread_terminated(rb_thread_t th, int state, enum thread_status status)
{
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
th->flags |= THREAD_RAISED;
@@ -12199,14 +11681,13 @@ rb_thread_terminated(th, state, status)
}
static VALUE
-rb_thread_yield_0(arg)
- VALUE arg;
+rb_thread_yield_0(VALUE arg)
{
return rb_thread_yield(arg, curr_thread);
}
static void
-rb_thread_start_1()
+rb_thread_start_1(void)
{
rb_thread_t th = new_thread.thread;
volatile rb_thread_t th_save = th;
@@ -12248,18 +11729,14 @@ rb_thread_start_1()
}
VALUE
-rb_thread_create(fn, arg)
- VALUE (*fn)();
- void *arg;
+rb_thread_create(VALUE (*fn) (/* ??? */), void *arg)
{
Init_stack((VALUE*)&arg);
- return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
+ return rb_thread_start_0(fn, (VALUE)arg, rb_thread_alloc(rb_cThread));
}
static VALUE
-rb_thread_yield(arg, th)
- VALUE arg;
- rb_thread_t th;
+rb_thread_yield(VALUE arg, rb_thread_t th)
{
const ID *tbl;
@@ -12300,10 +11777,7 @@ rb_thread_yield(arg, th)
*/
static VALUE
-rb_thread_s_new(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_thread_s_new(int argc, VALUE *argv, VALUE klass)
{
rb_thread_t th = rb_thread_alloc(klass);
volatile VALUE *pos;
@@ -12338,8 +11812,7 @@ rb_thread_s_new(argc, argv, klass)
*/
static VALUE
-rb_thread_initialize(thread, args)
- VALUE thread, args;
+rb_thread_initialize(VALUE thread, VALUE args)
{
rb_thread_t th;
@@ -12370,8 +11843,7 @@ rb_thread_initialize(thread, args)
*/
static VALUE
-rb_thread_start(klass, args)
- VALUE klass, args;
+rb_thread_start(VALUE klass, VALUE args)
{
if (!rb_block_given_p()) {
rb_raise(rb_eThreadError, "must be called with a block");
@@ -12392,8 +11864,7 @@ rb_thread_start(klass, args)
*/
static VALUE
-rb_thread_value(thread)
- VALUE thread;
+rb_thread_value(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12427,8 +11898,7 @@ rb_thread_value(thread)
*/
static VALUE
-rb_thread_status(thread)
- VALUE thread;
+rb_thread_status(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12455,8 +11925,7 @@ rb_thread_status(thread)
*/
static VALUE
-rb_thread_alive_p(thread)
- VALUE thread;
+rb_thread_alive_p(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12478,8 +11947,7 @@ rb_thread_alive_p(thread)
*/
static VALUE
-rb_thread_stop_p(thread)
- VALUE thread;
+rb_thread_stop_p(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12489,7 +11957,7 @@ rb_thread_stop_p(thread)
}
static void
-rb_thread_wait_other_threads()
+rb_thread_wait_other_threads(void)
{
rb_thread_t th;
int found;
@@ -12510,7 +11978,7 @@ rb_thread_wait_other_threads()
}
static void
-rb_thread_cleanup()
+rb_thread_cleanup(void)
{
rb_thread_t curr, th;
@@ -12544,7 +12012,7 @@ int rb_thread_critical;
*/
static VALUE
-rb_thread_critical_get()
+rb_thread_critical_get(void)
{
return rb_thread_critical?Qtrue:Qfalse;
}
@@ -12565,15 +12033,14 @@ rb_thread_critical_get()
*/
static VALUE
-rb_thread_critical_set(obj, val)
- VALUE obj, val;
+rb_thread_critical_set(VALUE obj, VALUE val)
{
rb_thread_critical = RTEST(val);
return val;
}
void
-rb_thread_interrupt()
+rb_thread_interrupt(void)
{
rb_thread_critical = 0;
rb_thread_ready(main_thread);
@@ -12590,8 +12057,7 @@ rb_thread_interrupt()
}
void
-rb_thread_signal_raise(sig)
- char *sig;
+rb_thread_signal_raise(char *sig)
{
if (sig == 0) return; /* should not happen */
rb_thread_critical = 0;
@@ -12611,9 +12077,7 @@ rb_thread_signal_raise(sig)
}
void
-rb_thread_trap_eval(cmd, sig, safe)
- VALUE cmd;
- int sig, safe;
+rb_thread_trap_eval(VALUE cmd, int sig, int safe)
{
rb_thread_critical = 0;
if (curr_thread == main_thread) {
@@ -12633,7 +12097,7 @@ rb_thread_trap_eval(cmd, sig, safe)
}
void
-rb_thread_signal_exit()
+rb_thread_signal_exit(void)
{
VALUE args[2];
@@ -12655,10 +12119,7 @@ rb_thread_signal_exit()
}
static VALUE
-rb_thread_raise(argc, argv, th)
- int argc;
- VALUE *argv;
- rb_thread_t th;
+rb_thread_raise(int argc, VALUE *argv, rb_thread_t th)
{
volatile rb_thread_t th_save = th;
VALUE exc;
@@ -12708,10 +12169,7 @@ rb_thread_raise(argc, argv, th)
*/
static VALUE
-rb_thread_raise_m(argc, argv, thread)
- int argc;
- VALUE *argv;
- VALUE thread;
+rb_thread_raise_m(int argc, VALUE *argv, VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12723,9 +12181,7 @@ rb_thread_raise_m(argc, argv, thread)
}
VALUE
-rb_thread_local_aref(thread, id)
- VALUE thread;
- ID id;
+rb_thread_local_aref(VALUE thread, ID id)
{
rb_thread_t th;
VALUE val;
@@ -12764,17 +12220,13 @@ rb_thread_local_aref(thread, id)
*/
static VALUE
-rb_thread_aref(thread, id)
- VALUE thread, id;
+rb_thread_aref(VALUE thread, VALUE id)
{
return rb_thread_local_aref(thread, rb_to_id(id));
}
VALUE
-rb_thread_local_aset(thread, id, val)
- VALUE thread;
- ID id;
- VALUE val;
+rb_thread_local_aset(VALUE thread, ID id, VALUE val)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12805,8 +12257,7 @@ rb_thread_local_aset(thread, id, val)
*/
static VALUE
-rb_thread_aset(thread, id, val)
- VALUE thread, id, val;
+rb_thread_aset(VALUE thread, VALUE id, VALUE val)
{
return rb_thread_local_aset(thread, rb_to_id(id), val);
}
@@ -12826,8 +12277,7 @@ rb_thread_aset(thread, id, val)
*/
static VALUE
-rb_thread_key_p(thread, id)
- VALUE thread, id;
+rb_thread_key_p(VALUE thread, VALUE id)
{
rb_thread_t th = rb_thread_check(thread);
@@ -12838,9 +12288,7 @@ rb_thread_key_p(thread, id)
}
static int
-thread_keys_i(key, value, ary)
- ID key;
- VALUE value, ary;
+thread_keys_i(ID key, VALUE value, VALUE ary)
{
rb_ary_push(ary, ID2SYM(key));
return ST_CONTINUE;
@@ -12862,8 +12310,7 @@ thread_keys_i(key, value, ary)
*/
static VALUE
-rb_thread_keys(thread)
- VALUE thread;
+rb_thread_keys(VALUE thread)
{
rb_thread_t th = rb_thread_check(thread);
VALUE ary = rb_ary_new();
@@ -12882,8 +12329,7 @@ rb_thread_keys(thread)
*/
static VALUE
-rb_thread_inspect(thread)
- VALUE thread;
+rb_thread_inspect(VALUE thread)
{
char *cname = rb_obj_classname(thread);
rb_thread_t th = rb_thread_check(thread);
@@ -12897,7 +12343,7 @@ rb_thread_inspect(thread)
}
void
-rb_thread_atfork()
+rb_thread_atfork(void)
{
rb_thread_t th;
@@ -12978,8 +12424,7 @@ static VALUE rb_cCont;
*/
static VALUE
-rb_callcc(self)
- VALUE self;
+rb_callcc(VALUE self)
{
volatile VALUE cont;
rb_thread_t th;
@@ -13027,10 +12472,7 @@ rb_callcc(self)
*/
static VALUE
-rb_cont_call(argc, argv, cont)
- int argc;
- VALUE *argv;
- VALUE cont;
+rb_cont_call(int argc, VALUE *argv, VALUE cont)
{
rb_thread_t th = rb_thread_check(cont);
@@ -13074,10 +12516,8 @@ struct thgroup {
* were created.
*/
-static VALUE thgroup_s_alloc _((VALUE));
static VALUE
-thgroup_s_alloc(klass)
- VALUE klass;
+thgroup_s_alloc(VALUE klass)
{
VALUE group;
struct thgroup *data;
@@ -13101,8 +12541,7 @@ thgroup_s_alloc(klass)
*/
static VALUE
-thgroup_list(group)
- VALUE group;
+thgroup_list(VALUE group)
{
struct thgroup *data;
rb_thread_t th;
@@ -13141,8 +12580,7 @@ thgroup_list(group)
*/
VALUE
-thgroup_enclose(group)
- VALUE group;
+thgroup_enclose(VALUE group)
{
struct thgroup *data;
@@ -13162,8 +12600,7 @@ thgroup_enclose(group)
*/
static VALUE
-thgroup_enclosed_p(group)
- VALUE group;
+thgroup_enclosed_p(VALUE group)
{
struct thgroup *data;
@@ -13200,8 +12637,7 @@ thgroup_enclosed_p(group)
*/
static VALUE
-thgroup_add(group, thread)
- VALUE group, thread;
+thgroup_add(VALUE group, VALUE thread)
{
rb_thread_t th;
struct thgroup *data;
@@ -13250,7 +12686,7 @@ static ID recursive_key;
*/
void
-Init_Thread()
+Init_Thread(void)
{
VALUE cThGroup;
@@ -13360,8 +12796,7 @@ Init_Thread()
*/
static VALUE
-rb_f_catch(dmy, tag)
- VALUE dmy, tag;
+rb_f_catch(VALUE dmy, VALUE tag)
{
int state;
VALUE val = Qnil; /* OK */
@@ -13382,17 +12817,13 @@ rb_f_catch(dmy, tag)
}
static VALUE
-catch_i(tag)
- VALUE tag;
+catch_i(VALUE tag)
{
return rb_funcall(Qnil, rb_intern("catch"), 1, tag);
}
VALUE
-rb_catch(tag, func, data)
- const char *tag;
- VALUE (*func)();
- VALUE data;
+rb_catch(const char *tag, VALUE (*func) (/* ??? */), VALUE data)
{
return rb_iterate((VALUE(*)_((VALUE)))catch_i, ID2SYM(rb_intern(tag)), func, data);
}
@@ -13410,9 +12841,7 @@ rb_catch(tag, func, data)
*/
static VALUE
-rb_f_throw(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_throw(int argc, VALUE *argv)
{
VALUE tag, value;
struct tag *tt = prot_tag;
@@ -13444,9 +12873,7 @@ rb_f_throw(argc, argv)
}
void
-rb_throw(tag, val)
- const char *tag;
- VALUE val;
+rb_throw(const char *tag, VALUE val)
{
VALUE argv[2];
@@ -13456,8 +12883,7 @@ rb_throw(tag, val)
}
static VALUE
-recursive_check(obj)
- VALUE obj;
+recursive_check(VALUE obj)
{
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
@@ -13473,8 +12899,7 @@ recursive_check(obj)
}
static void
-recursive_push(obj)
- VALUE obj;
+recursive_push(VALUE obj)
{
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
VALUE list, sym;
@@ -13496,7 +12921,7 @@ recursive_push(obj)
}
static void
-recursive_pop()
+recursive_pop(void)
{
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
VALUE list, sym;
@@ -13519,9 +12944,9 @@ recursive_pop()
}
VALUE
-rb_exec_recursive(func, obj, arg)
- VALUE (*func)(ANYARGS); /* VALUE obj, VALUE arg, int flag */
- VALUE obj, arg;
+rb_exec_recursive(VALUE (*func) (/* ??? */), VALUE obj, VALUE arg)
+ /* VALUE obj, VALUE arg, int flag */
+
{
if (recursive_check(obj)) {
return (*func)(obj, arg, Qtrue);
diff --git a/file.c b/file.c
index f5a21a2619..bfd71fdbca 100644
--- a/file.c
+++ b/file.c
@@ -73,8 +73,7 @@ VALUE rb_mFileTest;
static VALUE rb_cStat;
VALUE
-rb_get_path(obj)
- VALUE obj;
+rb_get_path(VALUE obj)
{
VALUE tmp;
static ID to_path;
@@ -98,10 +97,7 @@ rb_get_path(obj)
}
static long
-apply2files(func, vargs, arg)
- void (*func)();
- VALUE vargs;
- void *arg;
+apply2files(void (*func) (/* ??? */), VALUE vargs, void *arg)
{
long i;
VALUE path;
@@ -129,8 +125,7 @@ apply2files(func, vargs, arg)
*/
static VALUE
-rb_file_path(obj)
- VALUE obj;
+rb_file_path(VALUE obj)
{
OpenFile *fptr;
@@ -141,9 +136,7 @@ rb_file_path(obj)
}
static VALUE
-stat_new_0(klass, st)
- VALUE klass;
- struct stat *st;
+stat_new_0(VALUE klass, struct stat *st)
{
struct stat *nst = 0;
@@ -155,15 +148,13 @@ stat_new_0(klass, st)
}
static VALUE
-stat_new(st)
- struct stat *st;
+stat_new(struct stat *st)
{
return stat_new_0(rb_cStat, st);
}
static struct stat*
-get_stat(self)
- VALUE self;
+get_stat(VALUE self)
{
struct stat* st;
Data_Get_Struct(self, struct stat, st);
@@ -185,8 +176,7 @@ get_stat(self)
*/
static VALUE
-rb_stat_cmp(self, other)
- VALUE self, other;
+rb_stat_cmp(VALUE self, VALUE other)
{
if (rb_obj_is_kind_of(other, rb_obj_class(self))) {
time_t t1 = get_stat(self)->st_mtime;
@@ -212,8 +202,7 @@ rb_stat_cmp(self, other)
*/
static VALUE
-rb_stat_dev(self)
- VALUE self;
+rb_stat_dev(VALUE self)
{
return INT2NUM(get_stat(self)->st_dev);
}
@@ -230,8 +219,7 @@ rb_stat_dev(self)
*/
static VALUE
-rb_stat_dev_major(self)
- VALUE self;
+rb_stat_dev_major(VALUE self)
{
#if defined(major)
long dev = get_stat(self)->st_dev;
@@ -253,8 +241,7 @@ rb_stat_dev_major(self)
*/
static VALUE
-rb_stat_dev_minor(self)
- VALUE self;
+rb_stat_dev_minor(VALUE self)
{
#if defined(minor)
long dev = get_stat(self)->st_dev;
@@ -276,8 +263,7 @@ rb_stat_dev_minor(self)
*/
static VALUE
-rb_stat_ino(self)
- VALUE self;
+rb_stat_ino(VALUE self)
{
#ifdef HUGE_ST_INO
return ULL2NUM(get_stat(self)->st_ino);
@@ -300,8 +286,7 @@ rb_stat_ino(self)
*/
static VALUE
-rb_stat_mode(self)
- VALUE self;
+rb_stat_mode(VALUE self)
{
#ifdef __BORLANDC__
return UINT2NUM((unsigned short)(get_stat(self)->st_mode));
@@ -323,8 +308,7 @@ rb_stat_mode(self)
*/
static VALUE
-rb_stat_nlink(self)
- VALUE self;
+rb_stat_nlink(VALUE self)
{
return UINT2NUM(get_stat(self)->st_nlink);
}
@@ -341,8 +325,7 @@ rb_stat_nlink(self)
*/
static VALUE
-rb_stat_uid(self)
- VALUE self;
+rb_stat_uid(VALUE self)
{
return UINT2NUM(get_stat(self)->st_uid);
}
@@ -358,8 +341,7 @@ rb_stat_uid(self)
*/
static VALUE
-rb_stat_gid(self)
- VALUE self;
+rb_stat_gid(VALUE self)
{
return UINT2NUM(get_stat(self)->st_gid);
}
@@ -378,8 +360,7 @@ rb_stat_gid(self)
*/
static VALUE
-rb_stat_rdev(self)
- VALUE self;
+rb_stat_rdev(VALUE self)
{
#ifdef HAVE_ST_RDEV
return ULONG2NUM(get_stat(self)->st_rdev);
@@ -400,8 +381,7 @@ rb_stat_rdev(self)
*/
static VALUE
-rb_stat_rdev_major(self)
- VALUE self;
+rb_stat_rdev_major(VALUE self)
{
#if defined(HAVE_ST_RDEV) && defined(major)
long rdev = get_stat(self)->st_rdev;
@@ -423,8 +403,7 @@ rb_stat_rdev_major(self)
*/
static VALUE
-rb_stat_rdev_minor(self)
- VALUE self;
+rb_stat_rdev_minor(VALUE self)
{
#if defined(HAVE_ST_RDEV) && defined(minor)
long rdev = get_stat(self)->st_rdev;
@@ -444,8 +423,7 @@ rb_stat_rdev_minor(self)
*/
static VALUE
-rb_stat_size(self)
- VALUE self;
+rb_stat_size(VALUE self)
{
return OFFT2NUM(get_stat(self)->st_size);
}
@@ -462,8 +440,7 @@ rb_stat_size(self)
*/
static VALUE
-rb_stat_blksize(self)
- VALUE self;
+rb_stat_blksize(VALUE self)
{
#ifdef HAVE_ST_BLKSIZE
return ULONG2NUM(get_stat(self)->st_blksize);
@@ -484,8 +461,7 @@ rb_stat_blksize(self)
*/
static VALUE
-rb_stat_blocks(self)
- VALUE self;
+rb_stat_blocks(VALUE self)
{
#ifdef HAVE_ST_BLOCKS
return ULONG2NUM(get_stat(self)->st_blocks);
@@ -507,8 +483,7 @@ rb_stat_blocks(self)
*/
static VALUE
-rb_stat_atime(self)
- VALUE self;
+rb_stat_atime(VALUE self)
{
return rb_time_new(get_stat(self)->st_atime, 0);
}
@@ -524,8 +499,7 @@ rb_stat_atime(self)
*/
static VALUE
-rb_stat_mtime(self)
- VALUE self;
+rb_stat_mtime(VALUE self)
{
return rb_time_new(get_stat(self)->st_mtime, 0);
}
@@ -543,8 +517,7 @@ rb_stat_mtime(self)
*/
static VALUE
-rb_stat_ctime(self)
- VALUE self;
+rb_stat_ctime(VALUE self)
{
return rb_time_new(get_stat(self)->st_ctime, 0);
}
@@ -564,8 +537,7 @@ rb_stat_ctime(self)
*/
static VALUE
-rb_stat_inspect(self)
- VALUE self;
+rb_stat_inspect(VALUE self)
{
VALUE str;
int i;
@@ -624,9 +596,7 @@ rb_stat_inspect(self)
}
static int
-rb_stat(file, st)
- VALUE file;
- struct stat *st;
+rb_stat(VALUE file, struct stat *st)
{
VALUE tmp;
@@ -654,8 +624,7 @@ rb_stat(file, st)
*/
static VALUE
-rb_file_s_stat(klass, fname)
- VALUE klass, fname;
+rb_file_s_stat(VALUE klass, VALUE fname)
{
struct stat st;
@@ -683,8 +652,7 @@ rb_file_s_stat(klass, fname)
*/
static VALUE
-rb_io_stat(obj)
- VALUE obj;
+rb_io_stat(VALUE obj)
{
OpenFile *fptr;
struct stat st;
@@ -711,8 +679,7 @@ rb_io_stat(obj)
*/
static VALUE
-rb_file_s_lstat(klass, fname)
- VALUE klass, fname;
+rb_file_s_lstat(VALUE klass, VALUE fname)
{
#ifdef HAVE_LSTAT
struct stat st;
@@ -744,8 +711,7 @@ rb_file_s_lstat(klass, fname)
*/
static VALUE
-rb_file_lstat(obj)
- VALUE obj;
+rb_file_lstat(VALUE obj)
{
#ifdef HAVE_LSTAT
OpenFile *fptr;
@@ -764,8 +730,7 @@ rb_file_lstat(obj)
}
static int
-group_member(gid)
- GETGROUPS_T gid;
+group_member(GETGROUPS_T gid)
{
#ifndef _WIN32
if (getgid() == gid)
@@ -798,9 +763,7 @@ group_member(gid)
#endif
int
-eaccess(path, mode)
- const char *path;
- int mode;
+eaccess(const char *path, int mode)
{
#if defined(S_IXGRP) && !defined(_WIN32) && !defined(__CYGWIN__)
struct stat st;
@@ -862,8 +825,7 @@ eaccess(path, mode)
*/
static VALUE
-test_d(obj, fname)
- VALUE obj, fname;
+test_d(VALUE obj, VALUE fname)
{
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
@@ -884,8 +846,7 @@ test_d(obj, fname)
*/
static VALUE
-test_p(obj, fname)
- VALUE obj, fname;
+test_p(VALUE obj, VALUE fname)
{
#ifdef S_IFIFO
# ifndef S_ISFIFO
@@ -909,8 +870,7 @@ test_p(obj, fname)
*/
static VALUE
-test_l(obj, fname)
- VALUE obj, fname;
+test_l(VALUE obj, VALUE fname)
{
#ifndef S_ISLNK
# ifdef _S_ISLNK
@@ -946,8 +906,7 @@ test_l(obj, fname)
*/
static VALUE
-test_S(obj, fname)
- VALUE obj, fname;
+test_S(VALUE obj, VALUE fname)
{
#ifndef S_ISSOCK
# ifdef _S_ISSOCK
@@ -981,8 +940,7 @@ test_S(obj, fname)
*/
static VALUE
-test_b(obj, fname)
- VALUE obj, fname;
+test_b(VALUE obj, VALUE fname)
{
#ifndef S_ISBLK
# ifdef S_IFBLK
@@ -1009,8 +967,7 @@ test_b(obj, fname)
* Returns <code>true</code> if the named file is a character device.
*/
static VALUE
-test_c(obj, fname)
- VALUE obj, fname;
+test_c(VALUE obj, VALUE fname)
{
#ifndef S_ISCHR
# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
@@ -1034,8 +991,7 @@ test_c(obj, fname)
*/
static VALUE
-test_e(obj, fname)
- VALUE obj, fname;
+test_e(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1052,8 +1008,7 @@ test_e(obj, fname)
*/
static VALUE
-test_r(obj, fname)
- VALUE obj, fname;
+test_r(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1070,8 +1025,7 @@ test_r(obj, fname)
*/
static VALUE
-test_R(obj, fname)
- VALUE obj, fname;
+test_R(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1102,8 +1056,7 @@ test_R(obj, fname)
*/
static VALUE
-test_wr(obj, fname)
- VALUE obj, fname;
+test_wr(VALUE obj, VALUE fname)
{
#ifdef S_IROTH
struct stat st;
@@ -1125,8 +1078,7 @@ test_wr(obj, fname)
*/
static VALUE
-test_w(obj, fname)
- VALUE obj, fname;
+test_w(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1143,8 +1095,7 @@ test_w(obj, fname)
*/
static VALUE
-test_W(obj, fname)
- VALUE obj, fname;
+test_W(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1167,8 +1118,7 @@ test_W(obj, fname)
*/
static VALUE
-test_ww(obj, fname)
- VALUE obj, fname;
+test_ww(VALUE obj, VALUE fname)
{
#ifdef S_IWOTH
struct stat st;
@@ -1190,8 +1140,7 @@ test_ww(obj, fname)
*/
static VALUE
-test_x(obj, fname)
- VALUE obj, fname;
+test_x(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1208,8 +1157,7 @@ test_x(obj, fname)
*/
static VALUE
-test_X(obj, fname)
- VALUE obj, fname;
+test_X(VALUE obj, VALUE fname)
{
rb_secure(2);
FilePathValue(fname);
@@ -1230,8 +1178,7 @@ test_X(obj, fname)
*/
static VALUE
-test_f(obj, fname)
- VALUE obj, fname;
+test_f(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1249,8 +1196,7 @@ test_f(obj, fname)
*/
static VALUE
-test_z(obj, fname)
- VALUE obj, fname;
+test_z(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1268,8 +1214,7 @@ test_z(obj, fname)
*/
static VALUE
-test_s(obj, fname)
- VALUE obj, fname;
+test_s(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1288,8 +1233,7 @@ test_s(obj, fname)
*/
static VALUE
-test_owned(obj, fname)
- VALUE obj, fname;
+test_owned(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1299,8 +1243,7 @@ test_owned(obj, fname)
}
static VALUE
-test_rowned(obj, fname)
- VALUE obj, fname;
+test_rowned(VALUE obj, VALUE fname)
{
struct stat st;
@@ -1319,8 +1262,7 @@ test_rowned(obj, fname)
*/
static VALUE
-test_grpowned(obj, fname)
- VALUE obj, fname;
+test_grpowned(VALUE obj, VALUE fname)
{
#ifndef _WIN32
struct stat st;
@@ -1355,8 +1297,7 @@ check3rdbyte(fname, mode)
*/
static VALUE
-test_suid(obj, fname)
- VALUE obj, fname;
+test_suid(VALUE obj, VALUE fname)
{
#ifdef S_ISUID
return check3rdbyte(fname, S_ISUID);
@@ -1373,8 +1314,7 @@ test_suid(obj, fname)
*/
static VALUE
-test_sgid(obj, fname)
- VALUE obj, fname;
+test_sgid(VALUE obj, VALUE fname)
{
#ifdef S_ISGID
return check3rdbyte(fname, S_ISGID);
@@ -1391,8 +1331,7 @@ test_sgid(obj, fname)
*/
static VALUE
-test_sticky(obj, fname)
- VALUE obj, fname;
+test_sticky(VALUE obj, VALUE fname)
{
#ifdef S_ISVTX
return check3rdbyte(fname, S_ISVTX);
@@ -1409,8 +1348,7 @@ test_sticky(obj, fname)
*/
static VALUE
-rb_file_s_size(klass, fname)
- VALUE klass, fname;
+rb_file_s_size(VALUE klass, VALUE fname)
{
struct stat st;
@@ -1420,8 +1358,7 @@ rb_file_s_size(klass, fname)
}
static VALUE
-rb_file_ftype(st)
- struct stat *st;
+rb_file_ftype(struct stat *st)
{
char *t;
@@ -1477,8 +1414,7 @@ rb_file_ftype(st)
*/
static VALUE
-rb_file_s_ftype(klass, fname)
- VALUE klass, fname;
+rb_file_s_ftype(VALUE klass, VALUE fname)
{
struct stat st;
@@ -1502,8 +1438,7 @@ rb_file_s_ftype(klass, fname)
*/
static VALUE
-rb_file_s_atime(klass, fname)
- VALUE klass, fname;
+rb_file_s_atime(VALUE klass, VALUE fname)
{
struct stat st;
@@ -1524,8 +1459,7 @@ rb_file_s_atime(klass, fname)
*/
static VALUE
-rb_file_atime(obj)
- VALUE obj;
+rb_file_atime(VALUE obj)
{
OpenFile *fptr;
struct stat st;
@@ -1548,8 +1482,7 @@ rb_file_atime(obj)
*/
static VALUE
-rb_file_s_mtime(klass, fname)
- VALUE klass, fname;
+rb_file_s_mtime(VALUE klass, VALUE fname)
{
struct stat st;
@@ -1569,8 +1502,7 @@ rb_file_s_mtime(klass, fname)
*/
static VALUE
-rb_file_mtime(obj)
- VALUE obj;
+rb_file_mtime(VALUE obj)
{
OpenFile *fptr;
struct stat st;
@@ -1595,8 +1527,7 @@ rb_file_mtime(obj)
*/
static VALUE
-rb_file_s_ctime(klass, fname)
- VALUE klass, fname;
+rb_file_s_ctime(VALUE klass, VALUE fname)
{
struct stat st;
@@ -1617,8 +1548,7 @@ rb_file_s_ctime(klass, fname)
*/
static VALUE
-rb_file_ctime(obj)
- VALUE obj;
+rb_file_ctime(VALUE obj)
{
OpenFile *fptr;
struct stat st;
@@ -1631,9 +1561,7 @@ rb_file_ctime(obj)
}
static void
-chmod_internal(path, mode)
- const char *path;
- int mode;
+chmod_internal(const char *path, int mode)
{
if (chmod(path, mode) < 0)
rb_sys_fail(path);
@@ -1653,9 +1581,7 @@ chmod_internal(path, mode)
*/
static VALUE
-rb_file_s_chmod(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_chmod(int argc, VALUE *argv)
{
VALUE vmode;
VALUE rest;
@@ -1684,8 +1610,7 @@ rb_file_s_chmod(argc, argv)
*/
static VALUE
-rb_file_chmod(obj, vmode)
- VALUE obj, vmode;
+rb_file_chmod(VALUE obj, VALUE vmode)
{
OpenFile *fptr;
int mode;
@@ -1744,9 +1669,7 @@ rb_file_s_lchmod(argc, argv)
}
#else
static VALUE
-rb_file_s_lchmod(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_lchmod(int argc, VALUE *argv)
{
rb_notimplement();
return Qnil; /* not reached */
@@ -1758,9 +1681,7 @@ struct chown_args {
};
static void
-chown_internal(path, args)
- const char *path;
- struct chown_args *args;
+chown_internal(const char *path, struct chown_args *args)
{
if (chown(path, args->owner, args->group) < 0)
rb_sys_fail(path);
@@ -1782,9 +1703,7 @@ chown_internal(path, args)
*/
static VALUE
-rb_file_s_chown(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_chown(int argc, VALUE *argv)
{
VALUE o, g, rest;
struct chown_args arg;
@@ -1825,8 +1744,7 @@ rb_file_s_chown(argc, argv)
*/
static VALUE
-rb_file_chown(obj, owner, group)
- VALUE obj, owner, group;
+rb_file_chown(VALUE obj, VALUE owner, VALUE group)
{
OpenFile *fptr;
int o, g;
@@ -1898,15 +1816,13 @@ rb_file_s_lchown(argc, argv)
}
#else
static VALUE
-rb_file_s_lchown(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_lchown(int argc, VALUE *argv)
{
rb_notimplement();
}
#endif
-struct timeval rb_time_timeval();
+struct timeval rb_time_timeval(VALUE time);
#if defined(HAVE_UTIMES) && !defined(__CHECKER__)
@@ -1956,18 +1872,14 @@ struct utimbuf {
#endif
static void
-utime_internal(path, utp)
- const char *path;
- struct utimbuf *utp;
+utime_internal(const char *path, struct utimbuf *utp)
{
if (utime(path, utp) < 0)
rb_sys_fail(path);
}
static VALUE
-rb_file_s_utime(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_utime(int argc, VALUE *argv)
{
VALUE atime, mtime, rest;
long n;
@@ -1989,8 +1901,7 @@ rb_file_s_utime(argc, argv)
NORETURN(static void sys_fail2 _((VALUE,VALUE)));
static void
-sys_fail2(s1, s2)
- VALUE s1, s2;
+sys_fail2(VALUE s1, VALUE s2)
{
char *buf;
int len;
@@ -2014,8 +1925,7 @@ sys_fail2(s1, s2)
*/
static VALUE
-rb_file_s_link(klass, from, to)
- VALUE klass, from, to;
+rb_file_s_link(VALUE klass, VALUE from, VALUE to)
{
#ifdef HAVE_LINK
rb_secure(2);
@@ -2045,8 +1955,7 @@ rb_file_s_link(klass, from, to)
*/
static VALUE
-rb_file_s_symlink(klass, from, to)
- VALUE klass, from, to;
+rb_file_s_symlink(VALUE klass, VALUE from, VALUE to)
{
#ifdef HAVE_SYMLINK
rb_secure(2);
@@ -2075,8 +1984,7 @@ rb_file_s_symlink(klass, from, to)
*/
static VALUE
-rb_file_s_readlink(klass, path)
- VALUE klass, path;
+rb_file_s_readlink(VALUE klass, VALUE path)
{
#ifdef HAVE_READLINK
char *buf;
@@ -2106,8 +2014,7 @@ rb_file_s_readlink(klass, path)
}
static void
-unlink_internal(path)
- const char *path;
+unlink_internal(const char *path)
{
if (unlink(path) < 0)
rb_sys_fail(path);
@@ -2124,8 +2031,7 @@ unlink_internal(path)
*/
static VALUE
-rb_file_s_unlink(klass, args)
- VALUE klass, args;
+rb_file_s_unlink(VALUE klass, VALUE args)
{
long n;
@@ -2145,8 +2051,7 @@ rb_file_s_unlink(klass, args)
*/
static VALUE
-rb_file_s_rename(klass, from, to)
- VALUE klass, from, to;
+rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
{
const char *src, *dst;
@@ -2193,9 +2098,7 @@ rb_file_s_rename(klass, from, to)
*/
static VALUE
-rb_file_s_umask(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_umask(int argc, VALUE *argv)
{
int omask = 0;
@@ -2235,8 +2138,7 @@ rb_file_s_umask(argc, argv)
#ifdef DOSISH_DRIVE_LETTER
static inline int
-has_drive_letter(buf)
- const char *buf;
+has_drive_letter(const char *buf)
{
if (ISALPHA(buf[0]) && buf[1] == ':') {
return 1;
@@ -2247,8 +2149,7 @@ has_drive_letter(buf)
}
static char*
-getcwdofdrv(drv)
- int drv;
+getcwdofdrv(int drv)
{
char drive[4];
char *drvcwd, *oldcwd;
@@ -2276,8 +2177,7 @@ getcwdofdrv(drv)
#endif
static inline char *
-skiproot(path)
- const char *path;
+skiproot(const char *path)
{
#ifdef DOSISH_DRIVE_LETTER
if (has_drive_letter(path)) path += 2;
@@ -2288,8 +2188,7 @@ skiproot(path)
#define nextdirsep rb_path_next
char *
-rb_path_next(s)
- const char *s;
+rb_path_next(const char *s)
{
while (*s && !isdirsep(*s)) {
s = CharNext(s);
@@ -2299,8 +2198,7 @@ rb_path_next(s)
#define skipprefix rb_path_skip_prefix
char *
-rb_path_skip_prefix(path)
- const char *path;
+rb_path_skip_prefix(const char *path)
{
#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER)
#ifdef DOSISH_UNC
@@ -2320,8 +2218,7 @@ rb_path_skip_prefix(path)
#define strrdirsep rb_path_last_separator
char *
-rb_path_last_separator(path)
- const char *path;
+rb_path_last_separator(const char *path)
{
char *last = NULL;
while (*path) {
@@ -2340,8 +2237,7 @@ rb_path_last_separator(path)
#define chompdirsep rb_path_end
char *
-rb_path_end(path)
- const char *path;
+rb_path_end(const char *path)
{
while (*path) {
if (isdirsep(*path)) {
@@ -2379,8 +2275,7 @@ rb_path_end(path)
static int is_absolute_path _((const char*));
static VALUE
-file_expand_path(fname, dname, result)
- VALUE fname, dname, result;
+file_expand_path(VALUE fname, VALUE dname, VALUE result)
{
char *s, *buf, *b, *p, *pend, *root;
long buflen, dirlen;
@@ -2579,8 +2474,7 @@ file_expand_path(fname, dname, result)
}
VALUE
-rb_file_expand_path(fname, dname)
- VALUE fname, dname;
+rb_file_expand_path(VALUE fname, VALUE dname)
{
return file_expand_path(fname, dname, rb_str_new(0, MAXPATHLEN + 2));
}
@@ -2603,9 +2497,7 @@ rb_file_expand_path(fname, dname)
*/
VALUE
-rb_file_s_expand_path(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_expand_path(int argc, VALUE *argv)
{
VALUE fname, dname;
@@ -2618,8 +2510,7 @@ rb_file_s_expand_path(argc, argv)
}
static int
-rmext(p, e)
- const char *p, *e;
+rmext(const char *p, const char *e)
{
int l1, l2;
@@ -2655,9 +2546,7 @@ rmext(p, e)
*/
static VALUE
-rb_file_s_basename(argc, argv)
- int argc;
- VALUE *argv;
+rb_file_s_basename(int argc, VALUE *argv)
{
VALUE fname, fext, basename;
char *name, *p;
@@ -2710,8 +2599,7 @@ rb_file_s_basename(argc, argv)
*/
static VALUE
-rb_file_s_dirname(klass, fname)
- VALUE klass, fname;
+rb_file_s_dirname(VALUE klass, VALUE fname)
{
char *name, *root, *p;
VALUE dirname;
@@ -2755,8 +2643,7 @@ rb_file_s_dirname(klass, fname)
*/
static VALUE
-rb_file_s_extname(klass, fname)
- VALUE klass, fname;
+rb_file_s_extname(VALUE klass, VALUE fname)
{
char *name, *p, *e;
VALUE extname;
@@ -2788,8 +2675,7 @@ rb_file_s_extname(klass, fname)
*/
static VALUE
-rb_file_s_path(klass, fname)
- VALUE klass, fname;
+rb_file_s_path(VALUE klass, VALUE fname)
{
return rb_get_path(fname);
}
@@ -2806,8 +2692,7 @@ rb_file_s_path(klass, fname)
*/
static VALUE
-rb_file_s_split(klass, path)
- VALUE klass, path;
+rb_file_s_split(VALUE klass, VALUE path)
{
StringValue(path); /* get rid of converting twice */
return rb_assoc_new(rb_file_s_dirname(Qnil, path), rb_file_s_basename(1,&path));
@@ -2818,17 +2703,14 @@ static VALUE separator;
static VALUE rb_file_join _((VALUE ary, VALUE sep));
static VALUE
-file_inspect_join(ary, arg, recur)
- VALUE ary;
- VALUE *arg;
+file_inspect_join(VALUE ary, VALUE *arg, int recur)
{
if (recur) return rb_str_new2("[...]");
return rb_file_join(arg[0], arg[1]);
}
static VALUE
-rb_file_join(ary, sep)
- VALUE ary, sep;
+rb_file_join(VALUE ary, VALUE sep)
{
long len, i;
int taint = 0;
@@ -2892,8 +2774,7 @@ rb_file_join(ary, sep)
*/
static VALUE
-rb_file_s_join(klass, args)
- VALUE klass, args;
+rb_file_s_join(VALUE klass, VALUE args)
{
return rb_file_join(args, separator);
}
@@ -2914,8 +2795,7 @@ rb_file_s_join(klass, args)
*/
static VALUE
-rb_file_s_truncate(klass, path, len)
- VALUE klass, path, len;
+rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
off_t pos;
@@ -2967,8 +2847,7 @@ rb_file_s_truncate(klass, path, len)
*/
static VALUE
-rb_file_truncate(obj, len)
- VALUE obj, len;
+rb_file_truncate(VALUE obj, VALUE len)
{
OpenFile *fptr;
off_t pos;
@@ -3009,9 +2888,7 @@ rb_file_truncate(obj, len)
#if 1
static int
-rb_thread_flock(fd, op, fptr)
- int fd, op;
- OpenFile *fptr;
+rb_thread_flock(int fd, int op, OpenFile *fptr)
{
if (rb_thread_alone() || (op & LOCK_NB)) {
return flock(fd, op);
@@ -3066,9 +2943,7 @@ rb_thread_flock(fd, op, fptr)
*/
static VALUE
-rb_file_flock(obj, operation)
- VALUE obj;
- VALUE operation;
+rb_file_flock(VALUE obj, VALUE operation)
{
#ifndef __CHECKER__
OpenFile *fptr;
@@ -3104,9 +2979,7 @@ rb_file_flock(obj, operation)
#undef flock
static void
-test_check(n, argc, argv)
- int n, argc;
- VALUE *argv;
+test_check(int n, int argc, VALUE *argv)
{
int i;
@@ -3187,9 +3060,7 @@ test_check(n, argc, argv)
*/
static VALUE
-rb_f_test(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_test(int argc, VALUE *argv)
{
int cmd;
@@ -3338,10 +3209,8 @@ rb_f_test(argc, argv)
* meaningful on all systems. See also <code>Kernel#test</code>.
*/
-static VALUE rb_stat_s_alloc _((VALUE));
static VALUE
-rb_stat_s_alloc(klass)
- VALUE klass;
+rb_stat_s_alloc(VALUE klass)
{
return stat_new_0(klass, 0);
}
@@ -3356,8 +3225,7 @@ rb_stat_s_alloc(klass)
*/
static VALUE
-rb_stat_init(obj, fname)
- VALUE obj, fname;
+rb_stat_init(VALUE obj, VALUE fname)
{
struct stat st, *nst;
@@ -3379,8 +3247,7 @@ rb_stat_init(obj, fname)
/* :nodoc: */
static VALUE
-rb_stat_init_copy(copy, orig)
- VALUE copy, orig;
+rb_stat_init_copy(VALUE copy, VALUE orig)
{
struct stat *nst;
@@ -3418,8 +3285,7 @@ rb_stat_init_copy(copy, orig)
*/
static VALUE
-rb_stat_ftype(obj)
- VALUE obj;
+rb_stat_ftype(VALUE obj)
{
return rb_file_ftype(get_stat(obj));
}
@@ -3436,8 +3302,7 @@ rb_stat_ftype(obj)
*/
static VALUE
-rb_stat_d(obj)
- VALUE obj;
+rb_stat_d(VALUE obj)
{
if (S_ISDIR(get_stat(obj)->st_mode)) return Qtrue;
return Qfalse;
@@ -3452,8 +3317,7 @@ rb_stat_d(obj)
*/
static VALUE
-rb_stat_p(obj)
- VALUE obj;
+rb_stat_p(VALUE obj)
{
#ifdef S_IFIFO
if (S_ISFIFO(get_stat(obj)->st_mode)) return Qtrue;
@@ -3480,8 +3344,7 @@ rb_stat_p(obj)
*/
static VALUE
-rb_stat_l(obj)
- VALUE obj;
+rb_stat_l(VALUE obj)
{
#ifdef S_ISLNK
if (S_ISLNK(get_stat(obj)->st_mode)) return Qtrue;
@@ -3502,8 +3365,7 @@ rb_stat_l(obj)
*/
static VALUE
-rb_stat_S(obj)
- VALUE obj;
+rb_stat_S(VALUE obj)
{
#ifdef S_ISSOCK
if (S_ISSOCK(get_stat(obj)->st_mode)) return Qtrue;
@@ -3526,8 +3388,7 @@ rb_stat_S(obj)
*/
static VALUE
-rb_stat_b(obj)
- VALUE obj;
+rb_stat_b(VALUE obj)
{
#ifdef S_ISBLK
if (S_ISBLK(get_stat(obj)->st_mode)) return Qtrue;
@@ -3549,8 +3410,7 @@ rb_stat_b(obj)
*/
static VALUE
-rb_stat_c(obj)
- VALUE obj;
+rb_stat_c(VALUE obj)
{
if (S_ISCHR(get_stat(obj)->st_mode)) return Qtrue;
@@ -3570,16 +3430,14 @@ rb_stat_c(obj)
*/
static VALUE
-rb_stat_owned(obj)
- VALUE obj;
+rb_stat_owned(VALUE obj)
{
if (get_stat(obj)->st_uid == geteuid()) return Qtrue;
return Qfalse;
}
static VALUE
-rb_stat_rowned(obj)
- VALUE obj;
+rb_stat_rowned(VALUE obj)
{
if (get_stat(obj)->st_uid == getuid()) return Qtrue;
return Qfalse;
@@ -3598,8 +3456,7 @@ rb_stat_rowned(obj)
*/
static VALUE
-rb_stat_grpowned(obj)
- VALUE obj;
+rb_stat_grpowned(VALUE obj)
{
#ifndef _WIN32
if (get_stat(obj)->st_gid == getegid()) return Qtrue;
@@ -3619,8 +3476,7 @@ rb_stat_grpowned(obj)
*/
static VALUE
-rb_stat_r(obj)
- VALUE obj;
+rb_stat_r(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3652,8 +3508,7 @@ rb_stat_r(obj)
*/
static VALUE
-rb_stat_R(obj)
- VALUE obj;
+rb_stat_R(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3685,8 +3540,7 @@ rb_stat_R(obj)
*/
static VALUE
-rb_stat_wr(obj)
- VALUE obj;
+rb_stat_wr(VALUE obj)
{
#ifdef S_IROTH
if ((get_stat(obj)->st_mode & (S_IROTH)) == S_IROTH) {
@@ -3710,8 +3564,7 @@ rb_stat_wr(obj)
*/
static VALUE
-rb_stat_w(obj)
- VALUE obj;
+rb_stat_w(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3741,8 +3594,7 @@ rb_stat_w(obj)
*/
static VALUE
-rb_stat_W(obj)
- VALUE obj;
+rb_stat_W(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3774,8 +3626,7 @@ rb_stat_W(obj)
*/
static VALUE
-rb_stat_ww(obj)
- VALUE obj;
+rb_stat_ww(VALUE obj)
{
#ifdef S_IROTH
if ((get_stat(obj)->st_mode & (S_IWOTH)) == S_IWOTH) {
@@ -3801,8 +3652,7 @@ rb_stat_ww(obj)
*/
static VALUE
-rb_stat_x(obj)
- VALUE obj;
+rb_stat_x(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3830,8 +3680,7 @@ rb_stat_x(obj)
static VALUE
-rb_stat_X(obj)
- VALUE obj;
+rb_stat_X(VALUE obj)
{
struct stat *st = get_stat(obj);
@@ -3861,8 +3710,7 @@ rb_stat_X(obj)
*/
static VALUE
-rb_stat_f(obj)
- VALUE obj;
+rb_stat_f(VALUE obj)
{
if (S_ISREG(get_stat(obj)->st_mode)) return Qtrue;
return Qfalse;
@@ -3880,8 +3728,7 @@ rb_stat_f(obj)
*/
static VALUE
-rb_stat_z(obj)
- VALUE obj;
+rb_stat_z(VALUE obj)
{
if (get_stat(obj)->st_size == 0) return Qtrue;
return Qfalse;
@@ -3899,8 +3746,7 @@ rb_stat_z(obj)
*/
static VALUE
-rb_stat_s(obj)
- VALUE obj;
+rb_stat_s(VALUE obj)
{
off_t size = get_stat(obj)->st_size;
@@ -3920,8 +3766,7 @@ rb_stat_s(obj)
*/
static VALUE
-rb_stat_suid(obj)
- VALUE obj;
+rb_stat_suid(VALUE obj)
{
#ifdef S_ISUID
if (get_stat(obj)->st_mode & S_ISUID) return Qtrue;
@@ -3942,8 +3787,7 @@ rb_stat_suid(obj)
*/
static VALUE
-rb_stat_sgid(obj)
- VALUE obj;
+rb_stat_sgid(VALUE obj)
{
#ifdef S_ISGID
if (get_stat(obj)->st_mode & S_ISGID) return Qtrue;
@@ -3964,8 +3808,7 @@ rb_stat_sgid(obj)
*/
static VALUE
-rb_stat_sticky(obj)
- VALUE obj;
+rb_stat_sticky(VALUE obj)
{
#ifdef S_ISVTX
if (get_stat(obj)->st_mode & S_ISVTX) return Qtrue;
@@ -3976,16 +3819,13 @@ rb_stat_sticky(obj)
static VALUE rb_mFConst;
void
-rb_file_const(name, value)
- const char *name;
- VALUE value;
+rb_file_const(const char *name, VALUE value)
{
rb_define_const(rb_mFConst, name, value);
}
static int
-is_absolute_path(path)
- const char *path;
+is_absolute_path(const char *path)
{
#ifdef DOSISH_DRIVE_LETTER
if (has_drive_letter(path) && isdirsep(path[2])) return 1;
@@ -4042,8 +3882,7 @@ path_check_1(path)
#endif
int
-rb_path_check(path)
- char *path;
+rb_path_check(char *path)
{
#ifndef DOSISH
char *p0, *p, *pend;
@@ -4080,8 +3919,7 @@ is_macos_native_path(path)
#endif
static int
-file_load_ok(file)
- char *file;
+file_load_ok(char *file)
{
FILE *f;
@@ -4095,9 +3933,7 @@ file_load_ok(file)
extern VALUE rb_load_path;
int
-rb_find_file_ext(filep, ext)
- VALUE *filep;
- const char * const *ext;
+rb_find_file_ext(VALUE *filep, const char *const *ext)
{
char *path, *found;
char *f = RSTRING(*filep)->ptr;
@@ -4151,8 +3987,7 @@ rb_find_file_ext(filep, ext)
}
VALUE
-rb_find_file(path)
- VALUE path;
+rb_find_file(VALUE path)
{
VALUE tmp;
char *f = StringValueCStr(path);
@@ -4230,10 +4065,7 @@ rb_find_file(path)
}
static void
-define_filetest_function(name, func, argc)
- const char *name;
- VALUE (*func)();
- int argc;
+define_filetest_function(const char *name, VALUE (*func) (/* ??? */), int argc)
{
rb_define_module_function(rb_mFileTest, name, func, argc);
rb_define_singleton_method(rb_cFile, name, func, argc);
@@ -4273,7 +4105,7 @@ define_filetest_function(name, func, argc)
*/
void
-Init_File()
+Init_File(void)
{
rb_mFileTest = rb_define_module("FileTest");
rb_cFile = rb_define_class("File", rb_cIO);
diff --git a/gc.c b/gc.c
index 7ae10fba9f..411eca2c46 100644
--- a/gc.c
+++ b/gc.c
@@ -89,12 +89,12 @@ void *alloca ();
static unsigned long malloc_increase = 0;
static unsigned long malloc_limit = GC_MALLOC_LIMIT;
-static void run_final();
+static void run_final(VALUE obj);
static VALUE nomem_error;
-static void garbage_collect();
+static void garbage_collect(void);
void
-rb_memerror()
+rb_memerror(void)
{
static int recurse = 0;
@@ -107,8 +107,7 @@ rb_memerror()
}
void *
-ruby_xmalloc(size)
- long size;
+ruby_xmalloc(long size)
{
void *mem;
@@ -134,8 +133,7 @@ ruby_xmalloc(size)
}
void *
-ruby_xcalloc(n, size)
- long n, size;
+ruby_xcalloc(long n, long size)
{
void *mem;
@@ -146,9 +144,7 @@ ruby_xcalloc(n, size)
}
void *
-ruby_xrealloc(ptr, size)
- void *ptr;
- long size;
+ruby_xrealloc(void *ptr, long size)
{
void *mem;
@@ -171,8 +167,7 @@ ruby_xrealloc(ptr, size)
}
void
-ruby_xfree(x)
- void *x;
+ruby_xfree(void *x)
{
if (x)
RUBY_CRITICAL(free(x));
@@ -198,7 +193,7 @@ static st_table *finalizer_table = 0;
*/
VALUE
-rb_gc_enable()
+rb_gc_enable(void)
{
int old = dont_gc;
@@ -219,7 +214,7 @@ rb_gc_enable()
*/
VALUE
-rb_gc_disable()
+rb_gc_disable(void)
{
int old = dont_gc;
@@ -235,8 +230,7 @@ static struct gc_list {
} *global_List = 0;
void
-rb_gc_register_address(addr)
- VALUE *addr;
+rb_gc_register_address(VALUE *addr)
{
struct gc_list *tmp;
@@ -247,8 +241,7 @@ rb_gc_register_address(addr)
}
void
-rb_gc_unregister_address(addr)
- VALUE *addr;
+rb_gc_unregister_address(VALUE *addr)
{
struct gc_list *tmp = global_List;
@@ -272,8 +265,7 @@ rb_gc_unregister_address(addr)
#undef GC_DEBUG
void
-rb_global_variable(var)
- VALUE *var;
+rb_global_variable(VALUE *var)
{
rb_gc_register_address(var);
}
@@ -326,7 +318,7 @@ static int heap_slots = HEAP_MIN_SLOTS;
static RVALUE *himem, *lomem;
static void
-add_heap()
+add_heap(void)
{
RVALUE *p, *pend;
@@ -376,7 +368,7 @@ add_heap()
#define RANY(o) ((RVALUE*)(o))
VALUE
-rb_newobj()
+rb_newobj(void)
{
VALUE obj;
@@ -393,11 +385,7 @@ rb_newobj()
}
VALUE
-rb_data_object_alloc(klass, datap, dmark, dfree)
- VALUE klass;
- void *datap;
- RUBY_DATA_FUNC dmark;
- RUBY_DATA_FUNC dfree;
+rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
{
NEWOBJ(data, struct RData);
if (klass) Check_Type(klass, T_CLASS);
@@ -477,8 +465,7 @@ stack_grow_direction(addr)
} while (0)
int
-ruby_stack_length(p)
- VALUE **p;
+ruby_stack_length(VALUE **p)
{
SET_STACK_END;
if (p) *p = STACK_UPPER(STACK_END, rb_gc_stack_start, STACK_END);
@@ -486,7 +473,7 @@ ruby_stack_length(p)
}
int
-ruby_stack_check()
+ruby_stack_check(void)
{
int ret;
@@ -500,7 +487,7 @@ static VALUE *mark_stack_ptr;
static int mark_stack_overflow;
static void
-init_mark_stack()
+init_mark_stack(void)
{
mark_stack_overflow = 0;
mark_stack_ptr = mark_stack;
@@ -511,8 +498,7 @@ init_mark_stack()
static st_table *source_filenames;
char *
-rb_source_filename(f)
- const char *f;
+rb_source_filename(const char *f)
{
char *name;
@@ -528,8 +514,7 @@ rb_source_filename(f)
}
static void
-mark_source_filename(f)
- char *f;
+mark_source_filename(char *f)
{
if (f) {
f[-1] = 1;
@@ -537,8 +522,7 @@ mark_source_filename(f)
}
static int
-sweep_source_filename(key, value)
- char *key, *value;
+sweep_source_filename(char *key, char *value)
{
if (*value) {
*value = 0;
@@ -554,7 +538,7 @@ static void gc_mark _((VALUE ptr, int lev));
static void gc_mark_children _((VALUE ptr, int lev));
static void
-gc_mark_all()
+gc_mark_all(void)
{
RVALUE *p, *pend;
int i;
@@ -573,7 +557,7 @@ gc_mark_all()
}
static void
-gc_mark_rest()
+gc_mark_rest(void)
{
VALUE tmp_arry[MARK_STACK_MAX];
VALUE *p;
@@ -589,8 +573,7 @@ gc_mark_rest()
}
static inline int
-is_pointer_to_heap(ptr)
- void *ptr;
+is_pointer_to_heap(void *ptr)
{
register RVALUE *p = RANY(ptr);
register RVALUE *heap_org;
@@ -609,9 +592,7 @@ is_pointer_to_heap(ptr)
}
static void
-mark_locations_array(x, n)
- register VALUE *x;
- register long n;
+mark_locations_array(register VALUE *x, register long n)
{
VALUE v;
while (n--) {
@@ -624,8 +605,7 @@ mark_locations_array(x, n)
}
void
-rb_gc_mark_locations(start, end)
- VALUE *start, *end;
+rb_gc_mark_locations(VALUE *start, VALUE *end)
{
long n;
@@ -634,36 +614,27 @@ rb_gc_mark_locations(start, end)
}
static int
-mark_entry(key, value, lev)
- ID key;
- VALUE value;
- int lev;
+mark_entry(ID key, VALUE value, int lev)
{
gc_mark(value, lev);
return ST_CONTINUE;
}
void
-mark_tbl(tbl, lev)
- st_table *tbl;
- int lev;
+mark_tbl(st_table *tbl, int lev)
{
if (!tbl) return;
st_foreach(tbl, mark_entry, lev);
}
void
-rb_mark_tbl(tbl)
- st_table *tbl;
+rb_mark_tbl(st_table *tbl)
{
mark_tbl(tbl, 0);
}
static int
-mark_keyvalue(key, value, lev)
- VALUE key;
- VALUE value;
- int lev;
+mark_keyvalue(VALUE key, VALUE value, int lev)
{
gc_mark(key, lev);
gc_mark(value, lev);
@@ -671,24 +642,20 @@ mark_keyvalue(key, value, lev)
}
void
-mark_hash(tbl, lev)
- st_table *tbl;
- int lev;
+mark_hash(st_table *tbl, int lev)
{
if (!tbl) return;
st_foreach(tbl, mark_keyvalue, lev);
}
void
-rb_mark_hash(tbl)
- st_table *tbl;
+rb_mark_hash(st_table *tbl)
{
mark_hash(tbl, 0);
}
void
-rb_gc_mark_maybe(obj)
- VALUE obj;
+rb_gc_mark_maybe(VALUE obj)
{
if (is_pointer_to_heap((void *)obj)) {
gc_mark(obj, 0);
@@ -698,9 +665,7 @@ rb_gc_mark_maybe(obj)
#define GC_LEVEL_MAX 250
static void
-gc_mark(ptr, lev)
- VALUE ptr;
- int lev;
+gc_mark(VALUE ptr, int lev)
{
register RVALUE *obj;
@@ -726,16 +691,13 @@ gc_mark(ptr, lev)
}
void
-rb_gc_mark(ptr)
- VALUE ptr;
+rb_gc_mark(VALUE ptr)
{
gc_mark(ptr, 0);
}
static void
-gc_mark_children(ptr, lev)
- VALUE ptr;
- int lev;
+gc_mark_children(VALUE ptr, int lev)
{
register RVALUE *obj = RANY(ptr);
@@ -993,8 +955,7 @@ gc_mark_children(ptr, lev)
static void obj_free _((VALUE));
static void
-finalize_list(p)
- RVALUE *p;
+finalize_list(RVALUE *p)
{
while (p) {
RVALUE *tmp = p->as.free.next;
@@ -1009,7 +970,7 @@ finalize_list(p)
}
static void
-free_unused_heaps()
+free_unused_heaps(void)
{
int i, j;
@@ -1028,7 +989,7 @@ free_unused_heaps()
}
static void
-gc_sweep()
+gc_sweep(void)
{
RVALUE *p, *pend, *final_list;
int freed = 0;
@@ -1106,8 +1067,7 @@ gc_sweep()
}
void
-rb_gc_force_recycle(p)
- VALUE p;
+rb_gc_force_recycle(VALUE p)
{
RANY(p)->as.free.flags = 0;
RANY(p)->as.free.next = freelist;
@@ -1115,8 +1075,7 @@ rb_gc_force_recycle(p)
}
static void
-obj_free(obj)
- VALUE obj;
+obj_free(VALUE obj)
{
switch (RANY(obj)->as.basic.flags & T_MASK) {
case T_NIL:
@@ -1242,8 +1201,7 @@ obj_free(obj)
}
void
-rb_gc_mark_frame(frame)
- struct FRAME *frame;
+rb_gc_mark_frame(struct FRAME *frame)
{
gc_mark((VALUE)frame->node, 0);
}
@@ -1287,7 +1245,7 @@ int rb_setjmp (rb_jmp_buf);
#endif /* __GNUC__ */
static void
-garbage_collect()
+garbage_collect(void)
{
struct gc_list *list;
struct FRAME * volatile frame; /* gcc 2.7.2.3 -O2 bug?? */
@@ -1400,7 +1358,7 @@ garbage_collect()
}
void
-rb_gc()
+rb_gc(void)
{
garbage_collect();
rb_gc_finalize_deferred();
@@ -1417,15 +1375,14 @@ rb_gc()
*/
VALUE
-rb_gc_start()
+rb_gc_start(void)
{
rb_gc();
return Qnil;
}
void
-ruby_set_stack_size(size)
- size_t size;
+ruby_set_stack_size(size_t size)
{
#ifndef STACK_LEVEL_MAX
STACK_LEVEL_MAX = size/sizeof(VALUE);
@@ -1433,8 +1390,7 @@ ruby_set_stack_size(size)
}
void
-Init_stack(addr)
- VALUE *addr;
+Init_stack(VALUE *addr)
{
#if defined(_WIN32) || defined(__CYGWIN__)
MEMORY_BASIC_INFORMATION m;
@@ -1505,7 +1461,7 @@ Init_stack(addr)
*/
void
-Init_heap()
+Init_heap(void)
{
if (!rb_gc_stack_start) {
Init_stack(0);
@@ -1514,7 +1470,7 @@ Init_heap()
}
static VALUE
-os_live_obj()
+os_live_obj(void)
{
int i;
int n = 0;
@@ -1546,8 +1502,7 @@ os_live_obj()
}
static VALUE
-os_obj_of(of)
- VALUE of;
+os_obj_of(VALUE of)
{
int i;
int n = 0;
@@ -1614,9 +1569,7 @@ os_obj_of(of)
*/
static VALUE
-os_each_obj(argc, argv)
- int argc;
- VALUE *argv;
+os_each_obj(int argc, VALUE *argv)
{
VALUE of;
@@ -1635,8 +1588,7 @@ static VALUE finalizers;
*/
static VALUE
-add_final(os, block)
- VALUE os, block;
+add_final(VALUE os, VALUE block)
{
rb_warn("ObjectSpace::add_finalizer is deprecated; use define_finalizer");
if (!rb_respond_to(block, rb_intern("call"))) {
@@ -1651,8 +1603,7 @@ add_final(os, block)
* deprecated
*/
static VALUE
-rm_final(os, block)
- VALUE os, block;
+rm_final(VALUE os, VALUE block)
{
rb_warn("ObjectSpace::remove_finalizer is deprecated; use undefine_finalizer");
rb_ary_delete(finalizers, block);
@@ -1663,7 +1614,7 @@ rm_final(os, block)
* deprecated
*/
static VALUE
-finals()
+finals(void)
{
rb_warn("ObjectSpace::finalizers is deprecated");
return finalizers;
@@ -1674,8 +1625,7 @@ finals()
*/
static VALUE
-call_final(os, obj)
- VALUE os, obj;
+call_final(VALUE os, VALUE obj)
{
rb_warn("ObjectSpace::call_finalizer is deprecated; use define_finalizer");
need_call_final = 1;
@@ -1692,8 +1642,7 @@ call_final(os, obj)
*/
static VALUE
-undefine_final(os, obj)
- VALUE os, obj;
+undefine_final(VALUE os, VALUE obj)
{
if (finalizer_table) {
st_delete(finalizer_table, (st_data_t*)&obj, 0);
@@ -1711,10 +1660,7 @@ undefine_final(os, obj)
*/
static VALUE
-define_final(argc, argv, os)
- int argc;
- VALUE *argv;
- VALUE os;
+define_final(int argc, VALUE *argv, VALUE os)
{
VALUE obj, block, table;
@@ -1744,8 +1690,7 @@ define_final(argc, argv, os)
}
void
-rb_gc_copy_finalizer(dest, obj)
- VALUE dest, obj;
+rb_gc_copy_finalizer(VALUE dest, VALUE obj)
{
VALUE table;
@@ -1758,16 +1703,14 @@ rb_gc_copy_finalizer(dest, obj)
}
static VALUE
-run_single_final(args)
- VALUE *args;
+run_single_final(VALUE *args)
{
rb_eval_cmd(args[0], args[1], (int)args[2]);
return Qnil;
}
static void
-run_final(obj)
- VALUE obj;
+run_final(VALUE obj)
{
long i;
int status, critical_save = rb_thread_critical;
@@ -1795,7 +1738,7 @@ run_final(obj)
}
void
-rb_gc_finalize_deferred()
+rb_gc_finalize_deferred(void)
{
RVALUE *p = deferred_final_list;
@@ -1807,7 +1750,7 @@ rb_gc_finalize_deferred()
}
void
-rb_gc_call_finalizer_at_exit()
+rb_gc_call_finalizer_at_exit(void)
{
RVALUE *p, *pend;
int i;
@@ -1868,8 +1811,7 @@ rb_gc_call_finalizer_at_exit()
*/
static VALUE
-id2ref(obj, id)
- VALUE obj, id;
+id2ref(VALUE obj, VALUE id)
{
#if SIZEOF_LONG == SIZEOF_VOIDP
#define NUM2PTR(x) NUM2ULONG(x)
@@ -1908,7 +1850,7 @@ id2ref(obj, id)
*/
void
-Init_GC()
+Init_GC(void)
{
VALUE rb_mObSpace;
diff --git a/hash.c b/hash.c
index 7eb12ce286..3abd5f7f34 100644
--- a/hash.c
+++ b/hash.c
@@ -25,8 +25,7 @@
#define HASH_PROC_DEFAULT FL_USER2
VALUE
-rb_hash_freeze(hash)
- VALUE hash;
+rb_hash_freeze(VALUE hash)
{
return rb_obj_freeze(hash);
}
@@ -37,15 +36,13 @@ static VALUE envtbl;
static ID id_hash, id_call, id_default;
static VALUE
-eql(args)
- VALUE *args;
+eql(VALUE *args)
{
return (VALUE)rb_eql(args[0], args[1]);
}
static int
-rb_any_cmp(a, b)
- VALUE a, b;
+rb_any_cmp(VALUE a, VALUE b)
{
VALUE args[2];
@@ -68,15 +65,13 @@ rb_any_cmp(a, b)
}
VALUE
-rb_hash(obj)
- VALUE obj;
+rb_hash(VALUE obj)
{
return rb_funcall(obj, id_hash, 0);
}
static int
-rb_any_hash(a)
- VALUE a;
+rb_any_hash(VALUE a)
{
VALUE hval;
@@ -111,9 +106,7 @@ struct foreach_safe_arg {
};
static int
-foreach_safe_i(key, value, arg)
- st_data_t key, value;
- struct foreach_safe_arg *arg;
+foreach_safe_i(st_data_t key, st_data_t value, struct foreach_safe_arg *arg)
{
int status;
@@ -126,10 +119,7 @@ foreach_safe_i(key, value, arg)
}
void
-st_foreach_safe(table, func, a)
- st_table *table;
- int (*func)();
- st_data_t a;
+st_foreach_safe(st_table *table, int (*func) (/* ??? */), st_data_t a)
{
struct foreach_safe_arg arg;
@@ -148,9 +138,7 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(key, value, arg)
- VALUE key, value;
- struct hash_foreach_arg *arg;
+hash_foreach_iter(VALUE key, VALUE value, struct hash_foreach_arg *arg)
{
int status;
st_table *tbl;
@@ -174,8 +162,7 @@ hash_foreach_iter(key, value, arg)
}
static VALUE
-hash_foreach_ensure(hash)
- VALUE hash;
+hash_foreach_ensure(VALUE hash)
{
RHASH(hash)->iter_lev--;
@@ -189,8 +176,7 @@ hash_foreach_ensure(hash)
}
static VALUE
-hash_foreach_call(arg)
- struct hash_foreach_arg *arg;
+hash_foreach_call(struct hash_foreach_arg *arg)
{
if (st_foreach(RHASH(arg->hash)->tbl, hash_foreach_iter, (st_data_t)arg)) {
rb_raise(rb_eRuntimeError, "hash modified during iteration");
@@ -199,10 +185,7 @@ hash_foreach_call(arg)
}
void
-rb_hash_foreach(hash, func, farg)
- VALUE hash;
- int (*func)();
- VALUE farg;
+rb_hash_foreach(VALUE hash, int (*func) (/* ??? */), VALUE farg)
{
struct hash_foreach_arg arg;
@@ -216,8 +199,7 @@ rb_hash_foreach(hash, func, farg)
static VALUE hash_alloc _((VALUE));
static VALUE
-hash_alloc(klass)
- VALUE klass;
+hash_alloc(VALUE klass)
{
NEWOBJ(hash, struct RHash);
OBJSETUP(hash, klass, T_HASH);
@@ -229,14 +211,13 @@ hash_alloc(klass)
}
VALUE
-rb_hash_new()
+rb_hash_new(void)
{
return hash_alloc(rb_cHash);
}
static void
-rb_hash_modify(hash)
- VALUE hash;
+rb_hash_modify(VALUE hash)
{
if (!RHASH(hash)->tbl) rb_raise(rb_eTypeError, "uninitialized Hash");
if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
@@ -280,10 +261,7 @@ rb_hash_modify(hash)
*/
static VALUE
-rb_hash_initialize(argc, argv, hash)
- int argc;
- VALUE *argv;
- VALUE hash;
+rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
{
VALUE ifnone;
@@ -317,10 +295,7 @@ rb_hash_initialize(argc, argv, hash)
*/
static VALUE
-rb_hash_s_create(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
{
VALUE hash;
int i;
@@ -347,16 +322,13 @@ rb_hash_s_create(argc, argv, klass)
}
static VALUE
-to_hash(hash)
- VALUE hash;
+to_hash(VALUE hash)
{
return rb_convert_type(hash, T_HASH, "Hash", "to_hash");
}
static int
-rb_hash_rehash_i(key, value, tbl)
- VALUE key, value;
- st_table *tbl;
+rb_hash_rehash_i(VALUE key, VALUE value, st_table *tbl)
{
if (key != Qundef) st_insert(tbl, key, value);
return ST_CONTINUE;
@@ -383,8 +355,7 @@ rb_hash_rehash_i(key, value, tbl)
*/
static VALUE
-rb_hash_rehash(hash)
- VALUE hash;
+rb_hash_rehash(VALUE hash)
{
st_table *tbl;
@@ -415,8 +386,7 @@ rb_hash_rehash(hash)
*/
VALUE
-rb_hash_aref(hash, key)
- VALUE hash, key;
+rb_hash_aref(VALUE hash, VALUE key)
{
VALUE val;
@@ -456,10 +426,7 @@ rb_hash_aref(hash, key)
*/
static VALUE
-rb_hash_fetch(argc, argv, hash)
- int argc;
- VALUE *argv;
- VALUE hash;
+rb_hash_fetch(int argc, VALUE *argv, VALUE hash)
{
VALUE key, if_none;
VALUE val;
@@ -503,10 +470,7 @@ rb_hash_fetch(argc, argv, hash)
*/
static VALUE
-rb_hash_default(argc, argv, hash)
- int argc;
- VALUE *argv;
- VALUE hash;
+rb_hash_default(int argc, VALUE *argv, VALUE hash)
{
VALUE key;
@@ -538,8 +502,7 @@ rb_hash_default(argc, argv, hash)
*/
static VALUE
-rb_hash_set_default(hash, ifnone)
- VALUE hash, ifnone;
+rb_hash_set_default(VALUE hash, VALUE ifnone)
{
rb_hash_modify(hash);
RHASH(hash)->ifnone = ifnone;
@@ -563,8 +526,7 @@ rb_hash_set_default(hash, ifnone)
static VALUE
-rb_hash_default_proc(hash)
- VALUE hash;
+rb_hash_default_proc(VALUE hash)
{
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
return RHASH(hash)->ifnone;
@@ -573,9 +535,7 @@ rb_hash_default_proc(hash)
}
static int
-key_i(key, value, args)
- VALUE key, value;
- VALUE *args;
+key_i(VALUE key, VALUE value, VALUE *args)
{
if (rb_equal(value, args[0])) {
args[1] = key;
@@ -597,8 +557,7 @@ key_i(key, value, args)
*/
static VALUE
-rb_hash_key(hash, value)
- VALUE hash, value;
+rb_hash_key(VALUE hash, VALUE value)
{
VALUE args[2];
@@ -612,8 +571,7 @@ rb_hash_key(hash, value)
/* :nodoc: */
static VALUE
-rb_hash_index(hash, value)
- VALUE hash, value;
+rb_hash_index(VALUE hash, VALUE value)
{
rb_warn("Hash#index is deprecated; use Hash#key");
return rb_hash_key(hash, value);
@@ -638,8 +596,7 @@ rb_hash_index(hash, value)
*/
VALUE
-rb_hash_delete(hash, key)
- VALUE hash, key;
+rb_hash_delete(VALUE hash, VALUE key)
{
VALUE val;
@@ -665,9 +622,7 @@ struct shift_var {
};
static int
-shift_i(key, value, var)
- VALUE key, value;
- struct shift_var *var;
+shift_i(VALUE key, VALUE value, struct shift_var *var)
{
if (key == Qundef) return ST_CONTINUE;
if (var->stop) return ST_STOP;
@@ -691,8 +646,7 @@ shift_i(key, value, var)
*/
static VALUE
-rb_hash_shift(hash)
- VALUE hash;
+rb_hash_shift(VALUE hash)
{
struct shift_var var;
@@ -712,8 +666,7 @@ rb_hash_shift(hash)
}
static int
-delete_if_i(key, value, hash)
- VALUE key, value, hash;
+delete_if_i(VALUE key, VALUE value, VALUE hash)
{
if (key == Qundef) return ST_CONTINUE;
if (RTEST(rb_yield_values(2, key, value))) {
@@ -735,8 +688,7 @@ delete_if_i(key, value, hash)
*/
VALUE
-rb_hash_delete_if(hash)
- VALUE hash;
+rb_hash_delete_if(VALUE hash)
{
rb_hash_modify(hash);
rb_hash_foreach(hash, delete_if_i, hash);
@@ -752,8 +704,7 @@ rb_hash_delete_if(hash)
*/
VALUE
-rb_hash_reject_bang(hash)
- VALUE hash;
+rb_hash_reject_bang(VALUE hash)
{
int n = RHASH(hash)->tbl->num_entries;
rb_hash_delete_if(hash);
@@ -772,15 +723,13 @@ rb_hash_reject_bang(hash)
*/
static VALUE
-rb_hash_reject(hash)
- VALUE hash;
+rb_hash_reject(VALUE hash)
{
return rb_hash_delete_if(rb_obj_dup(hash));
}
static int
-select_i(key, value, result)
- VALUE key, value, result;
+select_i(VALUE key, VALUE value, VALUE result)
{
if (key == Qundef) return ST_CONTINUE;
if (RTEST(rb_yield_values(2, key, value)))
@@ -800,10 +749,7 @@ select_i(key, value, result)
*/
VALUE
-rb_hash_values_at(argc, argv, hash)
- int argc;
- VALUE *argv;
- VALUE hash;
+rb_hash_values_at(int argc, VALUE *argv, VALUE hash)
{
VALUE result = rb_ary_new2(argc);
long i;
@@ -828,8 +774,7 @@ rb_hash_values_at(argc, argv, hash)
*/
VALUE
-rb_hash_select(hash)
- VALUE hash;
+rb_hash_select(VALUE hash)
{
VALUE result;
@@ -840,8 +785,7 @@ rb_hash_select(hash)
}
static int
-clear_i(key, value, dummy)
- VALUE key, value, dummy;
+clear_i(VALUE key, VALUE value, VALUE dummy)
{
return ST_DELETE;
}
@@ -858,8 +802,7 @@ clear_i(key, value, dummy)
*/
static VALUE
-rb_hash_clear(hash)
- VALUE hash;
+rb_hash_clear(VALUE hash)
{
rb_hash_modify(hash);
if (RHASH(hash)->tbl->num_entries > 0) {
@@ -888,8 +831,7 @@ rb_hash_clear(hash)
*/
VALUE
-rb_hash_aset(hash, key, val)
- VALUE hash, key, val;
+rb_hash_aset(VALUE hash, VALUE key, VALUE val)
{
rb_hash_modify(hash);
if (TYPE(key) != T_STRING || st_lookup(RHASH(hash)->tbl, key, 0)) {
@@ -902,8 +844,7 @@ rb_hash_aset(hash, key, val)
}
static int
-replace_i(key, val, hash)
- VALUE key, val, hash;
+replace_i(VALUE key, VALUE val, VALUE hash)
{
if (key != Qundef) {
rb_hash_aset(hash, key, val);
@@ -925,8 +866,7 @@ replace_i(key, val, hash)
*/
static VALUE
-rb_hash_replace(hash, hash2)
- VALUE hash, hash2;
+rb_hash_replace(VALUE hash, VALUE hash2)
{
hash2 = to_hash(hash2);
if (hash == hash2) return hash;
@@ -957,8 +897,7 @@ rb_hash_replace(hash, hash2)
*/
static VALUE
-rb_hash_size(hash)
- VALUE hash;
+rb_hash_size(VALUE hash)
{
return INT2FIX(RHASH(hash)->tbl->num_entries);
}
@@ -975,8 +914,7 @@ rb_hash_size(hash)
*/
static VALUE
-rb_hash_empty_p(hash)
- VALUE hash;
+rb_hash_empty_p(VALUE hash)
{
if (RHASH(hash)->tbl->num_entries == 0)
return Qtrue;
@@ -984,8 +922,7 @@ rb_hash_empty_p(hash)
}
static int
-each_value_i(key, value)
- VALUE key, value;
+each_value_i(VALUE key, VALUE value)
{
if (key == Qundef) return ST_CONTINUE;
rb_yield(value);
@@ -1009,8 +946,7 @@ each_value_i(key, value)
*/
static VALUE
-rb_hash_each_value(hash)
- VALUE hash;
+rb_hash_each_value(VALUE hash)
{
RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_value_i, 0);
@@ -1018,8 +954,7 @@ rb_hash_each_value(hash)
}
static int
-each_key_i(key, value)
- VALUE key, value;
+each_key_i(VALUE key, VALUE value)
{
if (key == Qundef) return ST_CONTINUE;
rb_yield(key);
@@ -1042,8 +977,7 @@ each_key_i(key, value)
* b
*/
static VALUE
-rb_hash_each_key(hash)
- VALUE hash;
+rb_hash_each_key(VALUE hash)
{
RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_key_i, 0);
@@ -1051,8 +985,7 @@ rb_hash_each_key(hash)
}
static int
-each_pair_i(key, value)
- VALUE key, value;
+each_pair_i(VALUE key, VALUE value)
{
if (key == Qundef) return ST_CONTINUE;
rb_yield_values(2, key, value);
@@ -1077,8 +1010,7 @@ each_pair_i(key, value)
*/
static VALUE
-rb_hash_each_pair(hash)
- VALUE hash;
+rb_hash_each_pair(VALUE hash)
{
RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_pair_i, 0);
@@ -1086,8 +1018,7 @@ rb_hash_each_pair(hash)
}
static int
-each_i(key, value)
- VALUE key, value;
+each_i(VALUE key, VALUE value)
{
if (key == Qundef) return ST_CONTINUE;
rb_yield(rb_assoc_new(key, value));
@@ -1115,8 +1046,7 @@ each_i(key, value)
*/
static VALUE
-rb_hash_each(hash)
- VALUE hash;
+rb_hash_each(VALUE hash)
{
RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_i, 0);
@@ -1124,8 +1054,7 @@ rb_hash_each(hash)
}
static int
-to_a_i(key, value, ary)
- VALUE key, value, ary;
+to_a_i(VALUE key, VALUE value, VALUE ary)
{
if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, rb_assoc_new(key, value));
@@ -1144,8 +1073,7 @@ to_a_i(key, value, ary)
*/
static VALUE
-rb_hash_to_a(hash)
- VALUE hash;
+rb_hash_to_a(VALUE hash)
{
VALUE ary;
@@ -1172,8 +1100,7 @@ rb_hash_to_a(hash)
*/
static VALUE
-rb_hash_sort(hash)
- VALUE hash;
+rb_hash_sort(VALUE hash)
{
VALUE entries = rb_hash_to_a(hash);
rb_ary_sort_bang(entries);
@@ -1181,8 +1108,7 @@ rb_hash_sort(hash)
}
static int
-inspect_i(key, value, str)
- VALUE key, value, str;
+inspect_i(VALUE key, VALUE value, VALUE str)
{
VALUE str2;
@@ -1202,9 +1128,7 @@ inspect_i(key, value, str)
}
static VALUE
-inspect_hash(hash, dummy, recur)
- VALUE hash, dummy;
- int recur;
+inspect_hash(VALUE hash, VALUE dummy, int recur)
{
VALUE str;
@@ -1225,8 +1149,7 @@ inspect_hash(hash, dummy, recur)
*/
static VALUE
-rb_hash_inspect(hash)
- VALUE hash;
+rb_hash_inspect(VALUE hash)
{
if (RHASH(hash)->tbl == 0 || RHASH(hash)->tbl->num_entries == 0)
return rb_str_new2("{}");
@@ -1234,9 +1157,7 @@ rb_hash_inspect(hash)
}
static VALUE
-to_s_hash(hash, dummy, recur)
- VALUE hash, dummy;
- int recur;
+to_s_hash(VALUE hash, VALUE dummy, int recur)
{
if (recur) return rb_str_new2("{...}");
return rb_ary_to_s(rb_hash_to_a(hash));
@@ -1256,8 +1177,7 @@ to_s_hash(hash, dummy, recur)
*/
static VALUE
-rb_hash_to_s(hash)
- VALUE hash;
+rb_hash_to_s(VALUE hash)
{
return rb_exec_recursive(to_s_hash, hash, 0);
}
@@ -1270,15 +1190,13 @@ rb_hash_to_s(hash)
*/
static VALUE
-rb_hash_to_hash(hash)
- VALUE hash;
+rb_hash_to_hash(VALUE hash)
{
return hash;
}
static int
-keys_i(key, value, ary)
- VALUE key, value, ary;
+keys_i(VALUE key, VALUE value, VALUE ary)
{
if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, key);
@@ -1298,8 +1216,7 @@ keys_i(key, value, ary)
*/
static VALUE
-rb_hash_keys(hash)
- VALUE hash;
+rb_hash_keys(VALUE hash)
{
VALUE ary;
@@ -1310,8 +1227,7 @@ rb_hash_keys(hash)
}
static int
-values_i(key, value, ary)
- VALUE key, value, ary;
+values_i(VALUE key, VALUE value, VALUE ary)
{
if (key == Qundef) return ST_CONTINUE;
rb_ary_push(ary, value);
@@ -1331,8 +1247,7 @@ values_i(key, value, ary)
*/
static VALUE
-rb_hash_values(hash)
- VALUE hash;
+rb_hash_values(VALUE hash)
{
VALUE ary;
@@ -1358,9 +1273,7 @@ rb_hash_values(hash)
*/
static VALUE
-rb_hash_has_key(hash, key)
- VALUE hash;
- VALUE key;
+rb_hash_has_key(VALUE hash, VALUE key)
{
if (st_lookup(RHASH(hash)->tbl, key, 0)) {
return Qtrue;
@@ -1369,8 +1282,7 @@ rb_hash_has_key(hash, key)
}
static int
-rb_hash_search_value(key, value, data)
- VALUE key, value, *data;
+rb_hash_search_value(VALUE key, VALUE value, VALUE *data)
{
if (key == Qundef) return ST_CONTINUE;
if (rb_equal(value, data[1])) {
@@ -1394,9 +1306,7 @@ rb_hash_search_value(key, value, data)
*/
static VALUE
-rb_hash_has_value(hash, val)
- VALUE hash;
- VALUE val;
+rb_hash_has_value(VALUE hash, VALUE val)
{
VALUE data[2];
@@ -1412,9 +1322,7 @@ struct equal_data {
};
static int
-equal_i(key, val1, data)
- VALUE key, val1;
- struct equal_data *data;
+equal_i(VALUE key, VALUE val1, struct equal_data *data)
{
VALUE val2;
@@ -1431,9 +1339,7 @@ equal_i(key, val1, data)
}
static VALUE
-hash_equal(hash1, hash2, eql)
- VALUE hash1, hash2;
- int eql; /* compare default value if true */
+hash_equal(VALUE hash1, VALUE hash2, int eql /* compare default value if true */)
{
struct equal_data data;
@@ -1479,16 +1385,13 @@ hash_equal(hash1, hash2, eql)
*/
static VALUE
-rb_hash_equal(hash1, hash2)
- VALUE hash1, hash2;
+rb_hash_equal(VALUE hash1, VALUE hash2)
{
return hash_equal(hash1, hash2, Qfalse);
}
static int
-rb_hash_invert_i(key, value, hash)
- VALUE key, value;
- VALUE hash;
+rb_hash_invert_i(VALUE key, VALUE value, VALUE hash)
{
if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, value, key);
@@ -1508,8 +1411,7 @@ rb_hash_invert_i(key, value, hash)
*/
static VALUE
-rb_hash_invert(hash)
- VALUE hash;
+rb_hash_invert(VALUE hash)
{
VALUE h = rb_hash_new();
@@ -1518,9 +1420,7 @@ rb_hash_invert(hash)
}
static int
-rb_hash_update_i(key, value, hash)
- VALUE key, value;
- VALUE hash;
+rb_hash_update_i(VALUE key, VALUE value, VALUE hash)
{
if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, key, value);
@@ -1528,9 +1428,7 @@ rb_hash_update_i(key, value, hash)
}
static int
-rb_hash_update_block_i(key, value, hash)
- VALUE key, value;
- VALUE hash;
+rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
{
if (key == Qundef) return ST_CONTINUE;
if (rb_hash_has_key(hash, key)) {
@@ -1561,8 +1459,7 @@ rb_hash_update_block_i(key, value, hash)
*/
static VALUE
-rb_hash_update(hash1, hash2)
- VALUE hash1, hash2;
+rb_hash_update(VALUE hash1, VALUE hash2)
{
hash2 = to_hash(hash2);
if (rb_block_given_p()) {
@@ -1591,8 +1488,7 @@ rb_hash_update(hash1, hash2)
*/
static VALUE
-rb_hash_merge(hash1, hash2)
- VALUE hash1, hash2;
+rb_hash_merge(VALUE hash1, VALUE hash2)
{
return rb_hash_update(rb_obj_dup(hash1), hash2);
}
@@ -1618,9 +1514,7 @@ extern char **environ;
#endif
static VALUE
-env_str_new(ptr, len)
- const char *ptr;
- long len;
+env_str_new(const char *ptr, long len)
{
VALUE str = rb_tainted_str_new(ptr, len);
@@ -1629,16 +1523,14 @@ env_str_new(ptr, len)
}
static VALUE
-env_str_new2(ptr)
- const char *ptr;
+env_str_new2(const char *ptr)
{
if (!ptr) return Qnil;
return env_str_new(ptr, strlen(ptr));
}
static VALUE
-env_delete(obj, name)
- VALUE obj, name;
+env_delete(VALUE obj, VALUE name)
{
char *nam, *val;
@@ -1667,8 +1559,7 @@ env_delete(obj, name)
}
static VALUE
-env_delete_m(obj, name)
- VALUE obj, name;
+env_delete_m(VALUE obj, VALUE name)
{
VALUE val;
@@ -1678,8 +1569,7 @@ env_delete_m(obj, name)
}
static VALUE
-rb_f_getenv(obj, name)
- VALUE obj, name;
+rb_f_getenv(VALUE obj, VALUE name)
{
char *nam, *env;
@@ -1708,9 +1598,7 @@ rb_f_getenv(obj, name)
}
static VALUE
-env_fetch(argc, argv)
- int argc;
- VALUE *argv;
+env_fetch(int argc, VALUE *argv)
{
VALUE key, if_none;
long block_given;
@@ -1745,14 +1633,13 @@ env_fetch(argc, argv)
}
static void
-path_tainted_p(path)
- char *path;
+path_tainted_p(char *path)
{
path_tainted = rb_path_check(path)?0:1;
}
int
-rb_env_path_tainted()
+rb_env_path_tainted(void)
{
if (path_tainted < 0) {
path_tainted_p(getenv(PATH_ENV));
@@ -1761,8 +1648,7 @@ rb_env_path_tainted()
}
static int
-envix(nam)
- const char *nam;
+envix(const char *nam)
{
register int i, len = strlen(nam);
char **env;
@@ -1783,9 +1669,7 @@ envix(nam)
}
void
-ruby_setenv(name, value)
- const char *name;
- const char *value;
+ruby_setenv(const char *name, const char *value)
{
#if defined(_WIN32)
/* The sane way to deal with the environment.
@@ -1865,15 +1749,13 @@ ruby_setenv(name, value)
}
void
-ruby_unsetenv(name)
- const char *name;
+ruby_unsetenv(const char *name)
{
ruby_setenv(name, 0);
}
static VALUE
-env_aset(obj, nm, val)
- VALUE obj, nm, val;
+env_aset(VALUE obj, VALUE nm, VALUE val)
{
char *name, *value;
@@ -1909,7 +1791,7 @@ env_aset(obj, nm, val)
}
static VALUE
-env_keys()
+env_keys(void)
{
char **env;
VALUE ary;
@@ -1929,8 +1811,7 @@ env_keys()
}
static VALUE
-env_each_key(ehash)
- VALUE ehash;
+env_each_key(VALUE ehash)
{
VALUE keys;
long i;
@@ -1945,7 +1826,7 @@ env_each_key(ehash)
}
static VALUE
-env_values()
+env_values(void)
{
VALUE ary;
char **env;
@@ -1965,8 +1846,7 @@ env_values()
}
static VALUE
-env_each_value(ehash)
- VALUE ehash;
+env_each_value(VALUE ehash)
{
VALUE values = env_values();
long i;
@@ -1981,9 +1861,7 @@ env_each_value(ehash)
}
static VALUE
-env_each_i(ehash, values)
- VALUE ehash;
- int values;
+env_each_i(VALUE ehash, int values)
{
char **env;
VALUE ary;
@@ -2014,23 +1892,21 @@ env_each_i(ehash, values)
}
static VALUE
-env_each(ehash)
- VALUE ehash;
+env_each(VALUE ehash)
{
RETURN_ENUMERATOR(ehash, 0, 0);
return env_each_i(ehash, Qfalse);
}
static VALUE
-env_each_pair(ehash)
- VALUE ehash;
+env_each_pair(VALUE ehash)
{
RETURN_ENUMERATOR(ehash, 0, 0);
return env_each_i(ehash, Qtrue);
}
static VALUE
-env_reject_bang()
+env_reject_bang(void)
{
volatile VALUE keys;
long i;
@@ -2053,16 +1929,14 @@ env_reject_bang()
}
static VALUE
-env_delete_if()
+env_delete_if(void)
{
env_reject_bang();
return envtbl;
}
static VALUE
-env_values_at(argc, argv)
- int argc;
- VALUE *argv;
+env_values_at(int argc, VALUE *argv)
{
VALUE result;
long i;
@@ -2076,8 +1950,7 @@ env_values_at(argc, argv)
}
static VALUE
-env_select(ehash)
- VALUE ehash;
+env_select(VALUE ehash)
{
VALUE result;
char **env;
@@ -2103,7 +1976,7 @@ env_select(ehash)
}
static VALUE
-env_clear()
+env_clear(void)
{
volatile VALUE keys;
long i;
@@ -2120,13 +1993,13 @@ env_clear()
}
static VALUE
-env_to_s()
+env_to_s(void)
{
return rb_str_new2("ENV");
}
static VALUE
-env_inspect()
+env_inspect(void)
{
char **env;
VALUE str, i;
@@ -2157,7 +2030,7 @@ env_inspect()
}
static VALUE
-env_to_a()
+env_to_a(void)
{
char **env;
VALUE ary;
@@ -2178,13 +2051,13 @@ env_to_a()
}
static VALUE
-env_none()
+env_none(void)
{
return Qnil;
}
static VALUE
-env_size()
+env_size(void)
{
int i;
char **env;
@@ -2198,7 +2071,7 @@ env_size()
}
static VALUE
-env_empty_p()
+env_empty_p(void)
{
char **env;
@@ -2213,8 +2086,7 @@ env_empty_p()
}
static VALUE
-env_has_key(env, key)
- VALUE env, key;
+env_has_key(VALUE env, VALUE key)
{
char *s;
@@ -2227,8 +2099,7 @@ env_has_key(env, key)
}
static VALUE
-env_has_value(dmy, value)
- VALUE dmy, value;
+env_has_value(VALUE dmy, VALUE value)
{
char **env;
@@ -2251,8 +2122,7 @@ env_has_value(dmy, value)
}
static VALUE
-env_key(dmy, value)
- VALUE dmy, value;
+env_key(VALUE dmy, VALUE value)
{
char **env;
VALUE str;
@@ -2277,15 +2147,14 @@ env_key(dmy, value)
}
static VALUE
-env_index(dmy, value)
- VALUE dmy, value;
+env_index(VALUE dmy, VALUE value)
{
rb_warn("ENV.index is deprecated; use ENV.key");
return env_key(dmy, value);
}
static VALUE
-env_to_hash()
+env_to_hash(void)
{
char **env;
VALUE hash;
@@ -2306,13 +2175,13 @@ env_to_hash()
}
static VALUE
-env_reject()
+env_reject(void)
{
return rb_hash_delete_if(env_to_hash());
}
static VALUE
-env_shift()
+env_shift(void)
{
char **env;
@@ -2332,14 +2201,13 @@ env_shift()
}
static VALUE
-env_invert()
+env_invert(void)
{
return rb_hash_invert(env_to_hash());
}
static int
-env_replace_i(key, val, keys)
- VALUE key, val, keys;
+env_replace_i(VALUE key, VALUE val, VALUE keys)
{
if (key != Qundef) {
env_aset(Qnil, key, val);
@@ -2351,8 +2219,7 @@ env_replace_i(key, val, keys)
}
static VALUE
-env_replace(env, hash)
- VALUE env, hash;
+env_replace(VALUE env, VALUE hash)
{
volatile VALUE keys;
long i;
@@ -2370,8 +2237,7 @@ env_replace(env, hash)
}
static int
-env_update_i(key, val)
- VALUE key, val;
+env_update_i(VALUE key, VALUE val)
{
if (key != Qundef) {
if (rb_block_given_p()) {
@@ -2383,8 +2249,7 @@ env_update_i(key, val)
}
static VALUE
-env_update(env, hash)
- VALUE env, hash;
+env_update(VALUE env, VALUE hash)
{
rb_secure(4);
if (env == hash) return env;
@@ -2407,7 +2272,7 @@ env_update(env, hash)
*/
void
-Init_Hash()
+Init_Hash(void)
{
id_hash = rb_intern("hash");
id_call = rb_intern("call");
diff --git a/inits.c b/inits.c
index cc6ea53c69..66a75ad83f 100644
--- a/inits.c
+++ b/inits.c
@@ -48,7 +48,7 @@ void Init_var_tables _((void));
void Init_version _((void));
void
-rb_call_inits()
+rb_call_inits(void)
{
Init_sym();
Init_var_tables();
diff --git a/io.c b/io.c
index 474e20b9fa..d7ee89713d 100644
--- a/io.c
+++ b/io.c
@@ -171,14 +171,13 @@ is_socket(fd, path)
#endif
void
-rb_eof_error()
+rb_eof_error(void)
{
rb_raise(rb_eEOFError, "end of file reached");
}
VALUE
-rb_io_taint_check(io)
- VALUE io;
+rb_io_taint_check(VALUE io)
{
if (!OBJ_TAINTED(io) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
@@ -187,8 +186,7 @@ rb_io_taint_check(io)
}
void
-rb_io_check_initialized(fptr)
- OpenFile *fptr;
+rb_io_check_initialized(OpenFile *fptr)
{
if (!fptr) {
rb_raise(rb_eIOError, "uninitialized stream");
@@ -196,8 +194,7 @@ rb_io_check_initialized(fptr)
}
void
-rb_io_check_closed(fptr)
- OpenFile *fptr;
+rb_io_check_closed(OpenFile *fptr)
{
rb_io_check_initialized(fptr);
if (fptr->fd < 0) {
@@ -208,15 +205,13 @@ rb_io_check_closed(fptr)
static int io_fflush _((OpenFile *));
static VALUE
-rb_io_get_io(io)
- VALUE io;
+rb_io_get_io(VALUE io)
{
return rb_convert_type(io, T_FILE, "IO", "to_io");
}
static VALUE
-rb_io_check_io(io)
- VALUE io;
+rb_io_check_io(VALUE io)
{
return rb_check_convert_type(io, T_FILE, "IO", "to_io");
}
@@ -264,8 +259,7 @@ io_ungetc(int c, OpenFile *fptr)
}
static OpenFile *
-flush_before_seek(fptr)
- OpenFile *fptr;
+flush_before_seek(OpenFile *fptr)
{
io_fflush(fptr);
io_unread(fptr);
@@ -284,8 +278,7 @@ flush_before_seek(fptr)
#define FMODE_SYNCWRITE (FMODE_SYNC|FMODE_WRITABLE)
void
-rb_io_check_readable(fptr)
- OpenFile *fptr;
+rb_io_check_readable(OpenFile *fptr)
{
rb_io_check_closed(fptr);
if (!(fptr->mode & FMODE_READABLE)) {
@@ -297,8 +290,7 @@ rb_io_check_readable(fptr)
}
void
-rb_io_check_writable(fptr)
- OpenFile *fptr;
+rb_io_check_writable(OpenFile *fptr)
{
rb_io_check_closed(fptr);
if (!(fptr->mode & FMODE_WRITABLE)) {
@@ -310,8 +302,7 @@ rb_io_check_writable(fptr)
}
int
-rb_read_pending(fp)
- FILE *fp;
+rb_read_pending(FILE *fp)
{
return STDIO_READ_DATA_PENDING(fp);
}
@@ -323,8 +314,7 @@ rb_io_read_pending(OpenFile *fptr)
}
void
-rb_read_check(fp)
- FILE *fp;
+rb_read_check(FILE *fp)
{
if (!STDIO_READ_DATA_PENDING(fp)) {
rb_thread_wait_fd(fileno(fp));
@@ -341,8 +331,7 @@ rb_io_read_check(OpenFile *fptr)
}
static int
-ruby_dup(orig)
- int orig;
+ruby_dup(int orig)
{
int fd;
@@ -359,10 +348,8 @@ ruby_dup(orig)
return fd;
}
-static VALUE io_alloc _((VALUE));
static VALUE
-io_alloc(klass)
- VALUE klass;
+io_alloc(VALUE klass)
{
NEWOBJ(io, struct RFile);
OBJSETUP(io, klass, T_FILE);
@@ -397,8 +384,7 @@ wsplit_p(OpenFile *fptr)
}
static int
-io_fflush(fptr)
- OpenFile *fptr;
+io_fflush(OpenFile *fptr)
{
int r, l;
int wbuf_off, wbuf_len;
@@ -453,8 +439,7 @@ wait_readable(p)
#endif
int
-rb_io_wait_readable(f)
- int f;
+rb_io_wait_readable(int f)
{
rb_fdset_t rfds;
@@ -497,8 +482,7 @@ wait_writable(p)
#endif
int
-rb_io_wait_writable(f)
- int f;
+rb_io_wait_writable(int f)
{
rb_fdset_t wfds;
@@ -531,9 +515,7 @@ rb_io_wait_writable(f)
/* writing functions */
static long
-io_fwrite(str, fptr)
- VALUE str;
- OpenFile *fptr;
+io_fwrite(VALUE str, OpenFile *fptr)
{
long len, n, r, l, offset = 0;
@@ -603,10 +585,7 @@ io_fwrite(str, fptr)
}
long
-rb_io_fwrite(ptr, len, f)
- const char *ptr;
- long len;
- FILE *f;
+rb_io_fwrite(const char *ptr, long len, FILE *f)
{
OpenFile of;
@@ -636,8 +615,7 @@ rb_io_fwrite(ptr, len, f)
*/
static VALUE
-io_write(io, str)
- VALUE io, str;
+io_write(VALUE io, VALUE str)
{
OpenFile *fptr;
long n;
@@ -663,8 +641,7 @@ io_write(io, str)
}
VALUE
-rb_io_write(io, str)
- VALUE io, str;
+rb_io_write(VALUE io, VALUE str)
{
return rb_funcall(io, id_write, 1, str);
}
@@ -686,8 +663,7 @@ rb_io_write(io, str)
VALUE
-rb_io_addstr(io, str)
- VALUE io, str;
+rb_io_addstr(VALUE io, VALUE str)
{
rb_io_write(io, str);
return io;
@@ -710,8 +686,7 @@ rb_io_addstr(io, str)
*/
VALUE
-rb_io_flush(io)
- VALUE io;
+rb_io_flush(VALUE io)
{
OpenFile *fptr;
@@ -745,8 +720,7 @@ rb_io_flush(io)
*/
static VALUE
-rb_io_tell(io)
- VALUE io;
+rb_io_tell(VALUE io)
{
OpenFile *fptr;
off_t pos;
@@ -758,9 +732,7 @@ rb_io_tell(io)
}
static VALUE
-rb_io_seek(io, offset, whence)
- VALUE io, offset;
- int whence;
+rb_io_seek(VALUE io, VALUE offset, int whence)
{
OpenFile *fptr;
off_t pos;
@@ -795,10 +767,7 @@ rb_io_seek(io, offset, whence)
*/
static VALUE
-rb_io_seek_m(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_seek_m(int argc, VALUE *argv, VALUE io)
{
VALUE offset, ptrname;
int whence = SEEK_SET;
@@ -822,8 +791,7 @@ rb_io_seek_m(argc, argv, io)
*/
static VALUE
-rb_io_set_pos(io, offset)
- VALUE io, offset;
+rb_io_set_pos(VALUE io, VALUE offset)
{
OpenFile *fptr;
off_t pos;
@@ -851,8 +819,7 @@ rb_io_set_pos(io, offset)
*/
static VALUE
-rb_io_rewind(io)
- VALUE io;
+rb_io_rewind(VALUE io)
{
OpenFile *fptr;
@@ -936,8 +903,7 @@ io_getc(OpenFile *fptr)
*/
VALUE
-rb_io_eof(io)
- VALUE io;
+rb_io_eof(VALUE io)
{
OpenFile *fptr;
int ch;
@@ -970,8 +936,7 @@ rb_io_eof(io)
*/
static VALUE
-rb_io_sync(io)
- VALUE io;
+rb_io_sync(VALUE io)
{
OpenFile *fptr;
@@ -995,8 +960,7 @@ rb_io_sync(io)
*/
static VALUE
-rb_io_set_sync(io, mode)
- VALUE io, mode;
+rb_io_set_sync(VALUE io, VALUE mode)
{
OpenFile *fptr;
@@ -1023,8 +987,7 @@ rb_io_set_sync(io, mode)
*/
static VALUE
-rb_io_fsync(io)
- VALUE io;
+rb_io_fsync(VALUE io)
{
#ifdef HAVE_FSYNC
OpenFile *fptr;
@@ -1054,8 +1017,7 @@ rb_io_fsync(io)
*/
static VALUE
-rb_io_fileno(io)
- VALUE io;
+rb_io_fileno(VALUE io)
{
OpenFile *fptr;
int fd;
@@ -1087,8 +1049,7 @@ rb_io_fileno(io)
*/
static VALUE
-rb_io_pid(io)
- VALUE io;
+rb_io_pid(VALUE io)
{
OpenFile *fptr;
@@ -1107,8 +1068,7 @@ rb_io_pid(io)
*/
static VALUE
-rb_io_inspect(obj)
- VALUE obj;
+rb_io_inspect(VALUE obj)
{
OpenFile *fptr;
char *buf, *cname, *st = "";
@@ -1130,8 +1090,7 @@ rb_io_inspect(obj)
*/
static VALUE
-rb_io_to_io(io)
- VALUE io;
+rb_io_to_io(VALUE io)
{
return io;
}
@@ -1152,10 +1111,7 @@ read_buffered_data(char *ptr, long len, OpenFile *fptr)
}
static long
-io_fread(str, offset, fptr)
- VALUE str;
- long offset;
- OpenFile *fptr;
+io_fread(VALUE str, long offset, OpenFile *fptr)
{
long len = RSTRING(str)->len - offset;
long n = len;
@@ -1181,10 +1137,7 @@ io_fread(str, offset, fptr)
}
long
-rb_io_fread(ptr, len, f)
- char *ptr;
- long len;
- FILE *f;
+rb_io_fread(char *ptr, long len, FILE *f)
{
OpenFile of;
VALUE str;
@@ -1202,8 +1155,7 @@ rb_io_fread(ptr, len, f)
#define SMALLBUF 100
static long
-remain_size(fptr)
- OpenFile *fptr;
+remain_size(OpenFile *fptr)
{
struct stat st;
off_t siz = READ_DATA_PENDING_COUNT(fptr);
@@ -1231,10 +1183,7 @@ remain_size(fptr)
}
static VALUE
-read_all(fptr, siz, str)
- OpenFile *fptr;
- long siz;
- VALUE str;
+read_all(OpenFile *fptr, long siz, VALUE str)
{
long bytes = 0;
long n;
@@ -1372,10 +1321,7 @@ io_getpartial(int argc, VALUE *argv, VALUE io)
*/
static VALUE
-io_readpartial(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+io_readpartial(int argc, VALUE *argv, VALUE io)
{
VALUE ret;
@@ -1409,10 +1355,7 @@ io_readpartial(argc, argv, io)
*/
static VALUE
-io_read(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+io_read(int argc, VALUE *argv, VALUE io)
{
OpenFile *fptr;
long n, len;
@@ -1463,10 +1406,7 @@ io_read(argc, argv, io)
}
static int
-appendline(fptr, delim, strp)
- OpenFile *fptr;
- int delim;
- VALUE *strp;
+appendline(OpenFile *fptr, int delim, VALUE *strp)
{
VALUE str = *strp;
int c = EOF;
@@ -1526,9 +1466,7 @@ appendline(fptr, delim, strp)
}
static inline int
-swallow(fptr, term)
- OpenFile *fptr;
- int term;
+swallow(OpenFile *fptr, int term)
{
int c;
@@ -1557,9 +1495,7 @@ swallow(fptr, term)
}
static VALUE
-rb_io_getline_fast(fptr, delim)
- OpenFile *fptr;
- unsigned char delim;
+rb_io_getline_fast(OpenFile *fptr, unsigned char delim)
{
VALUE str = Qnil;
int c;
@@ -1576,10 +1512,7 @@ rb_io_getline_fast(fptr, delim)
}
static int
-rscheck(rsptr, rslen, rs)
- char *rsptr;
- long rslen;
- VALUE rs;
+rscheck(char *rsptr, long rslen, VALUE rs)
{
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
rb_raise(rb_eRuntimeError, "rs modified");
@@ -1587,8 +1520,7 @@ rscheck(rsptr, rslen, rs)
}
static VALUE
-rb_io_getline(rs, io)
- VALUE rs, io;
+rb_io_getline(VALUE rs, VALUE io)
{
VALUE str = Qnil;
OpenFile *fptr;
@@ -1649,8 +1581,7 @@ rb_io_getline(rs, io)
}
VALUE
-rb_io_gets(io)
- VALUE io;
+rb_io_gets(VALUE io)
{
OpenFile *fptr;
@@ -1677,10 +1608,7 @@ rb_io_gets(io)
*/
static VALUE
-rb_io_gets_m(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_gets_m(int argc, VALUE *argv, VALUE io)
{
VALUE rs, str;
@@ -1717,8 +1645,7 @@ rb_io_gets_m(argc, argv, io)
*/
static VALUE
-rb_io_lineno(io)
- VALUE io;
+rb_io_lineno(VALUE io)
{
OpenFile *fptr;
@@ -1745,8 +1672,7 @@ rb_io_lineno(io)
*/
static VALUE
-rb_io_set_lineno(io, lineno)
- VALUE io, lineno;
+rb_io_set_lineno(VALUE io, VALUE lineno)
{
OpenFile *fptr;
@@ -1757,18 +1683,14 @@ rb_io_set_lineno(io, lineno)
}
static void
-lineno_setter(val, id, var)
- VALUE val;
- ID id;
- VALUE *var;
+lineno_setter(VALUE val, ID id, VALUE *var)
{
gets_lineno = NUM2INT(val);
*var = INT2FIX(gets_lineno);
}
static VALUE
-argf_set_lineno(argf, val)
- VALUE argf, val;
+argf_set_lineno(VALUE argf, VALUE val)
{
gets_lineno = NUM2INT(val);
lineno = INT2FIX(gets_lineno);
@@ -1776,7 +1698,7 @@ argf_set_lineno(argf, val)
}
static VALUE
-argf_lineno()
+argf_lineno(void)
{
return lineno;
}
@@ -1790,10 +1712,7 @@ argf_lineno()
*/
static VALUE
-rb_io_readline(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_readline(int argc, VALUE *argv, VALUE io)
{
VALUE line = rb_io_gets_m(argc, argv, io);
@@ -1819,10 +1738,7 @@ rb_io_readline(argc, argv, io)
*/
static VALUE
-rb_io_readlines(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_readlines(int argc, VALUE *argv, VALUE io)
{
VALUE line, ary;
VALUE rs;
@@ -1862,10 +1778,7 @@ rb_io_readlines(argc, argv, io)
*/
static VALUE
-rb_io_each_line(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_each_line(int argc, VALUE *argv, VALUE io)
{
VALUE str;
VALUE rs;
@@ -1899,8 +1812,7 @@ rb_io_each_line(argc, argv, io)
*/
static VALUE
-rb_io_each_byte(io)
- VALUE io;
+rb_io_each_byte(VALUE io)
{
OpenFile *fptr;
int c;
@@ -1933,8 +1845,7 @@ rb_io_each_byte(io)
*/
VALUE
-rb_io_getc(io)
- VALUE io;
+rb_io_getc(VALUE io)
{
OpenFile *fptr;
int c;
@@ -1952,8 +1863,7 @@ rb_io_getc(io)
}
int
-rb_getc(f)
- FILE *f;
+rb_getc(FILE *f)
{
int c;
@@ -1976,8 +1886,7 @@ rb_getc(f)
*/
static VALUE
-rb_io_readchar(io)
- VALUE io;
+rb_io_readchar(VALUE io)
{
VALUE c = rb_io_getc(io);
@@ -2004,8 +1913,7 @@ rb_io_readchar(io)
*/
VALUE
-rb_io_ungetc(io, c)
- VALUE io, c;
+rb_io_ungetc(VALUE io, VALUE c)
{
OpenFile *fptr;
int cc = NUM2INT(c);
@@ -2032,8 +1940,7 @@ rb_io_ungetc(io, c)
*/
static VALUE
-rb_io_isatty(io)
- VALUE io;
+rb_io_isatty(VALUE io)
{
OpenFile *fptr;
@@ -2048,9 +1955,7 @@ rb_io_isatty(io)
#define PREP_STDIO_NAME(f) ((f)->path)
static void
-fptr_finalize(fptr, noraise)
- OpenFile *fptr;
- int noraise;
+fptr_finalize(OpenFile *fptr, int noraise)
{
if (fptr->wbuf_len) {
io_fflush(fptr);
@@ -2079,9 +1984,7 @@ fptr_finalize(fptr, noraise)
}
static void
-rb_io_fptr_cleanup(fptr, noraise)
- OpenFile *fptr;
- int noraise;
+rb_io_fptr_cleanup(OpenFile *fptr, int noraise)
{
if (fptr->finalize) {
(*fptr->finalize)(fptr, noraise);
@@ -2092,8 +1995,7 @@ rb_io_fptr_cleanup(fptr, noraise)
}
int
-rb_io_fptr_finalize(fptr)
- OpenFile *fptr;
+rb_io_fptr_finalize(OpenFile *fptr)
{
if (!fptr) return 0;
if (fptr->refcnt <= 0 || --fptr->refcnt) return 0;
@@ -2116,8 +2018,7 @@ rb_io_fptr_finalize(fptr)
}
VALUE
-rb_io_close(io)
- VALUE io;
+rb_io_close(VALUE io)
{
OpenFile *fptr;
int fd;
@@ -2150,8 +2051,7 @@ rb_io_close(io)
*/
static VALUE
-rb_io_close_m(io)
- VALUE io;
+rb_io_close_m(VALUE io)
{
if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
rb_raise(rb_eSecurityError, "Insecure: can't close");
@@ -2162,8 +2062,7 @@ rb_io_close_m(io)
}
static VALUE
-io_close(io)
- VALUE io;
+io_close(VALUE io)
{
return rb_funcall(io, rb_intern("close"), 0, 0);
}
@@ -2188,8 +2087,7 @@ io_close(io)
static VALUE
-rb_io_closed(io)
- VALUE io;
+rb_io_closed(VALUE io)
{
OpenFile *fptr;
@@ -2217,8 +2115,7 @@ rb_io_closed(io)
*/
static VALUE
-rb_io_close_read(io)
- VALUE io;
+rb_io_close_read(VALUE io)
{
OpenFile *fptr;
@@ -2263,8 +2160,7 @@ rb_io_close_read(io)
*/
static VALUE
-rb_io_close_write(io)
- VALUE io;
+rb_io_close_write(VALUE io)
{
OpenFile *fptr;
@@ -2304,10 +2200,7 @@ rb_io_close_write(io)
*/
static VALUE
-rb_io_sysseek(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_sysseek(int argc, VALUE *argv, VALUE io)
{
VALUE offset, ptrname;
int whence = SEEK_SET;
@@ -2345,8 +2238,7 @@ rb_io_sysseek(argc, argv, io)
*/
static VALUE
-rb_io_syswrite(io, str)
- VALUE io, str;
+rb_io_syswrite(VALUE io, VALUE str)
{
OpenFile *fptr;
long n;
@@ -2388,10 +2280,7 @@ rb_io_syswrite(io, str)
*/
static VALUE
-rb_io_sysread(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_sysread(int argc, VALUE *argv, VALUE io)
{
VALUE len, str;
OpenFile *fptr;
@@ -2451,8 +2340,7 @@ rb_io_sysread(argc, argv, io)
*/
VALUE
-rb_io_binmode(io)
- VALUE io;
+rb_io_binmode(VALUE io)
{
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
OpenFile *fptr;
@@ -2470,8 +2358,7 @@ rb_io_binmode(io)
}
static char*
-rb_io_flags_mode(flags)
- int flags;
+rb_io_flags_mode(int flags)
{
#ifdef O_BINARY
# define MODE_BINMODE(a,b) ((flags & FMODE_BINMODE) ? (b) : (a))
@@ -2500,8 +2387,7 @@ rb_io_flags_mode(flags)
}
int
-rb_io_mode_flags(mode)
- const char *mode;
+rb_io_mode_flags(const char *mode)
{
int flags = 0;
const char *m = mode;
@@ -2538,8 +2424,7 @@ rb_io_mode_flags(mode)
}
int
-rb_io_modenum_flags(mode)
- int mode;
+rb_io_modenum_flags(int mode)
{
int flags = 0;
@@ -2571,8 +2456,7 @@ rb_io_modenum_flags(mode)
}
static int
-rb_io_mode_modenum(mode)
- const char *mode;
+rb_io_mode_modenum(const char *mode)
{
int flags = 0;
const char *m = mode;
@@ -2613,8 +2497,7 @@ rb_io_mode_modenum(mode)
#define MODENUM_MAX 4
static char*
-rb_io_modenum_mode(flags)
- int flags;
+rb_io_modenum_mode(int flags)
{
#ifdef O_BINARY
# define MODE_BINARY(a,b) ((flags & O_BINARY) ? (b) : (a))
@@ -2640,10 +2523,7 @@ rb_io_modenum_mode(flags)
}
static int
-rb_sysopen(fname, flags, mode)
- char *fname;
- int flags;
- unsigned int mode;
+rb_sysopen(char *fname, int flags, unsigned int mode)
{
int fd;
@@ -2661,9 +2541,7 @@ rb_sysopen(fname, flags, mode)
}
FILE *
-rb_fopen(fname, mode)
- const char *fname;
- const char *mode;
+rb_fopen(const char *fname, const char *mode)
{
FILE *file;
@@ -2688,9 +2566,7 @@ rb_fopen(fname, mode)
}
FILE *
-rb_fdopen(fd, mode)
- int fd;
- const char *mode;
+rb_fdopen(int fd, const char *mode)
{
FILE *file;
@@ -2736,9 +2612,7 @@ io_check_tty(OpenFile *fptr)
}
static VALUE
-rb_file_open_internal(io, fname, mode)
- VALUE io;
- const char *fname, *mode;
+rb_file_open_internal(VALUE io, const char *fname, const char *mode)
{
OpenFile *fptr;
@@ -2752,17 +2626,13 @@ rb_file_open_internal(io, fname, mode)
}
VALUE
-rb_file_open(fname, mode)
- const char *fname, *mode;
+rb_file_open(const char *fname, const char *mode)
{
return rb_file_open_internal(io_alloc(rb_cFile), fname, mode);
}
static VALUE
-rb_file_sysopen_internal(io, fname, flags, mode)
- VALUE io;
- char *fname;
- int flags, mode;
+rb_file_sysopen_internal(VALUE io, char *fname, int flags, int mode)
{
OpenFile *fptr;
@@ -2777,9 +2647,7 @@ rb_file_sysopen_internal(io, fname, flags, mode)
}
VALUE
-rb_file_sysopen(fname, flags, mode)
- const char *fname;
- int flags, mode;
+rb_file_sysopen(const char *fname, int flags, int mode)
{
return rb_file_sysopen_internal(io_alloc(rb_cFile), fname, flags, mode);
}
@@ -2791,8 +2659,7 @@ static struct pipe_list {
} *pipe_list;
static void
-pipe_add_fptr(fptr)
- OpenFile *fptr;
+pipe_add_fptr(OpenFile *fptr)
{
struct pipe_list *list;
@@ -2803,8 +2670,7 @@ pipe_add_fptr(fptr)
}
static void
-pipe_del_fptr(fptr)
- OpenFile *fptr;
+pipe_del_fptr(OpenFile *fptr)
{
struct pipe_list *list = pipe_list;
struct pipe_list *tmp;
@@ -2839,12 +2705,8 @@ pipe_atexit _((void))
}
}
-static void pipe_finalize _((OpenFile *fptr,int));
-
static void
-pipe_finalize(fptr, noraise)
- OpenFile *fptr;
- int noraise;
+pipe_finalize(OpenFile *fptr, int noraise)
{
#if !defined(HAVE_FORK) && !defined(_WIN32)
extern VALUE rb_last_status;
@@ -2866,15 +2728,13 @@ pipe_finalize(fptr, noraise)
#endif
void
-rb_io_synchronized(fptr)
- OpenFile *fptr;
+rb_io_synchronized(OpenFile *fptr)
{
fptr->mode |= FMODE_SYNC;
}
void
-rb_io_unbuffered(fptr)
- OpenFile *fptr;
+rb_io_unbuffered(OpenFile *fptr)
{
rb_io_synchronized(fptr);
}
@@ -2886,8 +2746,7 @@ struct popen_arg {
};
static void
-popen_redirect(p)
- struct popen_arg *p;
+popen_redirect(struct popen_arg *p)
{
if ((p->modef & FMODE_READABLE) && (p->modef & FMODE_WRITABLE)) {
close(p->pair[0]);
@@ -2932,10 +2791,7 @@ popen_exec(p)
#endif
static VALUE
-pipe_open(argc, argv, mode)
- int argc;
- VALUE *argv;
- char *mode;
+pipe_open(int argc, VALUE *argv, char *mode)
{
int modef = rb_io_mode_flags(mode);
int pid = 0;
@@ -3122,10 +2978,7 @@ pipe_open(argc, argv, mode)
*/
static VALUE
-rb_io_s_popen(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
{
char *mode;
VALUE pname, pmode, port, tmp;
@@ -3169,10 +3022,7 @@ rb_io_s_popen(argc, argv, klass)
}
static VALUE
-rb_open_file(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_open_file(int argc, VALUE *argv, VALUE io)
{
VALUE fname, vmode, perm;
char *mode;
@@ -3214,10 +3064,7 @@ rb_open_file(argc, argv, io)
*/
static VALUE
-rb_io_s_open(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_io_s_open(int argc, VALUE *argv, VALUE klass)
{
VALUE io = rb_class_new_instance(argc, argv, klass);
@@ -3240,9 +3087,7 @@ rb_io_s_open(argc, argv, klass)
*/
static VALUE
-rb_io_s_sysopen(argc, argv)
- int argc;
- VALUE *argv;
+rb_io_s_sysopen(int argc, VALUE *argv)
{
VALUE fname, vmode, perm;
int flags, fmode, fd;
@@ -3349,9 +3194,7 @@ rb_io_s_sysopen(argc, argv)
*/
static VALUE
-rb_f_open(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_open(int argc, VALUE *argv)
{
if (argc >= 1) {
ID to_open = rb_intern("to_open");
@@ -3380,8 +3223,7 @@ rb_f_open(argc, argv)
}
static VALUE
-rb_io_open(fname, mode)
- char *fname, *mode;
+rb_io_open(char *fname, char *mode)
{
if (fname[0] == '|') {
VALUE cmd = rb_str_new2(fname+1);
@@ -3393,8 +3235,7 @@ rb_io_open(fname, mode)
}
static VALUE
-io_reopen(io, nfile)
- VALUE io, nfile;
+io_reopen(VALUE io, VALUE nfile)
{
OpenFile *fptr, *orig;
int fd, fd2;
@@ -3496,10 +3337,7 @@ io_reopen(io, nfile)
*/
static VALUE
-rb_io_reopen(argc, argv, file)
- int argc;
- VALUE *argv;
- VALUE file;
+rb_io_reopen(int argc, VALUE *argv, VALUE file)
{
VALUE fname, nmode;
char *mode;
@@ -3568,8 +3406,7 @@ rb_io_reopen(argc, argv, file)
/* :nodoc: */
static VALUE
-rb_io_init_copy(dest, io)
- VALUE dest, io;
+rb_io_init_copy(VALUE dest, VALUE io)
{
OpenFile *fptr, *orig;
int fd;
@@ -3608,10 +3445,7 @@ rb_io_init_copy(dest, io)
*/
VALUE
-rb_io_printf(argc, argv, out)
- int argc;
- VALUE argv[];
- VALUE out;
+rb_io_printf(int argc, VALUE *argv, VALUE out)
{
rb_io_write(out, rb_f_sprintf(argc, argv));
return Qnil;
@@ -3629,9 +3463,7 @@ rb_io_printf(argc, argv, out)
*/
static VALUE
-rb_f_printf(argc, argv)
- int argc;
- VALUE argv[];
+rb_f_printf(int argc, VALUE *argv)
{
VALUE out;
@@ -3670,10 +3502,7 @@ rb_f_printf(argc, argv)
*/
VALUE
-rb_io_print(argc, argv, out)
- int argc;
- VALUE *argv;
- VALUE out;
+rb_io_print(int argc, VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -3728,9 +3557,7 @@ rb_io_print(argc, argv, out)
*/
static VALUE
-rb_f_print(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_print(int argc, VALUE *argv)
{
rb_io_print(argc, argv, rb_stdout);
return Qnil;
@@ -3753,8 +3580,7 @@ rb_f_print(argc, argv)
*/
static VALUE
-rb_io_putc(io, ch)
- VALUE io, ch;
+rb_io_putc(VALUE io, VALUE ch)
{
char c = NUM2CHR(ch);
@@ -3772,15 +3598,13 @@ rb_io_putc(io, ch)
*/
static VALUE
-rb_f_putc(recv, ch)
- VALUE recv, ch;
+rb_f_putc(VALUE recv, VALUE ch)
{
return rb_io_putc(rb_stdout, ch);
}
static VALUE
-io_puts_ary(ary, out, recur)
- VALUE ary, out;
+io_puts_ary(VALUE ary, VALUE out, int recur)
{
VALUE tmp;
long i;
@@ -3816,10 +3640,7 @@ io_puts_ary(ary, out, recur)
*/
VALUE
-rb_io_puts(argc, argv, out)
- int argc;
- VALUE *argv;
- VALUE out;
+rb_io_puts(int argc, VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -3861,17 +3682,14 @@ rb_io_puts(argc, argv, out)
*/
static VALUE
-rb_f_puts(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_puts(int argc, VALUE *argv)
{
rb_io_puts(argc, argv, rb_stdout);
return Qnil;
}
void
-rb_p(obj) /* for debug print within C code */
- VALUE obj;
+rb_p(VALUE obj) /* for debug print within C code */
{
rb_io_write(rb_stdout, rb_obj_as_string(rb_inspect(obj)));
rb_io_write(rb_stdout, rb_default_rs);
@@ -3895,9 +3713,7 @@ rb_p(obj) /* for debug print within C code */
*/
static VALUE
-rb_f_p(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_p(int argc, VALUE *argv)
{
int i;
@@ -3934,10 +3750,7 @@ rb_f_p(argc, argv)
*/
static VALUE
-rb_obj_display(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+rb_obj_display(int argc, VALUE *argv, VALUE self)
{
VALUE out;
@@ -3951,25 +3764,19 @@ rb_obj_display(argc, argv, self)
}
void
-rb_write_error2(mesg, len)
- const char *mesg;
- long len;
+rb_write_error2(const char *mesg, long len)
{
rb_io_write(rb_stderr, rb_str_new(mesg, len));
}
void
-rb_write_error(mesg)
- const char *mesg;
+rb_write_error(const char *mesg)
{
rb_write_error2(mesg, strlen(mesg));
}
static void
-must_respond_to(mid, val, id)
- ID mid;
- VALUE val;
- ID id;
+must_respond_to(ID mid, VALUE val, ID id)
{
if (!rb_respond_to(val, mid)) {
rb_raise(rb_eTypeError, "%s must have %s method, %s given",
@@ -3979,41 +3786,28 @@ must_respond_to(mid, val, id)
}
static void
-stdout_setter(val, id, variable)
- VALUE val;
- ID id;
- VALUE *variable;
+stdout_setter(VALUE val, ID id, VALUE *variable)
{
must_respond_to(id_write, val, id);
*variable = val;
}
static void
-defout_setter(val, id, variable)
- VALUE val;
- ID id;
- VALUE *variable;
+defout_setter(VALUE val, ID id, VALUE *variable)
{
stdout_setter(val, id, variable);
rb_warn("$defout is obsolete; use $stdout instead");
}
static void
-deferr_setter(val, id, variable)
- VALUE val;
- ID id;
- VALUE *variable;
+deferr_setter(VALUE val, ID id, VALUE *variable)
{
stdout_setter(val, id, variable);
rb_warn("$deferr is obsolete; use $stderr instead");
}
static VALUE
-prep_io(fd, mode, klass, path)
- int fd;
- int mode;
- VALUE klass;
- const char *path;
+prep_io(int fd, int mode, VALUE klass, const char *path)
{
OpenFile *fp;
VALUE io = io_alloc(klass);
@@ -4034,11 +3828,7 @@ prep_io(fd, mode, klass, path)
}
static VALUE
-prep_stdio(f, mode, klass, path)
- FILE *f;
- int mode;
- VALUE klass;
- const char *path;
+prep_stdio(FILE *f, int mode, VALUE klass, const char *path)
{
OpenFile *fptr;
VALUE io = prep_io(fileno(f), mode|FMODE_PREP, klass, path);
@@ -4079,10 +3869,7 @@ FILE *rb_io_stdio_file(OpenFile *fptr)
*/
static VALUE
-rb_io_initialize(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_initialize(int argc, VALUE *argv, VALUE io)
{
VALUE fnum, mode, orig;
OpenFile *fp, *ofp = NULL;
@@ -4165,10 +3952,7 @@ rb_io_initialize(argc, argv, io)
*/
static VALUE
-rb_file_initialize(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_file_initialize(int argc, VALUE *argv, VALUE io)
{
if (RFILE(io)->fptr) {
rb_raise(rb_eRuntimeError, "reinitializing File");
@@ -4205,10 +3989,7 @@ rb_file_initialize(argc, argv, io)
*/
static VALUE
-rb_io_s_new(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_io_s_new(int argc, VALUE *argv, VALUE klass)
{
if (rb_block_given_p()) {
char *cname = rb_class2name(klass);
@@ -4229,10 +4010,7 @@ rb_io_s_new(argc, argv, klass)
*/
static VALUE
-rb_io_s_for_fd(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_io_s_for_fd(int argc, VALUE *argv, VALUE klass)
{
VALUE io = rb_obj_alloc(klass);
rb_io_initialize(argc, argv, io);
@@ -4242,9 +4020,7 @@ rb_io_s_for_fd(argc, argv, klass)
static int binmode = 0;
static VALUE
-argf_forward(argc, argv)
- int argc;
- VALUE *argv;
+argf_forward(int argc, VALUE *argv)
{
return rb_funcall3(current_file, rb_frame_this_func(), argc, argv);
}
@@ -4259,8 +4035,7 @@ argf_forward(argc, argv)
} while (0)
static void
-argf_close(file)
- VALUE file;
+argf_close(VALUE file)
{
if (TYPE(file) == T_FILE)
rb_io_close(file);
@@ -4269,7 +4044,7 @@ argf_close(file)
}
static int
-next_argv()
+next_argv(void)
{
extern VALUE rb_argv;
char *fn;
@@ -4387,9 +4162,7 @@ next_argv()
}
static VALUE
-argf_getline(argc, argv)
- int argc;
- VALUE *argv;
+argf_getline(int argc, VALUE *argv)
{
VALUE line;
@@ -4452,9 +4225,7 @@ argf_getline(argc, argv)
*/
static VALUE
-rb_f_gets(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_gets(int argc, VALUE *argv)
{
VALUE line;
@@ -4470,7 +4241,7 @@ rb_f_gets(argc, argv)
}
VALUE
-rb_gets()
+rb_gets(void)
{
VALUE line;
@@ -4504,9 +4275,7 @@ rb_gets()
*/
static VALUE
-rb_f_readline(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_readline(int argc, VALUE *argv)
{
VALUE line;
@@ -4524,7 +4293,7 @@ rb_f_readline(argc, argv)
* obsolete
*/
static VALUE
-rb_f_getc()
+rb_f_getc(void)
{
rb_warn("getc is obsolete; use STDIN.getc instead");
if (TYPE(rb_stdin) != T_FILE) {
@@ -4542,9 +4311,7 @@ rb_f_getc()
*/
static VALUE
-rb_f_readlines(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_readlines(int argc, VALUE *argv)
{
VALUE line, ary;
@@ -4572,8 +4339,7 @@ rb_f_readlines(argc, argv)
*/
static VALUE
-rb_f_backquote(obj, str)
- VALUE obj, str;
+rb_f_backquote(VALUE obj, VALUE str)
{
VALUE port, result;
OpenFile *fptr;
@@ -4594,10 +4360,7 @@ rb_f_backquote(obj, str)
#endif
static VALUE
-select_internal(read, write, except, tp, fds)
- VALUE read, write, except;
- struct timeval *tp;
- rb_fdset_t *fds;
+select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fdset_t *fds)
{
VALUE res, list;
fd_set *rp, *wp, *ep;
@@ -4742,10 +4505,7 @@ select_end(arg)
*/
static VALUE
-rb_f_select(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_f_select(int argc, VALUE *argv, VALUE obj)
{
VALUE timeout;
struct select_args args;
@@ -4775,9 +4535,7 @@ rb_f_select(argc, argv, obj)
#if !defined(MSDOS) && !defined(__human68k__)
static int
-io_cntl(fd, cmd, narg, io_p)
- int fd, cmd, io_p;
- long narg;
+io_cntl(int fd, int cmd, long narg, int io_p)
{
int retval;
@@ -4802,9 +4560,7 @@ io_cntl(fd, cmd, narg, io_p)
#endif
static VALUE
-rb_io_ctl(io, req, arg, io_p)
- VALUE io, req, arg;
- int io_p;
+rb_io_ctl(VALUE io, VALUE req, VALUE arg, int io_p)
{
#if !defined(MSDOS) && !defined(__human68k__)
int cmd = NUM2ULONG(req);
@@ -4892,10 +4648,7 @@ rb_io_ctl(io, req, arg, io_p)
*/
static VALUE
-rb_io_ioctl(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_ioctl(int argc, VALUE *argv, VALUE io)
{
VALUE req, arg;
@@ -4917,10 +4670,7 @@ rb_io_ioctl(argc, argv, io)
*/
static VALUE
-rb_io_fcntl(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_fcntl(int argc, VALUE *argv, VALUE io)
{
#ifdef HAVE_FCNTL
VALUE req, arg;
@@ -4953,9 +4703,7 @@ rb_io_fcntl(argc, argv, io)
*/
static VALUE
-rb_f_syscall(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_syscall(int argc, VALUE *argv)
{
#if defined(HAVE_SYSCALL) && !defined(__CHECKER__)
#ifdef atarist
@@ -5053,10 +4801,8 @@ rb_f_syscall(argc, argv)
#endif
}
-static VALUE io_new_instance _((VALUE));
static VALUE
-io_new_instance(args)
- VALUE args;
+io_new_instance(VALUE args)
{
return rb_class_new_instance(2, (VALUE*)args+1, *(VALUE*)args);
}
@@ -5098,8 +4844,7 @@ io_new_instance(args)
*/
static VALUE
-rb_io_s_pipe(klass)
- VALUE klass;
+rb_io_s_pipe(VALUE klass)
{
#ifndef __human68k__
int pipes[2], state;
@@ -5145,8 +4890,7 @@ struct foreach_arg {
};
static VALUE
-io_s_foreach(arg)
- struct foreach_arg *arg;
+io_s_foreach(struct foreach_arg *arg)
{
VALUE str;
@@ -5174,10 +4918,7 @@ io_s_foreach(arg)
*/
static VALUE
-rb_io_s_foreach(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+rb_io_s_foreach(int argc, VALUE *argv, VALUE self)
{
VALUE fname;
struct foreach_arg arg;
@@ -5198,8 +4939,7 @@ rb_io_s_foreach(argc, argv, self)
}
static VALUE
-io_s_readlines(arg)
- struct foreach_arg *arg;
+io_s_readlines(struct foreach_arg *arg)
{
return rb_io_readlines(arg->argc, &arg->sep, arg->io);
}
@@ -5218,10 +4958,7 @@ io_s_readlines(arg)
*/
static VALUE
-rb_io_s_readlines(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_s_readlines(int argc, VALUE *argv, VALUE io)
{
VALUE fname;
struct foreach_arg arg;
@@ -5235,8 +4972,7 @@ rb_io_s_readlines(argc, argv, io)
}
static VALUE
-io_s_read(arg)
- struct foreach_arg *arg;
+io_s_read(struct foreach_arg *arg)
{
return io_read(arg->argc, &arg->sep, arg->io);
}
@@ -5255,10 +4991,7 @@ io_s_read(arg)
*/
static VALUE
-rb_io_s_read(argc, argv, io)
- int argc;
- VALUE *argv;
- VALUE io;
+rb_io_s_read(int argc, VALUE *argv, VALUE io)
{
VALUE fname, offset;
struct foreach_arg arg;
@@ -5275,7 +5008,7 @@ rb_io_s_read(argc, argv, io)
}
static VALUE
-argf_tell()
+argf_tell(void)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to tell");
@@ -5285,10 +5018,7 @@ argf_tell()
}
static VALUE
-argf_seek_m(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+argf_seek_m(int argc, VALUE *argv, VALUE self)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to seek");
@@ -5298,8 +5028,7 @@ argf_seek_m(argc, argv, self)
}
static VALUE
-argf_set_pos(self, offset)
- VALUE self, offset;
+argf_set_pos(VALUE self, VALUE offset)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to set position");
@@ -5309,7 +5038,7 @@ argf_set_pos(self, offset)
}
static VALUE
-argf_rewind()
+argf_rewind(void)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to rewind");
@@ -5319,7 +5048,7 @@ argf_rewind()
}
static VALUE
-argf_fileno()
+argf_fileno(void)
{
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream");
@@ -5329,7 +5058,7 @@ argf_fileno()
}
static VALUE
-argf_to_io()
+argf_to_io(void)
{
next_argv();
ARGF_FORWARD(0, 0);
@@ -5337,7 +5066,7 @@ argf_to_io()
}
static VALUE
-argf_eof()
+argf_eof(void)
{
if (current_file) {
if (init_p == 0) return Qtrue;
@@ -5350,9 +5079,7 @@ argf_eof()
}
static VALUE
-argf_read(argc, argv)
- int argc;
- VALUE *argv;
+argf_read(int argc, VALUE *argv)
{
VALUE tmp, str, length;
long len = 0;
@@ -5441,7 +5168,7 @@ argf_readpartial(int argc, VALUE *argv)
}
static VALUE
-argf_getc()
+argf_getc(void)
{
VALUE byte;
@@ -5463,7 +5190,7 @@ argf_getc()
}
static VALUE
-argf_readchar()
+argf_readchar(void)
{
VALUE c;
@@ -5476,10 +5203,7 @@ argf_readchar()
}
static VALUE
-argf_each_line(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+argf_each_line(int argc, VALUE *argv, VALUE self)
{
VALUE str;
@@ -5499,8 +5223,7 @@ argf_each_line(argc, argv, self)
}
static VALUE
-argf_each_byte(self)
- VALUE self;
+argf_each_byte(VALUE self)
{
VALUE byte;
@@ -5512,21 +5235,21 @@ argf_each_byte(self)
}
static VALUE
-argf_filename()
+argf_filename(void)
{
next_argv();
return filename;
}
static VALUE
-argf_file()
+argf_file(void)
{
next_argv();
return current_file;
}
static VALUE
-argf_binmode()
+argf_binmode(void)
{
binmode = 1;
next_argv();
@@ -5536,7 +5259,7 @@ argf_binmode()
}
static VALUE
-argf_skip()
+argf_skip(void)
{
if (next_p != -1) {
argf_close(current_file);
@@ -5546,7 +5269,7 @@ argf_skip()
}
static VALUE
-argf_close_m()
+argf_close_m(void)
{
next_argv();
argf_close(current_file);
@@ -5558,7 +5281,7 @@ argf_close_m()
}
static VALUE
-argf_closed()
+argf_closed(void)
{
next_argv();
ARGF_FORWARD(0, 0);
@@ -5566,21 +5289,20 @@ argf_closed()
}
static VALUE
-argf_to_s()
+argf_to_s(void)
{
return rb_str_new2("ARGF");
}
static VALUE
-opt_i_get()
+opt_i_get(void)
{
if (!ruby_inplace_mode) return Qnil;
return rb_str_new2(ruby_inplace_mode);
}
static void
-opt_i_set(val)
- VALUE val;
+opt_i_set(VALUE val)
{
if (!RTEST(val)) {
if (ruby_inplace_mode) free(ruby_inplace_mode);
@@ -5670,7 +5392,7 @@ opt_i_set(val)
*/
void
-Init_IO()
+Init_IO(void)
{
#ifdef __CYGWIN__
#include <sys/cygwin.h>
diff --git a/main.c b/main.c
index cffbe25120..16cd6ca2ea 100644
--- a/main.c
+++ b/main.c
@@ -22,9 +22,7 @@ static void objcdummyfunction( void ) { objc_msgSend(); }
#endif
int
-main(argc, argv, envp)
- int argc;
- char **argv, **envp;
+main(int argc, char **argv, char **envp)
{
#ifdef _WIN32
NtInitialize(&argc, &argv);
diff --git a/marshal.c b/marshal.c
index 3791c4c79a..703b91755d 100644
--- a/marshal.c
+++ b/marshal.c
@@ -31,9 +31,7 @@
#define SHORTLEN(x) (x)
#else
static int
-shortlen(len, ds)
- long len;
- BDIGIT *ds;
+shortlen(long len, BDIGIT *ds)
{
BDIGIT num;
int offset = 0;
@@ -99,8 +97,7 @@ struct dump_call_arg {
};
static VALUE
-class2path(klass)
- VALUE klass;
+class2path(VALUE klass)
{
VALUE path = rb_class_path(klass);
char *n = RSTRING(path)->ptr;
@@ -119,10 +116,7 @@ class2path(klass)
static void w_long _((long, struct dump_arg*));
static void
-w_nbyte(s, n, arg)
- char *s;
- int n;
- struct dump_arg *arg;
+w_nbyte(char *s, int n, struct dump_arg *arg)
{
VALUE buf = arg->str;
rb_str_buf_cat(buf, s, n);
@@ -134,36 +128,27 @@ w_nbyte(s, n, arg)
}
static void
-w_byte(c, arg)
- char c;
- struct dump_arg *arg;
+w_byte(char c, struct dump_arg *arg)
{
w_nbyte(&c, 1, arg);
}
static void
-w_bytes(s, n, arg)
- char *s;
- int n;
- struct dump_arg *arg;
+w_bytes(char *s, int n, struct dump_arg *arg)
{
w_long(n, arg);
w_nbyte(s, n, arg);
}
static void
-w_short(x, arg)
- int x;
- struct dump_arg *arg;
+w_short(int x, struct dump_arg *arg)
{
w_byte((x >> 0) & 0xff, arg);
w_byte((x >> 8) & 0xff, arg);
}
static void
-w_long(x, arg)
- long x;
- struct dump_arg *arg;
+w_long(long x, struct dump_arg *arg)
{
char buf[sizeof(long)+1];
int i, len = 0;
@@ -219,9 +204,7 @@ w_long(x, arg)
#endif
static int
-save_mantissa(d, buf)
- double d;
- char *buf;
+save_mantissa(double d, char *buf)
{
int e, i = 0;
unsigned long m;
@@ -250,10 +233,7 @@ save_mantissa(d, buf)
}
static double
-load_mantissa(d, buf, len)
- double d;
- const char *buf;
- int len;
+load_mantissa(double d, const char *buf, int len)
{
if (--len > 0 && !*buf++) { /* binary mantissa mark */
int e, s = d < 0, dig = 0;
@@ -294,9 +274,7 @@ load_mantissa(d, buf, len)
#endif
static void
-w_float(d, arg)
- double d;
- struct dump_arg *arg;
+w_float(double d, struct dump_arg *arg)
{
char buf[100];
@@ -324,9 +302,7 @@ w_float(d, arg)
}
static void
-w_symbol(id, arg)
- ID id;
- struct dump_arg *arg;
+w_symbol(ID id, struct dump_arg *arg)
{
char *sym = rb_id2name(id);
st_data_t num;
@@ -343,9 +319,7 @@ w_symbol(id, arg)
}
static void
-w_unique(s, arg)
- char *s;
- struct dump_arg *arg;
+w_unique(char *s, struct dump_arg *arg)
{
if (s[0] == '#') {
rb_raise(rb_eTypeError, "can't dump anonymous class %s", s);
@@ -356,9 +330,7 @@ w_unique(s, arg)
static void w_object _((VALUE,struct dump_arg*,int));
static int
-hash_each(key, value, arg)
- VALUE key, value;
- struct dump_call_arg *arg;
+hash_each(VALUE key, VALUE value, struct dump_call_arg *arg)
{
w_object(key, arg->arg, arg->limit);
w_object(value, arg->arg, arg->limit);
@@ -366,10 +338,7 @@ hash_each(key, value, arg)
}
static void
-w_extended(klass, arg, check)
- VALUE klass;
- struct dump_arg *arg;
- int check;
+w_extended(VALUE klass, struct dump_arg *arg, int check)
{
char *path;
@@ -389,11 +358,7 @@ w_extended(klass, arg, check)
}
static void
-w_class(type, obj, arg, check)
- int type;
- VALUE obj;
- struct dump_arg *arg;
- int check;
+w_class(int type, VALUE obj, struct dump_arg *arg, int check)
{
char *path;
@@ -405,9 +370,7 @@ w_class(type, obj, arg, check)
}
static void
-w_uclass(obj, base_klass, arg)
- VALUE obj, base_klass;
- struct dump_arg *arg;
+w_uclass(VALUE obj, VALUE base_klass, struct dump_arg *arg)
{
VALUE klass = CLASS_OF(obj);
@@ -420,10 +383,7 @@ w_uclass(obj, base_klass, arg)
}
static int
-w_obj_each(id, value, arg)
- ID id;
- VALUE value;
- struct dump_call_arg *arg;
+w_obj_each(ID id, VALUE value, struct dump_call_arg *arg)
{
w_symbol(id, arg->arg);
w_object(value, arg->arg, arg->limit);
@@ -431,9 +391,7 @@ w_obj_each(id, value, arg)
}
static void
-w_ivar(tbl, arg)
- st_table *tbl;
- struct dump_call_arg *arg;
+w_ivar(st_table *tbl, struct dump_call_arg *arg)
{
if (tbl) {
w_long(tbl->num_entries, arg->arg);
@@ -445,10 +403,7 @@ w_ivar(tbl, arg)
}
static void
-w_object(obj, arg, limit)
- VALUE obj;
- struct dump_arg *arg;
- int limit;
+w_object(VALUE obj, struct dump_arg *arg, int limit)
{
struct dump_call_arg c_arg;
st_table *ivtbl = 0;
@@ -675,8 +630,7 @@ w_object(obj, arg, limit)
}
static VALUE
-dump(arg)
- struct dump_call_arg *arg;
+dump(struct dump_call_arg *arg)
{
w_object(arg->obj, arg->arg, arg->limit);
if (arg->arg->dest) {
@@ -687,8 +641,7 @@ dump(arg)
}
static VALUE
-dump_ensure(arg)
- struct dump_arg *arg;
+dump_ensure(struct dump_arg *arg)
{
st_free_table(arg->symbols);
st_free_table(arg->data);
@@ -725,9 +678,7 @@ dump_ensure(arg)
* obj.sayHello #=> "hello\n"
*/
static VALUE
-marshal_dump(argc, argv)
- int argc;
- VALUE* argv;
+marshal_dump(int argc, VALUE *argv)
{
VALUE obj, port, a1, a2;
int limit = -1;
@@ -790,8 +741,7 @@ struct load_arg {
static VALUE r_object _((struct load_arg *arg));
static int
-r_byte(arg)
- struct load_arg *arg;
+r_byte(struct load_arg *arg)
{
int c;
@@ -813,8 +763,7 @@ r_byte(arg)
}
static void
-long_toobig(size)
- int size;
+long_toobig(int size)
{
rb_raise(rb_eTypeError, "long too big for this architecture (size %d, given %d)",
sizeof(long), size);
@@ -829,8 +778,7 @@ long_toobig(size)
#endif
static long
-r_long(arg)
- struct load_arg *arg;
+r_long(struct load_arg *arg)
{
register long x;
int c = SIGN_EXTEND_CHAR(r_byte(arg));
@@ -865,9 +813,7 @@ r_long(arg)
#define r_bytes(arg) r_bytes0(r_long(arg), (arg))
static VALUE
-r_bytes0(len, arg)
- long len;
- struct load_arg *arg;
+r_bytes0(long len, struct load_arg *arg)
{
VALUE str;
@@ -895,8 +841,7 @@ r_bytes0(len, arg)
}
static ID
-r_symlink(arg)
- struct load_arg *arg;
+r_symlink(struct load_arg *arg)
{
ID id;
long num = r_long(arg);
@@ -908,8 +853,7 @@ r_symlink(arg)
}
static ID
-r_symreal(arg)
- struct load_arg *arg;
+r_symreal(struct load_arg *arg)
{
ID id;
@@ -920,8 +864,7 @@ r_symreal(arg)
}
static ID
-r_symbol(arg)
- struct load_arg *arg;
+r_symbol(struct load_arg *arg)
{
if (r_byte(arg) == TYPE_SYMLINK) {
return r_symlink(arg);
@@ -930,23 +873,19 @@ r_symbol(arg)
}
static char*
-r_unique(arg)
- struct load_arg *arg;
+r_unique(struct load_arg *arg)
{
return rb_id2name(r_symbol(arg));
}
static VALUE
-r_string(arg)
- struct load_arg *arg;
+r_string(struct load_arg *arg)
{
return r_bytes(arg);
}
static VALUE
-r_entry(v, arg)
- VALUE v;
- struct load_arg *arg;
+r_entry(VALUE v, struct load_arg *arg)
{
rb_hash_aset(arg->data, INT2FIX(RHASH(arg->data)->tbl->num_entries), v);
if (arg->taint) OBJ_TAINT(v);
@@ -954,9 +893,7 @@ r_entry(v, arg)
}
static void
-r_ivar(obj, arg)
- VALUE obj;
- struct load_arg *arg;
+r_ivar(VALUE obj, struct load_arg *arg)
{
long len;
@@ -971,8 +908,7 @@ r_ivar(obj, arg)
}
static VALUE
-path2class(path)
- char *path;
+path2class(char *path)
{
VALUE v = rb_path2class(path);
@@ -983,8 +919,7 @@ path2class(path)
}
static VALUE
-path2module(path)
- char *path;
+path2module(char *path)
{
VALUE v = rb_path2class(path);
@@ -995,11 +930,7 @@ path2module(path)
}
static VALUE
-r_object0(arg, proc, ivp, extmod)
- struct load_arg *arg;
- VALUE proc;
- int *ivp;
- VALUE extmod;
+r_object0(struct load_arg *arg, VALUE proc, int *ivp, VALUE extmod)
{
VALUE v = Qnil;
int type = r_byte(arg);
@@ -1350,22 +1281,19 @@ r_object0(arg, proc, ivp, extmod)
}
static VALUE
-r_object(arg)
- struct load_arg *arg;
+r_object(struct load_arg *arg)
{
return r_object0(arg, arg->proc, 0, Qnil);
}
static VALUE
-load(arg)
- struct load_arg *arg;
+load(struct load_arg *arg)
{
return r_object(arg);
}
static VALUE
-load_ensure(arg)
- struct load_arg *arg;
+load_ensure(struct load_arg *arg)
{
st_free_table(arg->symbols);
return 0;
@@ -1383,9 +1311,7 @@ load_ensure(arg)
* is deserialized.
*/
static VALUE
-marshal_load(argc, argv)
- int argc;
- VALUE *argv;
+marshal_load(int argc, VALUE *argv)
{
VALUE port, proc;
int major, minor;
@@ -1465,7 +1391,7 @@ marshal_load(argc, argv)
* The class method _load should take a String and return an object of this class.
*/
void
-Init_marshal()
+Init_marshal(void)
{
VALUE rb_mMarshal = rb_define_module("Marshal");
@@ -1490,8 +1416,7 @@ Init_marshal()
}
VALUE
-rb_marshal_dump(obj, port)
- VALUE obj, port;
+rb_marshal_dump(VALUE obj, VALUE port)
{
int argc = 1;
VALUE argv[2];
@@ -1503,8 +1428,7 @@ rb_marshal_dump(obj, port)
}
VALUE
-rb_marshal_load(port)
- VALUE port;
+rb_marshal_load(VALUE port)
{
return marshal_load(1, &port);
}
diff --git a/math.c b/math.c
index 5b9294e781..9235cb1306 100644
--- a/math.c
+++ b/math.c
@@ -33,8 +33,7 @@ VALUE rb_mMath;
*/
static VALUE
-math_atan2(obj, y, x)
- VALUE obj, x, y;
+math_atan2(VALUE obj, VALUE y, VALUE x)
{
Need_Float2(y, x);
return rb_float_new(atan2(RFLOAT(y)->value, RFLOAT(x)->value));
@@ -51,8 +50,7 @@ math_atan2(obj, y, x)
*/
static VALUE
-math_cos(obj, x)
- VALUE obj, x;
+math_cos(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(cos(RFLOAT(x)->value));
@@ -67,8 +65,7 @@ math_cos(obj, x)
*/
static VALUE
-math_sin(obj, x)
- VALUE obj, x;
+math_sin(VALUE obj, VALUE x)
{
Need_Float(x);
@@ -84,8 +81,7 @@ math_sin(obj, x)
*/
static VALUE
-math_tan(obj, x)
- VALUE obj, x;
+math_tan(VALUE obj, VALUE x)
{
Need_Float(x);
@@ -100,8 +96,7 @@ math_tan(obj, x)
*/
static VALUE
-math_acos(obj, x)
- VALUE obj, x;
+math_acos(VALUE obj, VALUE x)
{
double d;
@@ -122,8 +117,7 @@ math_acos(obj, x)
*/
static VALUE
-math_asin(obj, x)
- VALUE obj, x;
+math_asin(VALUE obj, VALUE x)
{
double d;
@@ -144,8 +138,7 @@ math_asin(obj, x)
*/
static VALUE
-math_atan(obj, x)
- VALUE obj, x;
+math_atan(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(atan(RFLOAT(x)->value));
@@ -168,8 +161,7 @@ cosh(x)
*/
static VALUE
-math_cosh(obj, x)
- VALUE obj, x;
+math_cosh(VALUE obj, VALUE x)
{
Need_Float(x);
@@ -194,8 +186,7 @@ sinh(x)
*/
static VALUE
-math_sinh(obj, x)
- VALUE obj, x;
+math_sinh(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(sinh(RFLOAT(x)->value));
@@ -219,8 +210,7 @@ tanh(x)
*/
static VALUE
-math_tanh(obj, x)
- VALUE obj, x;
+math_tanh(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(tanh(RFLOAT(x)->value));
@@ -234,8 +224,7 @@ math_tanh(obj, x)
*/
static VALUE
-math_acosh(obj, x)
- VALUE obj, x;
+math_acosh(VALUE obj, VALUE x)
{
double d;
@@ -256,8 +245,7 @@ math_acosh(obj, x)
*/
static VALUE
-math_asinh(obj, x)
- VALUE obj, x;
+math_asinh(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(asinh(RFLOAT(x)->value));
@@ -271,8 +259,7 @@ math_asinh(obj, x)
*/
static VALUE
-math_atanh(obj, x)
- VALUE obj, x;
+math_atanh(VALUE obj, VALUE x)
{
double d;
@@ -293,8 +280,7 @@ math_atanh(obj, x)
*/
static VALUE
-math_exp(obj, x)
- VALUE obj, x;
+math_exp(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(exp(RFLOAT(x)->value));
@@ -317,8 +303,7 @@ math_exp(obj, x)
*/
static VALUE
-math_log(obj, x)
- VALUE obj, x;
+math_log(VALUE obj, VALUE x)
{
double d;
@@ -339,8 +324,7 @@ math_log(obj, x)
*/
static VALUE
-math_log10(obj, x)
- VALUE obj, x;
+math_log10(VALUE obj, VALUE x)
{
double d;
@@ -362,8 +346,7 @@ math_log10(obj, x)
*/
static VALUE
-math_sqrt(obj, x)
- VALUE obj, x;
+math_sqrt(VALUE obj, VALUE x)
{
double d;
@@ -389,8 +372,7 @@ math_sqrt(obj, x)
*/
static VALUE
-math_frexp(obj, x)
- VALUE obj, x;
+math_frexp(VALUE obj, VALUE x)
{
double d;
int exp;
@@ -412,8 +394,7 @@ math_frexp(obj, x)
*/
static VALUE
-math_ldexp(obj, x, n)
- VALUE obj, x, n;
+math_ldexp(VALUE obj, VALUE x, VALUE n)
{
Need_Float(x);
return rb_float_new(ldexp(RFLOAT(x)->value, NUM2INT(n)));
@@ -430,8 +411,7 @@ math_ldexp(obj, x, n)
*/
static VALUE
-math_hypot(obj, x, y)
- VALUE obj, x, y;
+math_hypot(VALUE obj, VALUE x, VALUE y)
{
Need_Float2(x, y);
return rb_float_new(hypot(RFLOAT(x)->value, RFLOAT(y)->value));
@@ -445,8 +425,7 @@ math_hypot(obj, x, y)
*/
static VALUE
-math_erf(obj, x)
- VALUE obj, x;
+math_erf(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(erf(RFLOAT(x)->value));
@@ -460,8 +439,7 @@ math_erf(obj, x)
*/
static VALUE
-math_erfc(obj, x)
- VALUE obj, x;
+math_erfc(VALUE obj, VALUE x)
{
Need_Float(x);
return rb_float_new(erfc(RFLOAT(x)->value));
@@ -476,7 +454,7 @@ math_erfc(obj, x)
void
-Init_Math()
+Init_Math(void)
{
rb_mMath = rb_define_module("Math");
diff --git a/numeric.c b/numeric.c
index 671b4055d6..98fb197e49 100644
--- a/numeric.c
+++ b/numeric.c
@@ -74,7 +74,7 @@ VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
void
-rb_num_zerodiv()
+rb_num_zerodiv(void)
{
rb_raise(rb_eZeroDivError, "divided by 0");
}
@@ -97,8 +97,7 @@ rb_num_zerodiv()
*/
static VALUE
-num_coerce(x, y)
- VALUE x, y;
+num_coerce(VALUE x, VALUE y)
{
if (CLASS_OF(x) == CLASS_OF(y))
return rb_assoc_new(y, x);
@@ -106,15 +105,13 @@ num_coerce(x, y)
}
static VALUE
-coerce_body(x)
- VALUE *x;
+coerce_body(VALUE *x)
{
return rb_funcall(x[1], id_coerce, 1, x[0]);
}
static VALUE
-coerce_rescue(x)
- VALUE *x;
+coerce_rescue(VALUE *x)
{
volatile VALUE v = rb_inspect(x[1]);
@@ -127,9 +124,7 @@ coerce_rescue(x)
}
static int
-do_coerce(x, y, err)
- VALUE *x, *y;
- int err;
+do_coerce(VALUE *x, VALUE *y, int err)
{
VALUE ary;
VALUE a[2];
@@ -150,16 +145,14 @@ do_coerce(x, y, err)
}
VALUE
-rb_num_coerce_bin(x, y)
- VALUE x, y;
+rb_num_coerce_bin(VALUE x, VALUE y)
{
do_coerce(&x, &y, Qtrue);
return rb_funcall(x, rb_frame_this_func(), 1, y);
}
VALUE
-rb_num_coerce_cmp(x, y)
- VALUE x, y;
+rb_num_coerce_cmp(VALUE x, VALUE y)
{
if (do_coerce(&x, &y, Qfalse))
return rb_funcall(x, rb_frame_this_func(), 1, y);
@@ -167,8 +160,7 @@ rb_num_coerce_cmp(x, y)
}
VALUE
-rb_num_coerce_relop(x, y)
- VALUE x, y;
+rb_num_coerce_relop(VALUE x, VALUE y)
{
VALUE c, x0 = x, y0 = y;
@@ -186,8 +178,7 @@ rb_num_coerce_relop(x, y)
*/
static VALUE
-num_sadded(x, name)
- VALUE x, name;
+num_sadded(VALUE x, VALUE name)
{
ruby_frame = ruby_frame->prev; /* pop frame for "singleton_method_added" */
/* Numerics should be values; singleton_methods should not be added to them */
@@ -200,8 +191,7 @@ num_sadded(x, name)
/* :nodoc: */
static VALUE
-num_init_copy(x, y)
- VALUE x, y;
+num_init_copy(VALUE x, VALUE y)
{
/* Numerics are immutable values, which should not be copied */
rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x));
@@ -216,8 +206,7 @@ num_init_copy(x, y)
*/
static VALUE
-num_uplus(num)
- VALUE num;
+num_uplus(VALUE num)
{
return num;
}
@@ -230,8 +219,7 @@ num_uplus(num)
*/
static VALUE
-num_uminus(num)
- VALUE num;
+num_uminus(VALUE num)
{
VALUE zero;
@@ -249,8 +237,7 @@ num_uminus(num)
*/
static VALUE
-num_quo(x, y)
- VALUE x, y;
+num_quo(VALUE x, VALUE y)
{
return rb_funcall(x, '/', 1, y);
}
@@ -266,8 +253,7 @@ num_quo(x, y)
*/
static VALUE
-num_div(x, y)
- VALUE x, y;
+num_div(VALUE x, VALUE y)
{
return rb_Integer(rb_funcall(x, '/', 1, y));
}
@@ -315,8 +301,7 @@ num_div(x, y)
*/
static VALUE
-num_divmod(x, y)
- VALUE x, y;
+num_divmod(VALUE x, VALUE y)
{
return rb_assoc_new(num_div(x, y), rb_funcall(x, '%', 1, y));
}
@@ -330,8 +315,7 @@ num_divmod(x, y)
*/
static VALUE
-num_modulo(x, y)
- VALUE x, y;
+num_modulo(VALUE x, VALUE y)
{
return rb_funcall(x, '%', 1, y);
}
@@ -349,8 +333,7 @@ num_modulo(x, y)
*/
static VALUE
-num_remainder(x, y)
- VALUE x, y;
+num_remainder(VALUE x, VALUE y)
{
VALUE z = rb_funcall(x, '%', 1, y);
@@ -373,8 +356,7 @@ num_remainder(x, y)
*/
static VALUE
-num_int_p(num)
- VALUE num;
+num_int_p(VALUE num)
{
return Qfalse;
}
@@ -391,8 +373,7 @@ num_int_p(num)
*/
static VALUE
-num_abs(num)
- VALUE num;
+num_abs(VALUE num)
{
if (RTEST(rb_funcall(num, '<', 1, INT2FIX(0)))) {
return rb_funcall(num, rb_intern("-@"), 0);
@@ -409,8 +390,7 @@ num_abs(num)
*/
static VALUE
-num_zero_p(num)
- VALUE num;
+num_zero_p(VALUE num)
{
if (rb_equal(num, INT2FIX(0))) {
return Qtrue;
@@ -432,8 +412,7 @@ num_zero_p(num)
*/
static VALUE
-num_nonzero_p(num)
- VALUE num;
+num_nonzero_p(VALUE num)
{
if (RTEST(rb_funcall(num, rb_intern("zero?"), 0, 0))) {
return Qnil;
@@ -450,8 +429,7 @@ num_nonzero_p(num)
*/
static VALUE
-num_to_int(num)
- VALUE num;
+num_to_int(VALUE num)
{
return rb_funcall(num, id_to_i, 0, 0);
}
@@ -466,8 +444,7 @@ num_to_int(num)
*/
VALUE
-rb_float_new(d)
- double d;
+rb_float_new(double d)
{
NEWOBJ(flt, struct RFloat);
OBJSETUP(flt, rb_cFloat, T_FLOAT);
@@ -487,8 +464,7 @@ rb_float_new(d)
*/
static VALUE
-flo_to_s(flt)
- VALUE flt;
+flo_to_s(VALUE flt)
{
char buf[32];
double value = RFLOAT(flt)->value;
@@ -521,8 +497,7 @@ flo_to_s(flt)
*/
static VALUE
-flo_coerce(x, y)
- VALUE x, y;
+flo_coerce(VALUE x, VALUE y)
{
return rb_assoc_new(rb_Float(y), x);
}
@@ -535,8 +510,7 @@ flo_coerce(x, y)
*/
static VALUE
-flo_uminus(flt)
- VALUE flt;
+flo_uminus(VALUE flt)
{
return rb_float_new(-RFLOAT(flt)->value);
}
@@ -550,8 +524,7 @@ flo_uminus(flt)
*/
static VALUE
-flo_plus(x, y)
- VALUE x, y;
+flo_plus(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -574,8 +547,7 @@ flo_plus(x, y)
*/
static VALUE
-flo_minus(x, y)
- VALUE x, y;
+flo_minus(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -598,8 +570,7 @@ flo_minus(x, y)
*/
static VALUE
-flo_mul(x, y)
- VALUE x, y;
+flo_mul(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -622,8 +593,7 @@ flo_mul(x, y)
*/
static VALUE
-flo_div(x, y)
- VALUE x, y;
+flo_div(VALUE x, VALUE y)
{
long f_y;
double d;
@@ -644,9 +614,7 @@ flo_div(x, y)
static void
-flodivmod(x, y, divp, modp)
- double x, y;
- double *divp, *modp;
+flodivmod(double x, double y, double *divp, double *modp)
{
double div, mod;
@@ -682,8 +650,7 @@ flodivmod(x, y, divp, modp)
*/
static VALUE
-flo_mod(x, y)
- VALUE x, y;
+flo_mod(VALUE x, VALUE y)
{
double fy, mod;
@@ -712,8 +679,7 @@ flo_mod(x, y)
*/
static VALUE
-flo_divmod(x, y)
- VALUE x, y;
+flo_divmod(VALUE x, VALUE y)
{
double fy, div, mod;
volatile VALUE a, b;
@@ -746,8 +712,7 @@ flo_divmod(x, y)
*/
static VALUE
-flo_pow(x, y)
- VALUE x, y;
+flo_pow(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
@@ -774,8 +739,7 @@ flo_pow(x, y)
*/
static VALUE
-num_eql(x, y)
- VALUE x, y;
+num_eql(VALUE x, VALUE y)
{
if (TYPE(x) != TYPE(y)) return Qfalse;
@@ -791,16 +755,14 @@ num_eql(x, y)
*/
static VALUE
-num_cmp(x, y)
- VALUE x, y;
+num_cmp(VALUE x, VALUE y)
{
if (x == y) return INT2FIX(0);
return Qnil;
}
static VALUE
-num_equal(x, y)
- VALUE x, y;
+num_equal(VALUE x, VALUE y)
{
if (x == y) return Qtrue;
return rb_funcall(y, id_eq, 1, x);
@@ -819,8 +781,7 @@ num_equal(x, y)
*/
static VALUE
-flo_eq(x, y)
- VALUE x, y;
+flo_eq(VALUE x, VALUE y)
{
volatile double a, b;
@@ -851,8 +812,7 @@ flo_eq(x, y)
*/
static VALUE
-flo_hash(num)
- VALUE num;
+flo_hash(VALUE num)
{
double d;
char *c;
@@ -869,8 +829,7 @@ flo_hash(num)
}
VALUE
-rb_dbl_cmp(a, b)
- double a, b;
+rb_dbl_cmp(double a, double b)
{
if (isnan(a) || isnan(b)) return Qnil;
if (a == b) return INT2FIX(0);
@@ -889,8 +848,7 @@ rb_dbl_cmp(a, b)
*/
static VALUE
-flo_cmp(x, y)
- VALUE x, y;
+flo_cmp(VALUE x, VALUE y)
{
double a, b;
@@ -922,8 +880,7 @@ flo_cmp(x, y)
*/
static VALUE
-flo_gt(x, y)
- VALUE x, y;
+flo_gt(VALUE x, VALUE y)
{
double a, b;
@@ -958,8 +915,7 @@ flo_gt(x, y)
*/
static VALUE
-flo_ge(x, y)
- VALUE x, y;
+flo_ge(VALUE x, VALUE y)
{
double a, b;
@@ -993,8 +949,7 @@ flo_ge(x, y)
*/
static VALUE
-flo_lt(x, y)
- VALUE x, y;
+flo_lt(VALUE x, VALUE y)
{
double a, b;
@@ -1029,8 +984,7 @@ flo_lt(x, y)
*/
static VALUE
-flo_le(x, y)
- VALUE x, y;
+flo_le(VALUE x, VALUE y)
{
double a, b;
@@ -1068,8 +1022,7 @@ flo_le(x, y)
*/
static VALUE
-flo_eql(x, y)
- VALUE x, y;
+flo_eql(VALUE x, VALUE y)
{
if (TYPE(y) == T_FLOAT) {
double a = RFLOAT(x)->value;
@@ -1089,8 +1042,7 @@ flo_eql(x, y)
*/
static VALUE
-flo_to_f(num)
- VALUE num;
+flo_to_f(VALUE num)
{
return num;
}
@@ -1107,8 +1059,7 @@ flo_to_f(num)
*/
static VALUE
-flo_abs(flt)
- VALUE flt;
+flo_abs(VALUE flt)
{
double val = fabs(RFLOAT(flt)->value);
return rb_float_new(val);
@@ -1123,8 +1074,7 @@ flo_abs(flt)
*/
static VALUE
-flo_zero_p(num)
- VALUE num;
+flo_zero_p(VALUE num)
{
if (RFLOAT(num)->value == 0.0) {
return Qtrue;
@@ -1146,8 +1096,7 @@ flo_zero_p(num)
*/
static VALUE
-flo_is_nan_p(num)
- VALUE num;
+flo_is_nan_p(VALUE num)
{
double value = RFLOAT(num)->value;
@@ -1167,8 +1116,7 @@ flo_is_nan_p(num)
*/
static VALUE
-flo_is_infinite_p(num)
- VALUE num;
+flo_is_infinite_p(VALUE num)
{
double value = RFLOAT(num)->value;
@@ -1190,8 +1138,7 @@ flo_is_infinite_p(num)
*/
static VALUE
-flo_is_finite_p(num)
- VALUE num;
+flo_is_finite_p(VALUE num)
{
double value = RFLOAT(num)->value;
@@ -1219,8 +1166,7 @@ flo_is_finite_p(num)
*/
static VALUE
-flo_floor(num)
- VALUE num;
+flo_floor(VALUE num)
{
double f = floor(RFLOAT(num)->value);
long val;
@@ -1246,8 +1192,7 @@ flo_floor(num)
*/
static VALUE
-flo_ceil(num)
- VALUE num;
+flo_ceil(VALUE num)
{
double f = ceil(RFLOAT(num)->value);
long val;
@@ -1277,8 +1222,7 @@ flo_ceil(num)
*/
static VALUE
-flo_round(num)
- VALUE num;
+flo_round(VALUE num)
{
double f = RFLOAT(num)->value;
long val;
@@ -1303,8 +1247,7 @@ flo_round(num)
*/
static VALUE
-flo_truncate(num)
- VALUE num;
+flo_truncate(VALUE num)
{
double f = RFLOAT(num)->value;
long val;
@@ -1333,8 +1276,7 @@ flo_truncate(num)
*/
static VALUE
-num_floor(num)
- VALUE num;
+num_floor(VALUE num)
{
return flo_floor(rb_Float(num));
}
@@ -1356,8 +1298,7 @@ num_floor(num)
*/
static VALUE
-num_ceil(num)
- VALUE num;
+num_ceil(VALUE num)
{
return flo_ceil(rb_Float(num));
}
@@ -1372,8 +1313,7 @@ num_ceil(num)
*/
static VALUE
-num_round(num)
- VALUE num;
+num_round(VALUE num)
{
return flo_round(rb_Float(num));
}
@@ -1388,8 +1328,7 @@ num_round(num)
*/
static VALUE
-num_truncate(num)
- VALUE num;
+num_truncate(VALUE num)
{
return flo_truncate(rb_Float(num));
}
@@ -1423,10 +1362,7 @@ num_truncate(num)
*/
static VALUE
-num_step(argc, argv, from)
- int argc;
- VALUE *argv;
- VALUE from;
+num_step(int argc, VALUE *argv, VALUE from)
{
VALUE to, step;
@@ -1502,8 +1438,7 @@ num_step(argc, argv, from)
}
long
-rb_num2long(val)
- VALUE val;
+rb_num2long(VALUE val)
{
if (NIL_P(val)) {
rb_raise(rb_eTypeError, "no implicit conversion from nil to integer");
@@ -1536,8 +1471,7 @@ rb_num2long(val)
}
unsigned long
-rb_num2ulong(val)
- VALUE val;
+rb_num2ulong(VALUE val)
{
if (TYPE(val) == T_BIGNUM) {
return rb_big2ulong(val);
@@ -1622,23 +1556,20 @@ rb_fix2uint(val)
}
#else
long
-rb_num2int(val)
- VALUE val;
+rb_num2int(VALUE val)
{
return rb_num2long(val);
}
long
-rb_fix2int(val)
- VALUE val;
+rb_fix2int(VALUE val)
{
return FIX2INT(val);
}
#endif
VALUE
-rb_num2fix(val)
- VALUE val;
+rb_num2fix(VALUE val)
{
long v;
@@ -1653,8 +1584,7 @@ rb_num2fix(val)
#if HAVE_LONG_LONG
LONG_LONG
-rb_num2ll(val)
- VALUE val;
+rb_num2ll(VALUE val)
{
if (NIL_P(val)) {
rb_raise(rb_eTypeError, "no implicit conversion from nil");
@@ -1696,8 +1626,7 @@ rb_num2ll(val)
}
unsigned LONG_LONG
-rb_num2ull(val)
- VALUE val;
+rb_num2ull(VALUE val)
{
if (TYPE(val) == T_BIGNUM) {
return rb_big2ull(val);
@@ -1731,8 +1660,7 @@ rb_num2ull(val)
*/
static VALUE
-int_to_i(num)
- VALUE num;
+int_to_i(VALUE num)
{
return num;
}
@@ -1745,8 +1673,7 @@ int_to_i(num)
*/
static VALUE
-int_int_p(num)
- VALUE num;
+int_int_p(VALUE num)
{
return Qtrue;
}
@@ -1763,8 +1690,7 @@ int_int_p(num)
*/
static VALUE
-int_succ(num)
- VALUE num;
+int_succ(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) + 1;
@@ -1786,8 +1712,7 @@ int_succ(num)
*/
static VALUE
-int_chr(num)
- VALUE num;
+int_chr(VALUE num)
{
char c;
long i = NUM2LONG(num);
@@ -1826,8 +1751,7 @@ int_chr(num)
*/
static VALUE
-rb_fix_induced_from(klass, x)
- VALUE klass, x;
+rb_fix_induced_from(VALUE klass, VALUE x)
{
return rb_num2fix(x);
}
@@ -1840,8 +1764,7 @@ rb_fix_induced_from(klass, x)
*/
static VALUE
-rb_int_induced_from(klass, x)
- VALUE klass, x;
+rb_int_induced_from(VALUE klass, VALUE x)
{
switch (TYPE(x)) {
case T_FIXNUM:
@@ -1863,8 +1786,7 @@ rb_int_induced_from(klass, x)
*/
static VALUE
-rb_flo_induced_from(klass, x)
- VALUE klass, x;
+rb_flo_induced_from(VALUE klass, VALUE x)
{
switch (TYPE(x)) {
case T_FIXNUM:
@@ -1886,16 +1808,13 @@ rb_flo_induced_from(klass, x)
*/
static VALUE
-fix_uminus(num)
- VALUE num;
+fix_uminus(VALUE num)
{
return LONG2NUM(-FIX2LONG(num));
}
VALUE
-rb_fix2str(x, base)
- VALUE x;
- int base;
+rb_fix2str(VALUE x, int base)
{
extern const char ruby_digitmap[];
char buf[SIZEOF_LONG*CHAR_BIT + 2], *b = buf + sizeof buf;
@@ -1939,10 +1858,7 @@ rb_fix2str(x, base)
*
*/
static VALUE
-fix_to_s(argc, argv, x)
- int argc;
- VALUE *argv;
- VALUE x;
+fix_to_s(int argc, VALUE *argv, VALUE x)
{
VALUE b;
int base;
@@ -1968,8 +1884,7 @@ fix_to_s(argc, argv, x)
*/
static VALUE
-fix_plus(x, y)
- VALUE x, y;
+fix_plus(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a, b, c;
@@ -2005,8 +1920,7 @@ fix_plus(x, y)
*/
static VALUE
-fix_minus(x, y)
- VALUE x, y;
+fix_minus(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a, b, c;
@@ -2043,8 +1957,7 @@ fix_minus(x, y)
*/
static VALUE
-fix_mul(x, y)
- VALUE x, y;
+fix_mul(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a, b, c;
@@ -2073,9 +1986,7 @@ fix_mul(x, y)
}
static void
-fixdivmod(x, y, divp, modp)
- long x, y;
- long *divp, *modp;
+fixdivmod(long x, long y, long *divp, long *modp)
{
long div, mod;
@@ -2114,8 +2025,7 @@ fixdivmod(x, y, divp, modp)
*/
static VALUE
-fix_quo(x, y)
- VALUE x, y;
+fix_quo(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
return rb_float_new((double)FIX2LONG(x) / (double)FIX2LONG(y));
@@ -2141,8 +2051,7 @@ fix_quo(x, y)
*/
static VALUE
-fix_div(x, y)
- VALUE x, y;
+fix_div(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long div;
@@ -2171,8 +2080,7 @@ fix_div(x, y)
*/
static VALUE
-fix_mod(x, y)
- VALUE x, y;
+fix_mod(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long mod;
@@ -2203,8 +2111,7 @@ fix_mod(x, y)
* See <code>Numeric#divmod</code>.
*/
static VALUE
-fix_divmod(x, y)
- VALUE x, y;
+fix_divmod(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long div, mod;
@@ -2245,8 +2152,7 @@ fix_divmod(x, y)
*/
static VALUE
-fix_pow(x, y)
- VALUE x, y;
+fix_pow(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a, b;
@@ -2283,8 +2189,7 @@ fix_pow(x, y)
*/
static VALUE
-fix_equal(x, y)
- VALUE x, y;
+fix_equal(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
return (FIX2LONG(x) == FIX2LONG(y))?Qtrue:Qfalse;
@@ -2309,8 +2214,7 @@ fix_equal(x, y)
*/
static VALUE
-fix_cmp(x, y)
- VALUE x, y;
+fix_cmp(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
@@ -2338,8 +2242,7 @@ fix_cmp(x, y)
*/
static VALUE
-fix_gt(x, y)
- VALUE x, y;
+fix_gt(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
@@ -2366,8 +2269,7 @@ fix_gt(x, y)
*/
static VALUE
-fix_ge(x, y)
- VALUE x, y;
+fix_ge(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
@@ -2394,8 +2296,7 @@ fix_ge(x, y)
*/
static VALUE
-fix_lt(x, y)
- VALUE x, y;
+fix_lt(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
@@ -2422,8 +2323,7 @@ fix_lt(x, y)
*/
static VALUE
-fix_le(x, y)
- VALUE x, y;
+fix_le(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
long a = FIX2LONG(x), b = FIX2LONG(y);
@@ -2449,8 +2349,7 @@ fix_le(x, y)
*/
static VALUE
-fix_rev(num)
- VALUE num;
+fix_rev(VALUE num)
{
long val = FIX2LONG(num);
@@ -2466,8 +2365,7 @@ fix_rev(num)
*/
static VALUE
-fix_and(x, y)
- VALUE x, y;
+fix_and(VALUE x, VALUE y)
{
long val;
@@ -2486,8 +2384,7 @@ fix_and(x, y)
*/
static VALUE
-fix_or(x, y)
- VALUE x, y;
+fix_or(VALUE x, VALUE y)
{
long val;
@@ -2506,8 +2403,7 @@ fix_or(x, y)
*/
static VALUE
-fix_xor(x, y)
- VALUE x, y;
+fix_xor(VALUE x, VALUE y)
{
long val;
@@ -2528,8 +2424,7 @@ static VALUE fix_rshift _((VALUE, VALUE));
*/
static VALUE
-fix_lshift(x, y)
- VALUE x, y;
+fix_lshift(VALUE x, VALUE y)
{
long val, width;
@@ -2553,8 +2448,7 @@ fix_lshift(x, y)
*/
static VALUE
-fix_rshift(x, y)
- VALUE x, y;
+fix_rshift(VALUE x, VALUE y)
{
long i, val;
@@ -2588,8 +2482,7 @@ fix_rshift(x, y)
*/
static VALUE
-fix_aref(fix, idx)
- VALUE fix, idx;
+fix_aref(VALUE fix, VALUE idx)
{
long val = FIX2LONG(fix);
long i;
@@ -2623,8 +2516,7 @@ fix_aref(fix, idx)
*/
static VALUE
-fix_to_f(num)
- VALUE num;
+fix_to_f(VALUE num)
{
double val;
@@ -2645,8 +2537,7 @@ fix_to_f(num)
*/
static VALUE
-fix_abs(fix)
- VALUE fix;
+fix_abs(VALUE fix)
{
long i = FIX2LONG(fix);
@@ -2671,8 +2562,7 @@ fix_abs(fix)
*/
static VALUE
-fix_id2name(fix)
- VALUE fix;
+fix_id2name(VALUE fix)
{
char *name = rb_id2name(FIX2UINT(fix));
if (name) return rb_str_new2(name);
@@ -2693,8 +2583,7 @@ fix_id2name(fix)
*/
static VALUE
-fix_to_sym(fix)
- VALUE fix;
+fix_to_sym(VALUE fix)
{
ID id = FIX2UINT(fix);
@@ -2718,8 +2607,7 @@ fix_to_sym(fix)
*/
static VALUE
-fix_size(fix)
- VALUE fix;
+fix_size(VALUE fix)
{
return INT2FIX(sizeof(long));
}
@@ -2739,8 +2627,7 @@ fix_size(fix)
*/
static VALUE
-int_upto(from, to)
- VALUE from, to;
+int_upto(VALUE from, VALUE to)
{
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -2778,8 +2665,7 @@ int_upto(from, to)
*/
static VALUE
-int_downto(from, to)
- VALUE from, to;
+int_downto(VALUE from, VALUE to)
{
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -2818,8 +2704,7 @@ int_downto(from, to)
*/
static VALUE
-int_dotimes(num)
- VALUE num;
+int_dotimes(VALUE num)
{
if (FIXNUM_P(num)) {
long i, end;
@@ -2850,8 +2735,7 @@ int_dotimes(num)
*/
static VALUE
-fix_zero_p(num)
- VALUE num;
+fix_zero_p(VALUE num)
{
if (FIX2LONG(num) == 0) {
return Qtrue;
@@ -2860,7 +2744,7 @@ fix_zero_p(num)
}
void
-Init_Numeric()
+Init_Numeric(void)
{
#if defined(__FreeBSD__) && __FreeBSD__ < 4
/* allow divide by zero -- Inf */
diff --git a/object.c b/object.c
index d94620fde6..0952837a0c 100644
--- a/object.c
+++ b/object.c
@@ -43,8 +43,7 @@ static ID id_eq, id_eql, id_inspect, id_init_copy;
*/
VALUE
-rb_equal(obj1, obj2)
- VALUE obj1, obj2;
+rb_equal(VALUE obj1, VALUE obj2)
{
VALUE result;
@@ -55,8 +54,7 @@ rb_equal(obj1, obj2)
}
int
-rb_eql(obj1, obj2)
- VALUE obj1, obj2;
+rb_eql(VALUE obj1, VALUE obj2)
{
return RTEST(rb_funcall(obj1, id_eql, 1, obj2));
}
@@ -91,8 +89,7 @@ rb_eql(obj1, obj2)
*/
static VALUE
-rb_obj_equal(obj1, obj2)
- VALUE obj1, obj2;
+rb_obj_equal(VALUE obj1, VALUE obj2)
{
if (obj1 == obj2) return Qtrue;
return Qfalse;
@@ -129,8 +126,7 @@ rb_obj_equal(obj1, obj2)
*/
VALUE
-rb_obj_id(obj)
- VALUE obj;
+rb_obj_id(VALUE obj)
{
if (SPECIAL_CONST_P(obj)) {
return LONG2NUM((long)obj);
@@ -139,8 +135,7 @@ rb_obj_id(obj)
}
VALUE
-rb_class_real(cl)
- VALUE cl;
+rb_class_real(VALUE cl)
{
while (FL_TEST(cl, FL_SINGLETON) || TYPE(cl) == T_ICLASS) {
cl = RCLASS(cl)->super;
@@ -163,15 +158,13 @@ rb_class_real(cl)
*/
VALUE
-rb_obj_class(obj)
- VALUE obj;
+rb_obj_class(VALUE obj)
{
return rb_class_real(CLASS_OF(obj));
}
static void
-init_copy(dest, obj)
- VALUE dest, obj;
+init_copy(VALUE dest, VALUE obj)
{
if (OBJ_FROZEN(dest)) {
rb_raise(rb_eTypeError, "[bug] frozen object (%s) allocated", rb_obj_classname(dest));
@@ -220,8 +213,7 @@ init_copy(dest, obj)
*/
VALUE
-rb_obj_clone(obj)
- VALUE obj;
+rb_obj_clone(VALUE obj)
{
VALUE clone;
@@ -256,8 +248,7 @@ rb_obj_clone(obj)
*/
VALUE
-rb_obj_dup(obj)
- VALUE obj;
+rb_obj_dup(VALUE obj)
{
VALUE dup;
@@ -272,8 +263,7 @@ rb_obj_dup(obj)
/* :nodoc: */
VALUE
-rb_obj_init_copy(obj, orig)
- VALUE obj, orig;
+rb_obj_init_copy(VALUE obj, VALUE orig)
{
if (obj == orig) return obj;
rb_check_frozen(obj);
@@ -294,8 +284,7 @@ rb_obj_init_copy(obj, orig)
*/
VALUE
-rb_any_to_s(obj)
- VALUE obj;
+rb_any_to_s(VALUE obj)
{
char *cname = rb_obj_classname(obj);
VALUE str;
@@ -307,17 +296,13 @@ rb_any_to_s(obj)
}
VALUE
-rb_inspect(obj)
- VALUE obj;
+rb_inspect(VALUE obj)
{
return rb_obj_as_string(rb_funcall(obj, id_inspect, 0, 0));
}
static int
-inspect_i(id, value, str)
- ID id;
- VALUE value;
- VALUE str;
+inspect_i(ID id, VALUE value, VALUE str)
{
VALUE str2;
char *ivname;
@@ -343,9 +328,7 @@ inspect_i(id, value, str)
}
static VALUE
-inspect_obj(obj, str, recur)
- VALUE obj, str;
- int recur;
+inspect_obj(VALUE obj, VALUE str, int recur)
{
if (recur) {
rb_str_cat2(str, " ...");
@@ -374,8 +357,7 @@ inspect_obj(obj, str, recur)
static VALUE
-rb_obj_inspect(obj)
- VALUE obj;
+rb_obj_inspect(VALUE obj)
{
if (TYPE(obj) == T_OBJECT
&& ROBJECT(obj)->iv_tbl
@@ -400,8 +382,7 @@ rb_obj_inspect(obj)
*/
VALUE
-rb_obj_is_instance_of(obj, c)
- VALUE obj, c;
+rb_obj_is_instance_of(VALUE obj, VALUE c)
{
switch (TYPE(c)) {
case T_MODULE:
@@ -444,8 +425,7 @@ rb_obj_is_instance_of(obj, c)
*/
VALUE
-rb_obj_is_kind_of(obj, c)
- VALUE obj, c;
+rb_obj_is_kind_of(VALUE obj, VALUE c)
{
VALUE cl = CLASS_OF(obj);
@@ -574,7 +554,7 @@ rb_obj_is_kind_of(obj, c)
*/
static VALUE
-rb_obj_dummy()
+rb_obj_dummy(void)
{
return Qnil;
}
@@ -588,8 +568,7 @@ rb_obj_dummy()
*/
VALUE
-rb_obj_tainted(obj)
- VALUE obj;
+rb_obj_tainted(VALUE obj)
{
if (OBJ_TAINTED(obj))
return Qtrue;
@@ -606,8 +585,7 @@ rb_obj_tainted(obj)
*/
VALUE
-rb_obj_taint(obj)
- VALUE obj;
+rb_obj_taint(VALUE obj)
{
rb_secure(4);
if (!OBJ_TAINTED(obj)) {
@@ -628,8 +606,7 @@ rb_obj_taint(obj)
*/
VALUE
-rb_obj_untaint(obj)
- VALUE obj;
+rb_obj_untaint(VALUE obj)
{
rb_secure(3);
if (OBJ_TAINTED(obj)) {
@@ -642,8 +619,7 @@ rb_obj_untaint(obj)
}
void
-rb_obj_infect(obj1, obj2)
- VALUE obj1, obj2;
+rb_obj_infect(VALUE obj1, VALUE obj2)
{
OBJ_INFECT(obj1, obj2);
}
@@ -669,8 +645,7 @@ rb_obj_infect(obj1, obj2)
*/
VALUE
-rb_obj_freeze(obj)
- VALUE obj;
+rb_obj_freeze(VALUE obj)
{
if (!OBJ_FROZEN(obj)) {
if (rb_safe_level() >= 4 && !OBJ_TAINTED(obj)) {
@@ -693,8 +668,7 @@ rb_obj_freeze(obj)
*/
static VALUE
-rb_obj_frozen_p(obj)
- VALUE obj;
+rb_obj_frozen_p(VALUE obj)
{
if (OBJ_FROZEN(obj)) return Qtrue;
return Qfalse;
@@ -718,8 +692,7 @@ rb_obj_frozen_p(obj)
static VALUE
-nil_to_i(obj)
- VALUE obj;
+nil_to_i(VALUE obj)
{
return INT2FIX(0);
}
@@ -734,8 +707,7 @@ nil_to_i(obj)
*/
static VALUE
-nil_to_f(obj)
- VALUE obj;
+nil_to_f(VALUE obj)
{
return rb_float_new(0.0);
}
@@ -750,8 +722,7 @@ nil_to_f(obj)
*/
static VALUE
-nil_to_s(obj)
- VALUE obj;
+nil_to_s(VALUE obj)
{
return rb_str_new2("");
}
@@ -766,8 +737,7 @@ nil_to_s(obj)
*/
static VALUE
-nil_to_a(obj)
- VALUE obj;
+nil_to_a(VALUE obj)
{
return rb_ary_new2(0);
}
@@ -780,8 +750,7 @@ nil_to_a(obj)
*/
static VALUE
-nil_inspect(obj)
- VALUE obj;
+nil_inspect(VALUE obj)
{
return rb_str_new2("nil");
}
@@ -809,8 +778,7 @@ nil_plus(x, y)
#endif
static VALUE
-main_to_s(obj)
- VALUE obj;
+main_to_s(VALUE obj)
{
return rb_str_new2("main");
}
@@ -834,8 +802,7 @@ main_to_s(obj)
*/
static VALUE
-true_to_s(obj)
- VALUE obj;
+true_to_s(VALUE obj)
{
return rb_str_new2("true");
}
@@ -850,8 +817,7 @@ true_to_s(obj)
*/
static VALUE
-true_and(obj, obj2)
- VALUE obj, obj2;
+true_and(VALUE obj, VALUE obj2)
{
return RTEST(obj2)?Qtrue:Qfalse;
}
@@ -873,8 +839,7 @@ true_and(obj, obj2)
*/
static VALUE
-true_or(obj, obj2)
- VALUE obj, obj2;
+true_or(VALUE obj, VALUE obj2)
{
return Qtrue;
}
@@ -890,8 +855,7 @@ true_or(obj, obj2)
*/
static VALUE
-true_xor(obj, obj2)
- VALUE obj, obj2;
+true_xor(VALUE obj, VALUE obj2)
{
return RTEST(obj2)?Qfalse:Qtrue;
}
@@ -915,8 +879,7 @@ true_xor(obj, obj2)
*/
static VALUE
-false_to_s(obj)
- VALUE obj;
+false_to_s(VALUE obj)
{
return rb_str_new2("false");
}
@@ -932,8 +895,7 @@ false_to_s(obj)
*/
static VALUE
-false_and(obj, obj2)
- VALUE obj, obj2;
+false_and(VALUE obj, VALUE obj2)
{
return Qfalse;
}
@@ -949,8 +911,7 @@ false_and(obj, obj2)
*/
static VALUE
-false_or(obj, obj2)
- VALUE obj, obj2;
+false_or(VALUE obj, VALUE obj2)
{
return RTEST(obj2)?Qtrue:Qfalse;
}
@@ -969,8 +930,7 @@ false_or(obj, obj2)
*/
static VALUE
-false_xor(obj, obj2)
- VALUE obj, obj2;
+false_xor(VALUE obj, VALUE obj2)
{
return RTEST(obj2)?Qtrue:Qfalse;
}
@@ -983,8 +943,7 @@ false_xor(obj, obj2)
*/
static VALUE
-rb_true(obj)
- VALUE obj;
+rb_true(VALUE obj)
{
return Qtrue;
}
@@ -999,8 +958,7 @@ rb_true(obj)
static VALUE
-rb_false(obj)
- VALUE obj;
+rb_false(VALUE obj)
{
return Qfalse;
}
@@ -1016,8 +974,7 @@ rb_false(obj)
*/
static VALUE
-rb_obj_pattern_match(obj1, obj2)
- VALUE obj1, obj2;
+rb_obj_pattern_match(VALUE obj1, VALUE obj2)
{
return Qnil;
}
@@ -1067,8 +1024,7 @@ rb_obj_pattern_match(obj1, obj2)
*/
static VALUE
-sym_to_i(sym)
- VALUE sym;
+sym_to_i(VALUE sym)
{
ID id = SYM2ID(sym);
@@ -1086,8 +1042,7 @@ sym_to_i(sym)
*/
static VALUE
-sym_inspect(sym)
- VALUE sym;
+sym_inspect(VALUE sym)
{
VALUE str;
char *name;
@@ -1117,8 +1072,7 @@ sym_inspect(sym)
static VALUE
-sym_to_s(sym)
- VALUE sym;
+sym_to_s(VALUE sym)
{
return rb_str_new2(rb_id2name(SYM2ID(sym)));
}
@@ -1134,8 +1088,7 @@ sym_to_s(sym)
*/
static VALUE
-sym_to_sym(sym)
- VALUE sym;
+sym_to_sym(VALUE sym)
{
return sym;
}
@@ -1179,9 +1132,7 @@ sym_to_sym(sym)
*/
static VALUE
-rb_mod_to_s(klass)
- VALUE klass;
-
+rb_mod_to_s(VALUE klass)
{
if (FL_TEST(klass, FL_SINGLETON)) {
VALUE s = rb_str_new2("#<");
@@ -1211,8 +1162,7 @@ rb_mod_to_s(klass)
*/
static VALUE
-rb_mod_freeze(mod)
- VALUE mod;
+rb_mod_freeze(VALUE mod)
{
rb_mod_to_s(mod);
return rb_obj_freeze(mod);
@@ -1229,8 +1179,7 @@ rb_mod_freeze(mod)
*/
static VALUE
-rb_mod_eqq(mod, arg)
- VALUE mod, arg;
+rb_mod_eqq(VALUE mod, VALUE arg)
{
return rb_obj_is_kind_of(arg, mod);
}
@@ -1248,8 +1197,7 @@ rb_mod_eqq(mod, arg)
*/
VALUE
-rb_class_inherited_p(mod, arg)
- VALUE mod, arg;
+rb_class_inherited_p(VALUE mod, VALUE arg)
{
VALUE start = mod;
@@ -1287,8 +1235,7 @@ rb_class_inherited_p(mod, arg)
*/
static VALUE
-rb_mod_lt(mod, arg)
- VALUE mod, arg;
+rb_mod_lt(VALUE mod, VALUE arg)
{
if (mod == arg) return Qfalse;
return rb_class_inherited_p(mod, arg);
@@ -1308,8 +1255,7 @@ rb_mod_lt(mod, arg)
*/
static VALUE
-rb_mod_ge(mod, arg)
- VALUE mod, arg;
+rb_mod_ge(VALUE mod, VALUE arg)
{
switch (TYPE(arg)) {
case T_MODULE:
@@ -1334,8 +1280,7 @@ rb_mod_ge(mod, arg)
*/
static VALUE
-rb_mod_gt(mod, arg)
- VALUE mod, arg;
+rb_mod_gt(VALUE mod, VALUE arg)
{
if (mod == arg) return Qfalse;
return rb_mod_ge(mod, arg);
@@ -1353,8 +1298,7 @@ rb_mod_gt(mod, arg)
*/
static VALUE
-rb_mod_cmp(mod, arg)
- VALUE mod, arg;
+rb_mod_cmp(VALUE mod, VALUE arg)
{
VALUE cmp;
@@ -1375,10 +1319,8 @@ rb_mod_cmp(mod, arg)
return INT2FIX(1);
}
-static VALUE rb_module_s_alloc _((VALUE));
static VALUE
-rb_module_s_alloc(klass)
- VALUE klass;
+rb_module_s_alloc(VALUE klass)
{
VALUE mod = rb_module_new();
@@ -1386,10 +1328,8 @@ rb_module_s_alloc(klass)
return mod;
}
-static VALUE rb_class_s_alloc _((VALUE));
static VALUE
-rb_class_s_alloc(klass)
- VALUE klass;
+rb_class_s_alloc(VALUE klass)
{
return rb_class_boot(0);
}
@@ -1418,8 +1358,7 @@ rb_class_s_alloc(klass)
*/
static VALUE
-rb_mod_initialize(module)
- VALUE module;
+rb_mod_initialize(VALUE module)
{
if (rb_block_given_p()) {
rb_mod_module_eval(0, 0, module);
@@ -1438,10 +1377,7 @@ rb_mod_initialize(module)
*/
static VALUE
-rb_class_initialize(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_class_initialize(int argc, VALUE *argv, VALUE klass)
{
VALUE super;
@@ -1472,8 +1408,7 @@ rb_class_initialize(argc, argv, klass)
*/
VALUE
-rb_obj_alloc(klass)
- VALUE klass;
+rb_obj_alloc(VALUE klass)
{
VALUE obj;
@@ -1490,10 +1425,8 @@ rb_obj_alloc(klass)
return obj;
}
-static VALUE rb_class_allocate_instance _((VALUE));
static VALUE
-rb_class_allocate_instance(klass)
- VALUE klass;
+rb_class_allocate_instance(VALUE klass)
{
NEWOBJ(obj, struct RObject);
OBJSETUP(obj, klass, T_OBJECT);
@@ -1513,10 +1446,7 @@ rb_class_allocate_instance(klass)
*/
VALUE
-rb_class_new_instance(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_class_new_instance(int argc, VALUE *argv, VALUE klass)
{
VALUE obj;
@@ -1539,8 +1469,7 @@ rb_class_new_instance(argc, argv, klass)
*/
static VALUE
-rb_class_superclass(klass)
- VALUE klass;
+rb_class_superclass(VALUE klass)
{
VALUE super = RCLASS(klass)->super;
@@ -1557,8 +1486,7 @@ rb_class_superclass(klass)
}
static ID
-str_to_id(str)
- VALUE str;
+str_to_id(VALUE str)
{
if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) {
rb_raise(rb_eArgError, "empty symbol string");
@@ -1570,8 +1498,7 @@ str_to_id(str)
}
ID
-rb_to_id(name)
- VALUE name;
+rb_to_id(VALUE name)
{
VALUE tmp;
ID id;
@@ -1626,10 +1553,7 @@ rb_to_id(name)
*/
static VALUE
-rb_mod_attr(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_mod_attr(int argc, VALUE *argv, VALUE klass)
{
VALUE name, pub;
@@ -1648,10 +1572,7 @@ rb_mod_attr(argc, argv, klass)
*/
static VALUE
-rb_mod_attr_reader(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass)
{
int i;
@@ -1670,10 +1591,7 @@ rb_mod_attr_reader(argc, argv, klass)
*/
static VALUE
-rb_mod_attr_writer(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass)
{
int i;
@@ -1697,10 +1615,7 @@ rb_mod_attr_writer(argc, argv, klass)
*/
static VALUE
-rb_mod_attr_accessor(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
{
int i;
@@ -1720,8 +1635,7 @@ rb_mod_attr_accessor(argc, argv, klass)
*/
static VALUE
-rb_mod_const_get(mod, name)
- VALUE mod, name;
+rb_mod_const_get(VALUE mod, VALUE name)
{
ID id = rb_to_id(name);
@@ -1744,8 +1658,7 @@ rb_mod_const_get(mod, name)
*/
static VALUE
-rb_mod_const_set(mod, name, value)
- VALUE mod, name, value;
+rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
{
ID id = rb_to_id(name);
@@ -1767,8 +1680,7 @@ rb_mod_const_set(mod, name, value)
*/
static VALUE
-rb_mod_const_defined(mod, name)
- VALUE mod, name;
+rb_mod_const_defined(VALUE mod, VALUE name)
{
ID id = rb_to_id(name);
@@ -1799,10 +1711,7 @@ rb_mod_const_defined(mod, name)
static VALUE
-rb_obj_methods(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_methods(int argc, VALUE *argv, VALUE obj)
{
retry:
if (argc == 0) {
@@ -1833,10 +1742,7 @@ rb_obj_methods(argc, argv, obj)
*/
static VALUE
-rb_obj_protected_methods(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
{
if (argc == 0) { /* hack to stop warning */
VALUE args[1];
@@ -1857,10 +1763,7 @@ rb_obj_protected_methods(argc, argv, obj)
*/
static VALUE
-rb_obj_private_methods(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
{
if (argc == 0) { /* hack to stop warning */
VALUE args[1];
@@ -1881,10 +1784,7 @@ rb_obj_private_methods(argc, argv, obj)
*/
static VALUE
-rb_obj_public_methods(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
{
if (argc == 0) { /* hack to stop warning */
VALUE args[1];
@@ -1914,8 +1814,7 @@ rb_obj_public_methods(argc, argv, obj)
*/
static VALUE
-rb_obj_ivar_get(obj, iv)
- VALUE obj, iv;
+rb_obj_ivar_get(VALUE obj, VALUE iv)
{
ID id = rb_to_id(iv);
@@ -1947,8 +1846,7 @@ rb_obj_ivar_get(obj, iv)
*/
static VALUE
-rb_obj_ivar_set(obj, iv, val)
- VALUE obj, iv, val;
+rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
{
ID id = rb_to_id(iv);
@@ -1973,8 +1871,7 @@ rb_obj_ivar_set(obj, iv, val)
*/
static VALUE
-rb_mod_cvar_get(obj, iv)
- VALUE obj, iv;
+rb_mod_cvar_get(VALUE obj, VALUE iv)
{
ID id = rb_to_id(iv);
@@ -2003,8 +1900,7 @@ rb_mod_cvar_get(obj, iv)
*/
static VALUE
-rb_mod_cvar_set(obj, iv, val)
- VALUE obj, iv, val;
+rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
{
ID id = rb_to_id(iv);
@@ -2016,10 +1912,7 @@ rb_mod_cvar_set(obj, iv, val)
}
static VALUE
-convert_type(val, tname, method, raise)
- VALUE val;
- const char *tname, *method;
- int raise;
+convert_type(VALUE val, const char *tname, const char *method, int raise)
{
ID m;
@@ -2041,10 +1934,7 @@ convert_type(val, tname, method, raise)
}
VALUE
-rb_convert_type(val, type, tname, method)
- VALUE val;
- int type;
- const char *tname, *method;
+rb_convert_type(VALUE val, int type, const char *tname, const char *method)
{
VALUE v;
@@ -2059,10 +1949,7 @@ rb_convert_type(val, type, tname, method)
}
VALUE
-rb_check_convert_type(val, type, tname, method)
- VALUE val;
- int type;
- const char *tname, *method;
+rb_check_convert_type(VALUE val, int type, const char *tname, const char *method)
{
VALUE v;
@@ -2080,9 +1967,7 @@ rb_check_convert_type(val, type, tname, method)
static VALUE
-rb_to_integer(val, method)
- VALUE val;
- const char *method;
+rb_to_integer(VALUE val, const char *method)
{
VALUE v = convert_type(val, "Integer", method, Qtrue);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
@@ -2094,9 +1979,7 @@ rb_to_integer(val, method)
}
VALUE
-rb_check_to_integer(val, method)
- VALUE val;
- const char *method;
+rb_check_to_integer(VALUE val, const char *method)
{
VALUE v = convert_type(val, "Integer", method, Qfalse);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
@@ -2106,15 +1989,13 @@ rb_check_to_integer(val, method)
}
VALUE
-rb_to_int(val)
- VALUE val;
+rb_to_int(VALUE val)
{
return rb_to_integer(val, "to_int");
}
VALUE
-rb_Integer(val)
- VALUE val;
+rb_Integer(VALUE val)
{
VALUE tmp;
@@ -2161,16 +2042,13 @@ rb_Integer(val)
*/
static VALUE
-rb_f_integer(obj, arg)
- VALUE obj, arg;
+rb_f_integer(VALUE obj, VALUE arg)
{
return rb_Integer(arg);
}
double
-rb_cstr_to_dbl(p, badcheck)
- const char *p;
- int badcheck;
+rb_cstr_to_dbl(const char *p, int badcheck)
{
const char *q;
char *end;
@@ -2237,9 +2115,7 @@ rb_cstr_to_dbl(p, badcheck)
}
double
-rb_str_to_dbl(str, badcheck)
- VALUE str;
- int badcheck;
+rb_str_to_dbl(VALUE str, int badcheck)
{
char *s;
long len;
@@ -2263,8 +2139,7 @@ rb_str_to_dbl(str, badcheck)
}
VALUE
-rb_Float(val)
- VALUE val;
+rb_Float(VALUE val)
{
switch (TYPE(val)) {
case T_FIXNUM:
@@ -2307,15 +2182,13 @@ rb_Float(val)
*/
static VALUE
-rb_f_float(obj, arg)
- VALUE obj, arg;
+rb_f_float(VALUE obj, VALUE arg)
{
return rb_Float(arg);
}
double
-rb_num2dbl(val)
- VALUE val;
+rb_num2dbl(VALUE val)
{
switch (TYPE(val)) {
case T_FLOAT:
@@ -2337,9 +2210,7 @@ rb_num2dbl(val)
}
char*
-rb_str2cstr(str, len)
- VALUE str;
- long *len;
+rb_str2cstr(VALUE str, long *len)
{
StringValue(str);
if (len) *len = RSTRING(str)->len;
@@ -2350,8 +2221,7 @@ rb_str2cstr(str, len)
}
VALUE
-rb_String(val)
- VALUE val;
+rb_String(VALUE val)
{
return rb_convert_type(val, T_STRING, "String", "to_s");
}
@@ -2370,15 +2240,13 @@ rb_String(val)
*/
static VALUE
-rb_f_string(obj, arg)
- VALUE obj, arg;
+rb_f_string(VALUE obj, VALUE arg)
{
return rb_String(arg);
}
VALUE
-rb_Array(val)
- VALUE val;
+rb_Array(VALUE val)
{
VALUE tmp = rb_check_array_type(val);
@@ -2404,16 +2272,13 @@ rb_Array(val)
*/
static VALUE
-rb_f_array(obj, arg)
- VALUE obj, arg;
+rb_f_array(VALUE obj, VALUE arg)
{
return rb_Array(arg);
}
static VALUE
-boot_defclass(name, super)
- char *name;
- VALUE super;
+boot_defclass(char *name, VALUE super)
{
extern st_table *rb_class_tbl;
VALUE obj = rb_class_boot(super);
@@ -2502,7 +2367,7 @@ VALUE ruby_top_self;
*/
void
-Init_Object()
+Init_Object(void)
{
VALUE metaclass;
diff --git a/pack.c b/pack.c
index a5524bcca0..5b4f417b14 100644
--- a/pack.c
+++ b/pack.c
@@ -135,8 +135,7 @@ define_swapx(f,float)
#else
#if SIZEOF_LONG == 4 /* SIZEOF_DOUBLE == 8 && 4 == SIZEOF_LONG */
static double
-swapd(d)
- const double d;
+swapd(const double d)
{
double dtmp = d;
unsigned long utmp[2];
@@ -334,8 +333,7 @@ endian()
unsigned long rb_big2ulong_pack _((VALUE x));
static unsigned long
-num2i32(x)
- VALUE x;
+num2i32(VALUE x)
{
x = rb_to_int(x); /* is nil OK? (should not) */
@@ -438,8 +436,7 @@ static unsigned long utf8_to_uv _((char*,long*));
*/
static VALUE
-pack_pack(ary, fmt)
- VALUE ary, fmt;
+pack_pack(VALUE ary, VALUE fmt)
{
static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
static char *spc10 = " ";
@@ -1008,11 +1005,7 @@ static char b64_table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static void
-encodes(str, s, len, type)
- VALUE str;
- char *s;
- long len;
- int type;
+encodes(VALUE str, char *s, long len, int type)
{
char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
long i = 0;
@@ -1053,9 +1046,7 @@ encodes(str, s, len, type)
static char hex_table[] = "0123456789ABCDEF";
static void
-qpencode(str, from, len)
- VALUE str, from;
- long len;
+qpencode(VALUE str, VALUE from, long len)
{
char buff[1024];
long i = 0, n = 0, prev = EOF;
@@ -1108,8 +1099,7 @@ qpencode(str, from, len)
}
static inline int
-hex2num(c)
- char c;
+hex2num(char c)
{
switch (c) {
case '0': case '1': case '2': case '3': case '4':
@@ -1149,10 +1139,7 @@ hex2num(c)
#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil)
static VALUE
-infected_str_new(ptr, len, str)
- const char *ptr;
- long len;
- VALUE str;
+infected_str_new(const char *ptr, long len, VALUE str)
{
VALUE s = rb_str_new(ptr, len);
@@ -1299,8 +1286,7 @@ infected_str_new(ptr, len, str)
*/
static VALUE
-pack_unpack(str, fmt)
- VALUE str, fmt;
+pack_unpack(VALUE str, VALUE fmt)
{
static char *hexdigits = "0123456789abcdef0123456789ABCDEFx";
char *s, *send;
@@ -1990,9 +1976,7 @@ pack_unpack(str, fmt)
#define BYTEWIDTH 8
static int
-uv_to_utf8(buf, uv)
- char *buf;
- unsigned long uv;
+uv_to_utf8(char *buf, unsigned long uv)
{
if (uv <= 0x7f) {
buf[0] = (char)uv;
@@ -2047,9 +2031,7 @@ static const long utf8_limits[] = {
};
static unsigned long
-utf8_to_uv(p, lenp)
- char *p;
- long *lenp;
+utf8_to_uv(char *p, long *lenp)
{
int c = *p++ & 0xff;
unsigned long uv = c;
@@ -2099,7 +2081,7 @@ utf8_to_uv(p, lenp)
}
void
-Init_pack()
+Init_pack(void)
{
rb_define_method(rb_cArray, "pack", pack_pack, 1);
rb_define_method(rb_cString, "unpack", pack_unpack, 1);
diff --git a/prec.c b/prec.c
index dc89a01435..cd37af960b 100644
--- a/prec.c
+++ b/prec.c
@@ -32,8 +32,7 @@ static ID prc_pr, prc_if;
*/
static VALUE
-prec_prec(x, klass)
- VALUE x, klass;
+prec_prec(VALUE x, VALUE klass)
{
return rb_funcall(klass, prc_if, 1, x);
}
@@ -47,8 +46,7 @@ prec_prec(x, klass)
*/
static VALUE
-prec_prec_i(x)
- VALUE x;
+prec_prec_i(VALUE x)
{
VALUE klass = rb_cInteger;
@@ -64,8 +62,7 @@ prec_prec_i(x)
*/
static VALUE
-prec_prec_f(x)
- VALUE x;
+prec_prec_f(VALUE x)
{
VALUE klass = rb_cFloat;
@@ -86,8 +83,7 @@ prec_prec_f(x)
*/
static VALUE
-prec_induced_from(module, x)
- VALUE module, x;
+prec_induced_from(VALUE module, VALUE x)
{
rb_raise(rb_eTypeError, "undefined conversion from %s into %s",
rb_obj_classname(x), rb_class2name(module));
@@ -104,8 +100,7 @@ prec_induced_from(module, x)
*/
static VALUE
-prec_included(module, include)
- VALUE module, include;
+prec_included(VALUE module, VALUE include)
{
switch (TYPE(include)) {
case T_CLASS:
@@ -128,7 +123,7 @@ prec_included(module, include)
*/
void
-Init_Precision()
+Init_Precision(void)
{
rb_mPrecision = rb_define_module("Precision");
rb_define_singleton_method(rb_mPrecision, "included", prec_included, 1);
diff --git a/process.c b/process.c
index ab8f502c28..e7072b3805 100644
--- a/process.c
+++ b/process.c
@@ -128,7 +128,7 @@ static VALUE S_Tms;
*/
static VALUE
-get_pid()
+get_pid(void)
{
rb_secure(2);
return INT2FIX(getpid());
@@ -152,7 +152,7 @@ get_pid()
*/
static VALUE
-get_ppid()
+get_ppid(void)
{
rb_secure(2);
#ifdef _WIN32
@@ -197,8 +197,7 @@ static VALUE rb_cProcStatus;
VALUE rb_last_status = Qnil;
static void
-last_status_set(status, pid)
- int status, pid;
+last_status_set(int status, int pid)
{
rb_last_status = rb_obj_alloc(rb_cProcStatus);
rb_iv_set(rb_last_status, "status", INT2FIX(status));
@@ -220,8 +219,7 @@ last_status_set(status, pid)
*/
static VALUE
-pst_to_i(st)
- VALUE st;
+pst_to_i(VALUE st)
{
return rb_iv_get(st, "status");
}
@@ -235,8 +233,7 @@ pst_to_i(st)
*/
static VALUE
-pst_to_s(st)
- VALUE st;
+pst_to_s(VALUE st)
{
return rb_fix2str(pst_to_i(st), 10);
}
@@ -254,8 +251,7 @@ pst_to_s(st)
*/
static VALUE
-pst_pid(st)
- VALUE st;
+pst_pid(VALUE st)
{
return rb_iv_get(st, "pid");
}
@@ -269,8 +265,7 @@ pst_pid(st)
*/
static VALUE
-pst_inspect(st)
- VALUE st;
+pst_inspect(VALUE st)
{
VALUE pid;
int status;
@@ -326,8 +321,7 @@ pst_inspect(st)
*/
static VALUE
-pst_equal(st1, st2)
- VALUE st1, st2;
+pst_equal(VALUE st1, VALUE st2)
{
if (st1 == st2) return Qtrue;
return rb_equal(pst_to_i(st1), st2);
@@ -347,8 +341,7 @@ pst_equal(st1, st2)
*/
static VALUE
-pst_bitand(st1, st2)
- VALUE st1, st2;
+pst_bitand(VALUE st1, VALUE st2)
{
int status = NUM2INT(st1) & NUM2INT(st2);
@@ -369,8 +362,7 @@ pst_bitand(st1, st2)
*/
static VALUE
-pst_rshift(st1, st2)
- VALUE st1, st2;
+pst_rshift(VALUE st1, VALUE st2)
{
int status = NUM2INT(st1) >> NUM2INT(st2);
@@ -388,8 +380,7 @@ pst_rshift(st1, st2)
*/
static VALUE
-pst_wifstopped(st)
- VALUE st;
+pst_wifstopped(VALUE st)
{
int status = NUM2INT(st);
@@ -409,8 +400,7 @@ pst_wifstopped(st)
*/
static VALUE
-pst_wstopsig(st)
- VALUE st;
+pst_wstopsig(VALUE st)
{
int status = NUM2INT(st);
@@ -429,8 +419,7 @@ pst_wstopsig(st)
*/
static VALUE
-pst_wifsignaled(st)
- VALUE st;
+pst_wifsignaled(VALUE st)
{
int status = NUM2INT(st);
@@ -451,8 +440,7 @@ pst_wifsignaled(st)
*/
static VALUE
-pst_wtermsig(st)
- VALUE st;
+pst_wtermsig(VALUE st)
{
int status = NUM2INT(st);
@@ -472,8 +460,7 @@ pst_wtermsig(st)
*/
static VALUE
-pst_wifexited(st)
- VALUE st;
+pst_wifexited(VALUE st)
{
int status = NUM2INT(st);
@@ -504,8 +491,7 @@ pst_wifexited(st)
*/
static VALUE
-pst_wexitstatus(st)
- VALUE st;
+pst_wexitstatus(VALUE st)
{
int status = NUM2INT(st);
@@ -524,8 +510,7 @@ pst_wexitstatus(st)
*/
static VALUE
-pst_success_p(st)
- VALUE st;
+pst_success_p(VALUE st)
{
int status = NUM2INT(st);
@@ -544,8 +529,7 @@ pst_success_p(st)
*/
static VALUE
-pst_wcoredump(st)
- VALUE st;
+pst_wcoredump(VALUE st)
{
#ifdef WCOREDUMP
int status = NUM2INT(st);
@@ -565,10 +549,7 @@ static st_table *pid_tbl;
#endif
int
-rb_waitpid(pid, st, flags)
- int pid;
- int *st;
- int flags;
+rb_waitpid(int pid, int *st, int flags)
{
int result;
#ifndef NO_WAITPID
@@ -724,9 +705,7 @@ waitall_each(pid, status, ary)
*/
static VALUE
-proc_wait(argc, argv)
- int argc;
- VALUE *argv;
+proc_wait(int argc, VALUE *argv)
{
VALUE vpid, vflags;
int pid, flags, status;
@@ -770,9 +749,7 @@ proc_wait(argc, argv)
*/
static VALUE
-proc_wait2(argc, argv)
- int argc;
- VALUE *argv;
+proc_wait2(int argc, VALUE *argv)
{
VALUE pid = proc_wait(argc, argv);
if (NIL_P(pid)) return Qnil;
@@ -801,7 +778,7 @@ proc_wait2(argc, argv)
*/
static VALUE
-proc_waitall()
+proc_waitall(void)
{
VALUE result;
int pid, status;
@@ -843,8 +820,7 @@ proc_waitall()
}
static VALUE
-detach_process_watcher(pid_p)
- int *pid_p;
+detach_process_watcher(int *pid_p)
{
int cpid, status;
@@ -856,8 +832,7 @@ detach_process_watcher(pid_p)
}
VALUE
-rb_detach_process(pid)
- int pid;
+rb_detach_process(int pid)
{
return rb_thread_create(detach_process_watcher, (void*)&pid);
}
@@ -928,11 +903,10 @@ char *strtok();
#define after_exec()
#endif
-extern char *dln_find_exe();
+extern char *dln_find_exe(const char *fname, const char *path);
static void
-security(str)
- const char *str;
+security(const char *str)
{
if (rb_env_path_tainted()) {
if (rb_safe_level() > 0) {
@@ -942,9 +916,7 @@ security(str)
}
static int
-proc_exec_v(argv, prog)
- char **argv;
- const char *prog;
+proc_exec_v(char **argv, const char *prog)
{
if (!prog)
prog = argv[0];
@@ -999,10 +971,7 @@ proc_exec_v(argv, prog)
}
int
-rb_proc_exec_n(argc, argv, prog)
- int argc;
- VALUE *argv;
- const char *prog;
+rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
{
char **args;
int i;
@@ -1019,8 +988,7 @@ rb_proc_exec_n(argc, argv, prog)
}
int
-rb_proc_exec(str)
- const char *str;
+rb_proc_exec(const char *str)
{
const char *s = str;
char *ss, *t;
@@ -1144,10 +1112,7 @@ proc_spawn_v(argv, prog)
#endif
static int
-proc_spawn_n(argc, argv, prog)
- int argc;
- VALUE *argv;
- VALUE prog;
+proc_spawn_n(int argc, VALUE *argv, VALUE prog)
{
char **args;
int i;
@@ -1197,9 +1162,7 @@ proc_spawn(str)
#endif
VALUE
-rb_check_argv(argc, argv)
- int argc;
- VALUE *argv;
+rb_check_argv(int argc, VALUE *argv)
{
VALUE tmp, prog;
int i;
@@ -1254,9 +1217,7 @@ rb_check_argv(argc, argv)
*/
VALUE
-rb_f_exec(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_exec(int argc, VALUE *argv)
{
struct rb_exec_arg e;
VALUE prog;
@@ -1278,8 +1239,7 @@ rb_f_exec(argc, argv)
}
int
-rb_exec(e)
- const struct rb_exec_arg *e;
+rb_exec(const struct rb_exec_arg *e)
{
int argc = e->argc;
VALUE *argv = e->argv;
@@ -1444,8 +1404,7 @@ rb_fork(status, chfunc, charg)
*/
static VALUE
-rb_f_fork(obj)
- VALUE obj;
+rb_f_fork(VALUE obj)
{
#ifdef HAVE_FORK
int pid;
@@ -1491,10 +1450,7 @@ rb_f_fork(obj)
*/
static VALUE
-rb_f_exit_bang(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)
{
VALUE status;
int istatus;
@@ -1526,8 +1482,7 @@ rb_f_exit_bang(argc, argv, obj)
#endif
void
-rb_syswait(pid)
- int pid;
+rb_syswait(int pid)
{
static int overriding;
#ifdef SIGHUP
@@ -1569,9 +1524,7 @@ rb_syswait(pid)
}
int
-rb_spawn(argc, argv)
- int argc;
- VALUE *argv;
+rb_spawn(int argc, VALUE *argv)
{
int status;
VALUE prog;
@@ -1631,9 +1584,7 @@ rb_spawn(argc, argv)
*/
static VALUE
-rb_f_system(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_system(int argc, VALUE *argv)
{
int status;
@@ -1656,9 +1607,7 @@ rb_f_system(argc, argv)
*/
static VALUE
-rb_f_spawn(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_spawn(int argc, VALUE *argv)
{
int pid;
@@ -1690,9 +1639,7 @@ rb_f_spawn(argc, argv)
*/
static VALUE
-rb_f_sleep(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_sleep(int argc, VALUE *argv)
{
int beg, end;
@@ -1725,7 +1672,7 @@ rb_f_sleep(argc, argv)
*/
static VALUE
-proc_getpgrp()
+proc_getpgrp(void)
{
int pgrp;
@@ -1755,7 +1702,7 @@ proc_getpgrp()
*/
static VALUE
-proc_setpgrp()
+proc_setpgrp(void)
{
rb_secure(2);
/* check for posix setpgid() first; this matches the posix */
@@ -1784,8 +1731,7 @@ proc_setpgrp()
*/
static VALUE
-proc_getpgid(obj, pid)
- VALUE obj, pid;
+proc_getpgid(VALUE obj, VALUE pid)
{
#if defined(HAVE_GETPGID) && !defined(__CHECKER__)
int i;
@@ -1809,8 +1755,7 @@ proc_getpgid(obj, pid)
*/
static VALUE
-proc_setpgid(obj, pid, pgrp)
- VALUE obj, pid, pgrp;
+proc_setpgid(VALUE obj, VALUE pid, VALUE pgrp)
{
#ifdef HAVE_SETPGID
int ipid, ipgrp;
@@ -1839,7 +1784,7 @@ proc_setpgid(obj, pid, pgrp)
*/
static VALUE
-proc_setsid()
+proc_setsid(void)
{
#if defined(HAVE_SETSID)
int pid;
@@ -1893,8 +1838,7 @@ proc_setsid()
*/
static VALUE
-proc_getpriority(obj, which, who)
- VALUE obj, which, who;
+proc_getpriority(VALUE obj, VALUE which, VALUE who)
{
#ifdef HAVE_GETPRIORITY
int prio, iwhich, iwho;
@@ -1926,8 +1870,7 @@ proc_getpriority(obj, which, who)
*/
static VALUE
-proc_setpriority(obj, which, who, prio)
- VALUE obj, which, who, prio;
+proc_setpriority(VALUE obj, VALUE which, VALUE who, VALUE prio)
{
#ifdef HAVE_GETPRIORITY
int iwhich, iwho, iprio;
@@ -2044,7 +1987,7 @@ proc_setrlimit(VALUE obj, VALUE resource, VALUE rlim_cur, VALUE rlim_max)
static int under_uid_switch = 0;
static void
-check_uid_switch()
+check_uid_switch(void)
{
rb_secure(2);
if (under_uid_switch) {
@@ -2054,7 +1997,7 @@ check_uid_switch()
static int under_gid_switch = 0;
static void
-check_gid_switch()
+check_gid_switch(void)
{
rb_secure(2);
if (under_gid_switch) {
@@ -2084,8 +2027,7 @@ check_gid_switch()
*/
static VALUE
-p_sys_setuid(obj, id)
- VALUE obj, id;
+p_sys_setuid(VALUE obj, VALUE id)
{
#if defined HAVE_SETUID
check_uid_switch();
@@ -2108,8 +2050,7 @@ p_sys_setuid(obj, id)
*/
static VALUE
-p_sys_setruid(obj, id)
- VALUE obj, id;
+p_sys_setruid(VALUE obj, VALUE id)
{
#if defined HAVE_SETRUID
check_uid_switch();
@@ -2131,8 +2072,7 @@ p_sys_setruid(obj, id)
*/
static VALUE
-p_sys_seteuid(obj, id)
- VALUE obj, id;
+p_sys_seteuid(VALUE obj, VALUE id)
{
#if defined HAVE_SETEUID
check_uid_switch();
@@ -2156,8 +2096,7 @@ p_sys_seteuid(obj, id)
*/
static VALUE
-p_sys_setreuid(obj, rid, eid)
- VALUE obj, rid, eid;
+p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
#if defined HAVE_SETREUID
check_uid_switch();
@@ -2181,8 +2120,7 @@ p_sys_setreuid(obj, rid, eid)
*/
static VALUE
-p_sys_setresuid(obj, rid, eid, sid)
- VALUE obj, rid, eid, sid;
+p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
#if defined HAVE_SETRESUID
check_uid_switch();
@@ -2206,8 +2144,7 @@ p_sys_setresuid(obj, rid, eid, sid)
*/
static VALUE
-proc_getuid(obj)
- VALUE obj;
+proc_getuid(VALUE obj)
{
int uid = getuid();
return INT2FIX(uid);
@@ -2223,8 +2160,7 @@ proc_getuid(obj)
*/
static VALUE
-proc_setuid(obj, id)
- VALUE obj, id;
+proc_setuid(VALUE obj, VALUE id)
{
int uid = NUM2INT(id);
@@ -2278,8 +2214,7 @@ static int SAVED_USER_ID;
*/
static VALUE
-p_uid_change_privilege(obj, id)
- VALUE obj, id;
+p_uid_change_privilege(VALUE obj, VALUE id)
{
int uid;
@@ -2428,8 +2363,7 @@ p_uid_change_privilege(obj, id)
*/
static VALUE
-p_sys_setgid(obj, id)
- VALUE obj, id;
+p_sys_setgid(VALUE obj, VALUE id)
{
#if defined HAVE_SETGID
check_gid_switch();
@@ -2451,8 +2385,7 @@ p_sys_setgid(obj, id)
*/
static VALUE
-p_sys_setrgid(obj, id)
- VALUE obj, id;
+p_sys_setrgid(VALUE obj, VALUE id)
{
#if defined HAVE_SETRGID
check_gid_switch();
@@ -2475,8 +2408,7 @@ p_sys_setrgid(obj, id)
*/
static VALUE
-p_sys_setegid(obj, id)
- VALUE obj, id;
+p_sys_setegid(VALUE obj, VALUE id)
{
#if defined HAVE_SETEGID
check_gid_switch();
@@ -2500,8 +2432,7 @@ p_sys_setegid(obj, id)
*/
static VALUE
-p_sys_setregid(obj, rid, eid)
- VALUE obj, rid, eid;
+p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
#if defined HAVE_SETREGID
check_gid_switch();
@@ -2524,8 +2455,7 @@ p_sys_setregid(obj, rid, eid)
*/
static VALUE
-p_sys_setresgid(obj, rid, eid, sid)
- VALUE obj, rid, eid, sid;
+p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
#if defined HAVE_SETRESGID
check_gid_switch();
@@ -2550,8 +2480,7 @@ p_sys_setresgid(obj, rid, eid, sid)
*/
static VALUE
-p_sys_issetugid(obj)
- VALUE obj;
+p_sys_issetugid(VALUE obj)
{
#if defined HAVE_ISSETUGID
rb_secure(2);
@@ -2579,8 +2508,7 @@ p_sys_issetugid(obj)
*/
static VALUE
-proc_getgid(obj)
- VALUE obj;
+proc_getgid(VALUE obj)
{
int gid = getgid();
return INT2FIX(gid);
@@ -2595,8 +2523,7 @@ proc_getgid(obj)
*/
static VALUE
-proc_setgid(obj, id)
- VALUE obj, id;
+proc_setgid(VALUE obj, VALUE id)
{
int gid = NUM2INT(id);
@@ -2746,8 +2673,7 @@ proc_setgroups(VALUE obj, VALUE ary)
*/
static VALUE
-proc_initgroups(obj, uname, base_grp)
- VALUE obj, uname, base_grp;
+proc_initgroups(VALUE obj, VALUE uname, VALUE base_grp)
{
#ifdef HAVE_INITGROUPS
if (initgroups(StringValuePtr(uname), (rb_gid_t)NUM2INT(base_grp)) != 0) {
@@ -2772,8 +2698,7 @@ proc_initgroups(obj, uname, base_grp)
*/
static VALUE
-proc_getmaxgroups(obj)
- VALUE obj;
+proc_getmaxgroups(VALUE obj)
{
return INT2FIX(maxgroups);
}
@@ -2814,9 +2739,7 @@ proc_setmaxgroups(VALUE obj, VALUE val)
*/
static VALUE
-proc_daemon(argc, argv)
- int argc;
- VALUE *argv;
+proc_daemon(int argc, VALUE *argv)
{
VALUE nochdir, noclose;
int n;
@@ -2882,8 +2805,7 @@ static int SAVED_GROUP_ID;
*/
static VALUE
-p_gid_change_privilege(obj, id)
- VALUE obj, id;
+p_gid_change_privilege(VALUE obj, VALUE id)
{
int gid;
@@ -3034,8 +2956,7 @@ p_gid_change_privilege(obj, id)
*/
static VALUE
-proc_geteuid(obj)
- VALUE obj;
+proc_geteuid(VALUE obj)
{
int euid = geteuid();
return INT2FIX(euid);
@@ -3051,8 +2972,7 @@ proc_geteuid(obj)
*/
static VALUE
-proc_seteuid(obj, euid)
- VALUE obj, euid;
+proc_seteuid(VALUE obj, VALUE euid)
{
check_uid_switch();
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
@@ -3076,8 +2996,7 @@ proc_seteuid(obj, euid)
}
static VALUE
-rb_seteuid_core(euid)
- int euid;
+rb_seteuid_core(int euid)
{
int uid;
@@ -3126,8 +3045,7 @@ rb_seteuid_core(euid)
*/
static VALUE
-p_uid_grant_privilege(obj, id)
- VALUE obj, id;
+p_uid_grant_privilege(VALUE obj, VALUE id)
{
return rb_seteuid_core(NUM2INT(id));
}
@@ -3146,8 +3064,7 @@ p_uid_grant_privilege(obj, id)
*/
static VALUE
-proc_getegid(obj)
- VALUE obj;
+proc_getegid(VALUE obj)
{
int egid = getegid();
@@ -3164,8 +3081,7 @@ proc_getegid(obj)
*/
static VALUE
-proc_setegid(obj, egid)
- VALUE obj, egid;
+proc_setegid(VALUE obj, VALUE egid)
{
check_gid_switch();
@@ -3190,8 +3106,7 @@ proc_setegid(obj, egid)
}
static VALUE
-rb_setegid_core(egid)
- int egid;
+rb_setegid_core(int egid)
{
int gid;
@@ -3240,8 +3155,7 @@ rb_setegid_core(egid)
*/
static VALUE
-p_gid_grant_privilege(obj, id)
- VALUE obj, id;
+p_gid_grant_privilege(VALUE obj, VALUE id)
{
return rb_setegid_core(NUM2INT(id));
}
@@ -3257,7 +3171,7 @@ p_gid_grant_privilege(obj, id)
*/
static VALUE
-p_uid_exchangeable()
+p_uid_exchangeable(void)
{
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
return Qtrue;
@@ -3282,8 +3196,7 @@ p_uid_exchangeable()
*/
static VALUE
-p_uid_exchange(obj)
- VALUE obj;
+p_uid_exchange(VALUE obj)
{
int uid, euid;
@@ -3315,7 +3228,7 @@ p_uid_exchange(obj)
*/
static VALUE
-p_gid_exchangeable()
+p_gid_exchangeable(void)
{
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
return Qtrue;
@@ -3340,8 +3253,7 @@ p_gid_exchangeable()
*/
static VALUE
-p_gid_exchange(obj)
- VALUE obj;
+p_gid_exchange(VALUE obj)
{
int gid, egid;
@@ -3374,7 +3286,7 @@ p_gid_exchange(obj)
*/
static VALUE
-p_uid_have_saved_id()
+p_uid_have_saved_id(void)
{
#if defined(HAVE_SETRESUID) || defined(HAVE_SETEUID) || defined(_POSIX_SAVED_IDS)
return Qtrue;
@@ -3441,16 +3353,14 @@ p_uid_switch(obj)
#else
static VALUE
-p_uid_sw_ensure(obj)
- VALUE obj;
+p_uid_sw_ensure(VALUE obj)
{
under_uid_switch = 0;
return p_uid_exchange(obj);
}
static VALUE
-p_uid_switch(obj)
- VALUE obj;
+p_uid_switch(VALUE obj)
{
int uid, euid;
@@ -3486,7 +3396,7 @@ p_uid_switch(obj)
*/
static VALUE
-p_gid_have_saved_id()
+p_gid_have_saved_id(void)
{
#if defined(HAVE_SETRESGID) || defined(HAVE_SETEGID) || defined(_POSIX_SAVED_IDS)
return Qtrue;
@@ -3551,16 +3461,14 @@ p_gid_switch(obj)
}
#else
static VALUE
-p_gid_sw_ensure(obj)
- VALUE obj;
+p_gid_sw_ensure(VALUE obj)
{
under_gid_switch = 0;
return p_gid_exchange(obj);
}
static VALUE
-p_gid_switch(obj)
- VALUE obj;
+p_gid_switch(VALUE obj)
{
int gid, egid;
@@ -3597,8 +3505,7 @@ p_gid_switch(obj)
*/
VALUE
-rb_proc_times(obj)
- VALUE obj;
+rb_proc_times(VALUE obj)
{
#if defined(HAVE_TIMES) && !defined(__CHECKER__)
#ifndef HZ
@@ -3634,7 +3541,7 @@ VALUE rb_mProcID_Syscall;
*/
void
-Init_process()
+Init_process(void)
{
rb_define_virtual_variable("$$", get_pid, 0);
rb_define_readonly_variable("$?", &rb_last_status);
diff --git a/random.c b/random.c
index 618a3a8fa3..fc3af2638b 100644
--- a/random.c
+++ b/random.c
@@ -76,8 +76,7 @@ static unsigned long *next;
/* initializes state[N] with a seed */
static void
-init_genrand(s)
- unsigned long s;
+init_genrand(unsigned long s)
{
int j;
state[0]= s & 0xffffffffUL;
@@ -124,7 +123,7 @@ init_by_array(unsigned long init_key[], int key_length)
}
static void
-next_state()
+next_state(void)
{
unsigned long *p=state;
int j;
@@ -165,7 +164,7 @@ genrand_int32(void)
/* generates a random number on [0,1) with 53-bit resolution*/
static double
-genrand_real(void)
+genrand_real(void)
{
unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0);
@@ -193,8 +192,7 @@ static int first = 1;
static VALUE saved_seed = INT2FIX(0);
static VALUE
-rand_init(vseed)
- VALUE vseed;
+rand_init(VALUE vseed)
{
volatile VALUE seed;
VALUE old;
@@ -253,7 +251,7 @@ rand_init(vseed)
}
static VALUE
-random_seed()
+random_seed(void)
{
static int n = 0;
struct timeval tv;
@@ -320,10 +318,7 @@ random_seed()
*/
static VALUE
-rb_f_srand(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_f_srand(int argc, VALUE *argv, VALUE obj)
{
VALUE seed, old;
@@ -436,10 +431,7 @@ limited_big_rand(struct RBignum *limit)
*/
static VALUE
-rb_f_rand(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
+rb_f_rand(int argc, VALUE *argv, VALUE obj)
{
VALUE vmax;
long val, max;
@@ -495,7 +487,7 @@ rb_f_rand(argc, argv, obj)
}
void
-Init_Random()
+Init_Random(void)
{
rb_define_global_function("srand", rb_f_srand, -1);
rb_define_global_function("rand", rb_f_rand, -1);
diff --git a/range.c b/range.c
index c146982a6c..866a993c15 100644
--- a/range.c
+++ b/range.c
@@ -19,23 +19,20 @@ static ID id_cmp, id_succ, id_beg, id_end, id_excl;
#define SET_EXCL(r,v) rb_ivar_set((r), id_excl, (v) ? Qtrue : Qfalse)
static VALUE
-range_failed()
+range_failed(void)
{
rb_raise(rb_eArgError, "bad value for range");
return Qnil; /* dummy */
}
static VALUE
-range_check(args)
- VALUE *args;
+range_check(VALUE *args)
{
return rb_funcall(args[0], id_cmp, 1, args[1]);
}
static void
-range_init(range, beg, end, exclude_end)
- VALUE range, beg, end;
- int exclude_end;
+range_init(VALUE range, VALUE beg, VALUE end, int exclude_end)
{
VALUE args[2];
@@ -55,9 +52,7 @@ range_init(range, beg, end, exclude_end)
}
VALUE
-rb_range_new(beg, end, exclude_end)
- VALUE beg, end;
- int exclude_end;
+rb_range_new(VALUE beg, VALUE end, int exclude_end)
{
VALUE range = rb_obj_alloc(rb_cRange);
@@ -75,10 +70,7 @@ rb_range_new(beg, end, exclude_end)
*/
static VALUE
-range_initialize(argc, argv, range)
- int argc;
- VALUE *argv;
- VALUE range;
+range_initialize(int argc, VALUE *argv, VALUE range)
{
VALUE beg, end, flags;
@@ -100,8 +92,7 @@ range_initialize(argc, argv, range)
*/
static VALUE
-range_exclude_end_p(range)
- VALUE range;
+range_exclude_end_p(VALUE range)
{
return EXCL(range) ? Qtrue : Qfalse;
}
@@ -122,8 +113,7 @@ range_exclude_end_p(range)
*/
static VALUE
-range_eq(range, obj)
- VALUE range, obj;
+range_eq(VALUE range, VALUE obj)
{
if (range == obj) return Qtrue;
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
@@ -140,8 +130,7 @@ range_eq(range, obj)
}
static int
-r_lt(a, b)
- VALUE a, b;
+r_lt(VALUE a, VALUE b)
{
VALUE r = rb_funcall(a, id_cmp, 1, b);
@@ -151,8 +140,7 @@ r_lt(a, b)
}
static int
-r_le(a, b)
- VALUE a, b;
+r_le(VALUE a, VALUE b)
{
int c;
VALUE r = rb_funcall(a, id_cmp, 1, b);
@@ -180,8 +168,7 @@ r_le(a, b)
*/
static VALUE
-range_eql(range, obj)
- VALUE range, obj;
+range_eql(VALUE range, VALUE obj)
{
if (range == obj) return Qtrue;
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
@@ -207,8 +194,7 @@ range_eql(range, obj)
*/
static VALUE
-range_hash(range)
- VALUE range;
+range_hash(VALUE range)
{
long hash = EXCL(range);
VALUE v;
@@ -223,18 +209,15 @@ range_hash(range)
}
static VALUE
-str_step(args)
- VALUE *args;
+str_step(VALUE arg)
{
+ VALUE *args = (VALUE *)arg;
+
return rb_str_upto(args[0], args[1], EXCL(args[2]));
}
static void
-range_each_func(range, func, v, e, arg)
- VALUE range;
- void (*func) _((VALUE, void*));
- VALUE v, e;
- void *arg;
+range_each_func(VALUE range, VALUE (*func) (VALUE, void *), VALUE v, VALUE e, void *arg)
{
int c;
@@ -254,10 +237,10 @@ range_each_func(range, func, v, e, arg)
}
static VALUE
-step_i(i, iter)
- VALUE i;
- long *iter;
+step_i(VALUE i, void *arg)
{
+ long *iter = (long *)arg;
+
iter[0]--;
if (iter[0] == 0) {
rb_yield(i);
@@ -295,10 +278,7 @@ step_i(i, iter)
static VALUE
-range_step(argc, argv, range)
- int argc;
- VALUE *argv;
- VALUE range;
+range_step(int argc, VALUE *argv, VALUE range)
{
VALUE b, e, step;
long unit;
@@ -335,8 +315,7 @@ range_step(argc, argv, range)
b = tmp;
args[0] = b; args[1] = e; args[2] = range;
iter[0] = 1; iter[1] = unit;
- rb_iterate((VALUE(*)_((VALUE)))str_step, (VALUE)args, step_i,
- (VALUE)iter);
+ rb_iterate(str_step, (VALUE)args, step_i, (VALUE)iter);
}
else if (rb_obj_is_kind_of(b, rb_cNumeric)) {
ID c = rb_intern(EXCL(range) ? "<" : "<=");
@@ -362,12 +341,11 @@ range_step(argc, argv, range)
return range;
}
-static void
-each_i(v, arg)
- VALUE v;
- void *arg;
+static VALUE
+each_i(VALUE v, void *arg)
{
rb_yield(v);
+ return Qnil;
}
/*
@@ -389,8 +367,7 @@ each_i(v, arg)
*/
static VALUE
-range_each(range)
- VALUE range;
+range_each(VALUE range)
{
VALUE beg, end;
@@ -418,8 +395,7 @@ range_each(range)
args[0] = beg; args[1] = end; args[2] = range;
iter[0] = 1; iter[1] = 1;
- rb_iterate((VALUE(*)_((VALUE)))str_step, (VALUE)args, step_i,
- (VALUE)iter);
+ rb_iterate(str_step, (VALUE)args, step_i, (VALUE)iter);
}
else {
range_each_func(range, each_i, beg, end, NULL);
@@ -436,8 +412,7 @@ range_each(range)
*/
static VALUE
-range_first(range)
- VALUE range;
+range_first(VALUE range)
{
return rb_ivar_get(range, id_beg);
}
@@ -456,18 +431,13 @@ range_first(range)
static VALUE
-range_last(range)
- VALUE range;
+range_last(VALUE range)
{
return rb_ivar_get(range, id_end);
}
VALUE
-rb_range_beg_len(range, begp, lenp, len, err)
- VALUE range;
- long *begp, *lenp;
- long len;
- int err;
+rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
{
VALUE b, e;
long beg, end, excl;
@@ -520,8 +490,7 @@ rb_range_beg_len(range, begp, lenp, len, err)
*/
static VALUE
-range_to_s(range)
- VALUE range;
+range_to_s(VALUE range)
{
VALUE str, str2;
@@ -546,8 +515,7 @@ range_to_s(range)
static VALUE
-range_inspect(range)
- VALUE range;
+range_inspect(VALUE range)
{
VALUE str, str2;
@@ -584,8 +552,7 @@ range_inspect(range)
*/
static VALUE
-range_include(range, val)
- VALUE range, val;
+range_include(VALUE range, VALUE val)
{
VALUE beg, end;
@@ -656,7 +623,7 @@ range_include(range, val)
*/
void
-Init_Range()
+Init_Range(void)
{
rb_cRange = rb_define_class("Range", rb_cObject);
rb_include_module(rb_cRange, rb_mEnumerable);
diff --git a/re.c b/re.c
index ccc97e3689..bd76e17f7c 100644
--- a/re.c
+++ b/re.c
@@ -76,9 +76,7 @@ static const char casetable[] = {
#endif
int
-rb_memcicmp(p1, p2, len)
- char *p1, *p2;
- long len;
+rb_memcicmp(char *p1, char *p2, long len)
{
int tmp;
@@ -90,9 +88,7 @@ rb_memcicmp(p1, p2, len)
}
int
-rb_memcmp(p1, p2, len)
- char *p1, *p2;
- long len;
+rb_memcmp(char *p1, char *p2, long len)
{
if (!ruby_ignorecase) {
return memcmp(p1, p2, len);
@@ -101,9 +97,7 @@ rb_memcmp(p1, p2, len)
}
long
-rb_memsearch(x0, m, y0, n)
- char *x0, *y0;
- long m, n;
+rb_memsearch(char *x0, long m, char *y0, long n)
{
unsigned char *x = (unsigned char *)x0, *y = (unsigned char *)y0;
unsigned char *s, *e;
@@ -168,8 +162,7 @@ rb_memsearch(x0, m, y0, n)
static int reg_kcode = DEFAULT_KCODE;
static void
-kcode_euc(re)
- struct RRegexp *re;
+kcode_euc(struct RRegexp *re)
{
FL_UNSET(re, KCODE_MASK);
FL_SET(re, KCODE_EUC);
@@ -177,8 +170,7 @@ kcode_euc(re)
}
static void
-kcode_sjis(re)
- struct RRegexp *re;
+kcode_sjis(struct RRegexp *re)
{
FL_UNSET(re, KCODE_MASK);
FL_SET(re, KCODE_SJIS);
@@ -186,8 +178,7 @@ kcode_sjis(re)
}
static void
-kcode_utf8(re)
- struct RRegexp *re;
+kcode_utf8(struct RRegexp *re)
{
FL_UNSET(re, KCODE_MASK);
FL_SET(re, KCODE_UTF8);
@@ -195,8 +186,7 @@ kcode_utf8(re)
}
static void
-kcode_none(re)
- struct RRegexp *re;
+kcode_none(struct RRegexp *re)
{
FL_UNSET(re, KCODE_MASK);
FL_SET(re, KCODE_FIXED);
@@ -205,8 +195,7 @@ kcode_none(re)
static int curr_kcode;
static void
-kcode_set_option(re)
- VALUE re;
+kcode_set_option(VALUE re)
{
if (!FL_TEST(re, KCODE_FIXED)) return;
@@ -229,7 +218,7 @@ kcode_set_option(re)
}
static void
-kcode_reset_option()
+kcode_reset_option(void)
{
if (reg_kcode == curr_kcode) return;
switch (reg_kcode) {
@@ -249,9 +238,7 @@ kcode_reset_option()
}
int
-rb_reg_mbclen2(c, re)
- unsigned int c;
- VALUE re;
+rb_reg_mbclen2(unsigned int c, VALUE re)
{
int len;
unsigned char uc = (unsigned char)c;
@@ -265,8 +252,7 @@ rb_reg_mbclen2(c, re)
}
static void
-rb_reg_check(re)
- VALUE re;
+rb_reg_check(VALUE re)
{
if (!RREGEXP(re)->ptr || !RREGEXP(re)->str) {
rb_raise(rb_eTypeError, "uninitialized Regexp");
@@ -274,10 +260,7 @@ rb_reg_check(re)
}
static void
-rb_reg_expr_str(str, s, len)
- VALUE str;
- const char *s;
- long len;
+rb_reg_expr_str(VALUE str, const char *s, long len)
{
const char *p, *pend;
int need_escape = 0;
@@ -330,10 +313,7 @@ rb_reg_expr_str(str, s, len)
}
static VALUE
-rb_reg_desc(s, len, re)
- const char *s;
- long len;
- VALUE re;
+rb_reg_desc(const char *s, long len, VALUE re)
{
VALUE str = rb_str_buf_new2("/");
@@ -380,8 +360,7 @@ rb_reg_desc(s, len, re)
*/
static VALUE
-rb_reg_source(re)
- VALUE re;
+rb_reg_source(VALUE re)
{
VALUE str;
@@ -403,8 +382,7 @@ rb_reg_source(re)
*/
static VALUE
-rb_reg_inspect(re)
- VALUE re;
+rb_reg_inspect(VALUE re)
{
rb_reg_check(re);
return rb_reg_desc(RREGEXP(re)->str, RREGEXP(re)->len, re);
@@ -432,8 +410,7 @@ rb_reg_inspect(re)
*/
static VALUE
-rb_reg_to_s(re)
- VALUE re;
+rb_reg_to_s(VALUE re)
{
int options;
const int embeddable = ONIG_OPTION_MULTILINE|ONIG_OPTION_IGNORECASE|ONIG_OPTION_EXTEND;
@@ -530,12 +507,7 @@ rb_reg_to_s(re)
}
static void
-rb_reg_raise(s, len, err, re, ce)
- const char *s;
- long len;
- const char *err;
- VALUE re;
- int ce;
+rb_reg_raise(const char *s, long len, const char *err, VALUE re, int ce)
{
VALUE desc = rb_reg_desc(s, len, re);
@@ -554,8 +526,7 @@ rb_reg_raise(s, len, err, re, ce)
*/
static VALUE
-rb_reg_casefold_p(re)
- VALUE re;
+rb_reg_casefold_p(VALUE re)
{
rb_reg_check(re);
if (RREGEXP(re)->ptr->options & ONIG_OPTION_IGNORECASE) return Qtrue;
@@ -587,8 +558,7 @@ rb_reg_casefold_p(re)
*/
static VALUE
-rb_reg_options_m(re)
- VALUE re;
+rb_reg_options_m(VALUE re)
{
int options = rb_reg_options(re);
return INT2NUM(options);
@@ -603,8 +573,7 @@ rb_reg_options_m(re)
*/
static VALUE
-rb_reg_kcode_m(re)
- VALUE re;
+rb_reg_kcode_m(VALUE re)
{
char *kcode;
@@ -628,11 +597,7 @@ rb_reg_kcode_m(re)
}
static Regexp*
-make_regexp(s, len, flags, ce)
- const char *s;
- long len;
- int flags;
- int ce;
+make_regexp(const char *s, long len, int flags, int ce)
{
Regexp *rp;
char err[ONIG_MAX_ERROR_MESSAGE_LEN];
@@ -682,10 +647,8 @@ make_regexp(s, len, flags, ce)
static VALUE rb_cMatch;
-static VALUE match_alloc _((VALUE));
static VALUE
-match_alloc(klass)
- VALUE klass;
+match_alloc(VALUE klass)
{
NEWOBJ(match, struct RMatch);
OBJSETUP(match, klass, T_MATCH);
@@ -700,8 +663,7 @@ match_alloc(klass)
/* :nodoc: */
static VALUE
-match_init_copy(obj, orig)
- VALUE obj, orig;
+match_init_copy(VALUE obj, VALUE orig)
{
if (obj == orig) return obj;
@@ -730,8 +692,7 @@ match_init_copy(obj, orig)
*/
static VALUE
-match_size(match)
- VALUE match;
+match_size(VALUE match)
{
return INT2FIX(RMATCH(match)->regs->num_regs);
}
@@ -750,8 +711,7 @@ match_size(match)
*/
static VALUE
-match_offset(match, n)
- VALUE match, n;
+match_offset(VALUE match, VALUE n)
{
int i = NUM2INT(n);
@@ -779,8 +739,7 @@ match_offset(match, n)
*/
static VALUE
-match_begin(match, n)
- VALUE match, n;
+match_begin(VALUE match, VALUE n)
{
int i = NUM2INT(n);
@@ -807,8 +766,7 @@ match_begin(match, n)
*/
static VALUE
-match_end(match, n)
- VALUE match, n;
+match_end(VALUE match, VALUE n)
{
int i = NUM2INT(n);
@@ -824,8 +782,7 @@ match_end(match, n)
#define MATCH_BUSY FL_USER2
void
-rb_match_busy(match)
- VALUE match;
+rb_match_busy(VALUE match)
{
FL_SET(match, MATCH_BUSY);
}
@@ -834,8 +791,7 @@ int ruby_ignorecase;
static int may_need_recompile;
static void
-rb_reg_prepare_re(re)
- VALUE re;
+rb_reg_prepare_re(VALUE re)
{
int need_recompile = 0;
int state;
@@ -885,9 +841,7 @@ rb_reg_prepare_re(re)
}
long
-rb_reg_adjust_startpos(re, str, pos, reverse)
- VALUE re, str;
- long pos, reverse;
+rb_reg_adjust_startpos(VALUE re, VALUE str, long pos, long reverse)
{
long range;
OnigEncoding enc;
@@ -926,9 +880,7 @@ rb_reg_adjust_startpos(re, str, pos, reverse)
}
long
-rb_reg_search(re, str, pos, reverse)
- VALUE re, str;
- long pos, reverse;
+rb_reg_search(VALUE re, VALUE str, long pos, long reverse)
{
long result;
VALUE match;
@@ -998,9 +950,7 @@ rb_reg_search(re, str, pos, reverse)
}
VALUE
-rb_reg_nth_defined(nth, match)
- int nth;
- VALUE match;
+rb_reg_nth_defined(int nth, VALUE match)
{
if (NIL_P(match)) return Qnil;
if (nth >= RMATCH(match)->regs->num_regs) {
@@ -1015,9 +965,7 @@ rb_reg_nth_defined(nth, match)
}
VALUE
-rb_reg_nth_match(nth, match)
- int nth;
- VALUE match;
+rb_reg_nth_match(int nth, VALUE match)
{
VALUE str;
long start, end, len;
@@ -1040,8 +988,7 @@ rb_reg_nth_match(nth, match)
}
VALUE
-rb_reg_last_match(match)
- VALUE match;
+rb_reg_last_match(VALUE match)
{
return rb_reg_nth_match(0, match);
}
@@ -1059,8 +1006,7 @@ rb_reg_last_match(match)
*/
VALUE
-rb_reg_match_pre(match)
- VALUE match;
+rb_reg_match_pre(VALUE match)
{
VALUE str;
@@ -1084,8 +1030,7 @@ rb_reg_match_pre(match)
*/
VALUE
-rb_reg_match_post(match)
- VALUE match;
+rb_reg_match_post(VALUE match)
{
VALUE str;
long pos;
@@ -1100,8 +1045,7 @@ rb_reg_match_post(match)
}
VALUE
-rb_reg_match_last(match)
- VALUE match;
+rb_reg_match_last(VALUE match)
{
int i;
@@ -1115,33 +1059,31 @@ rb_reg_match_last(match)
}
static VALUE
-last_match_getter()
+last_match_getter(void)
{
return rb_reg_last_match(rb_backref_get());
}
static VALUE
-prematch_getter()
+prematch_getter(void)
{
return rb_reg_match_pre(rb_backref_get());
}
static VALUE
-postmatch_getter()
+postmatch_getter(void)
{
return rb_reg_match_post(rb_backref_get());
}
static VALUE
-last_paren_match_getter()
+last_paren_match_getter(void)
{
return rb_reg_match_last(rb_backref_get());
}
static VALUE
-match_array(match, start)
- VALUE match;
- int start;
+match_array(VALUE match, int start)
{
struct re_registers *regs = RMATCH(match)->regs;
VALUE ary = rb_ary_new2(regs->num_regs);
@@ -1190,8 +1132,7 @@ match_array(match, start)
*/
static VALUE
-match_to_a(match)
- VALUE match;
+match_to_a(VALUE match)
{
return match_array(match, 0);
}
@@ -1210,8 +1151,7 @@ match_to_a(match)
* f4 #=> "8"
*/
static VALUE
-match_captures(match)
- VALUE match;
+match_captures(VALUE match)
{
return match_array(match, 1);
}
@@ -1237,10 +1177,7 @@ match_captures(match)
*/
static VALUE
-match_aref(argc, argv, match)
- int argc;
- VALUE *argv;
- VALUE match;
+match_aref(int argc, VALUE *argv, VALUE match)
{
VALUE idx, rest;
@@ -1252,11 +1189,8 @@ match_aref(argc, argv, match)
return rb_reg_nth_match(FIX2INT(idx), match);
}
-static VALUE match_entry _((VALUE, long));
static VALUE
-match_entry(match, n)
- VALUE match;
- long n;
+match_entry(VALUE match, long n)
{
return rb_reg_nth_match(n, match);
}
@@ -1275,10 +1209,7 @@ match_entry(match, n)
*/
static VALUE
-match_values_at(argc, argv, match)
- int argc;
- VALUE *argv;
- VALUE match;
+match_values_at(int argc, VALUE *argv, VALUE match)
{
return rb_get_values_at(match, RMATCH(match)->regs->num_regs, argc, argv, match_entry);
}
@@ -1297,10 +1228,7 @@ match_values_at(argc, argv, match)
*/
static VALUE
-match_select(argc, argv, match)
- int argc;
- VALUE *argv;
- VALUE match;
+match_select(int argc, VALUE *argv, VALUE match)
{
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
@@ -1335,8 +1263,7 @@ match_select(argc, argv, match)
*/
static VALUE
-match_to_s(match)
- VALUE match;
+match_to_s(VALUE match)
{
VALUE str = rb_reg_last_match(match);
@@ -1358,8 +1285,7 @@ match_to_s(match)
*/
static VALUE
-match_string(match)
- VALUE match;
+match_string(VALUE match)
{
return RMATCH(match)->str; /* str is frozen */
}
@@ -1367,18 +1293,15 @@ match_string(match)
VALUE rb_cRegexp;
static void
-rb_reg_initialize(obj, s, len, options, ce)
- VALUE obj;
- const char *s;
- long len;
- int options; /* CASEFOLD = 1 */
+rb_reg_initialize(VALUE obj, const char *s, long len,
+ int options, /* CASEFOLD = 1 */
/* EXTENDED = 2 */
/* MULTILINE = 4 */
/* CODE_NONE = 16 */
/* CODE_EUC = 32 */
/* CODE_SJIS = 48 */
/* CODE_UTF8 = 64 */
- int ce; /* call rb_compile_error() */
+ int ce) /* call rb_compile_error() */
{
struct RRegexp *re = RREGEXP(obj);
@@ -1423,10 +1346,8 @@ rb_reg_initialize(obj, s, len, options, ce)
}
}
-static VALUE rb_reg_s_alloc _((VALUE));
static VALUE
-rb_reg_s_alloc(klass)
- VALUE klass;
+rb_reg_s_alloc(VALUE klass)
{
NEWOBJ(re, struct RRegexp);
OBJSETUP(re, klass, T_REGEXP);
@@ -1439,10 +1360,7 @@ rb_reg_s_alloc(klass)
}
VALUE
-rb_reg_new(s, len, options)
- const char *s;
- long len;
- int options;
+rb_reg_new(const char *s, long len, int options)
{
VALUE re = rb_reg_s_alloc(rb_cRegexp);
@@ -1451,10 +1369,7 @@ rb_reg_new(s, len, options)
}
VALUE
-rb_reg_compile(s, len, options)
- const char *s;
- long len;
- int options;
+rb_reg_compile(const char *s, long len, int options)
{
VALUE re = rb_reg_s_alloc(rb_cRegexp);
@@ -1467,8 +1382,7 @@ static int kcode_cache;
static VALUE reg_cache;
VALUE
-rb_reg_regcomp(str)
- VALUE str;
+rb_reg_regcomp(VALUE str)
{
if (reg_cache && RREGEXP(reg_cache)->len == RSTRING(str)->len
&& case_cache == ruby_ignorecase
@@ -1483,8 +1397,7 @@ rb_reg_regcomp(str)
}
static int
-rb_reg_cur_kcode(re)
- VALUE re;
+rb_reg_cur_kcode(VALUE re)
{
if (FL_TEST(re, KCODE_FIXED)) {
return RBASIC(re)->flags & KCODE_MASK;
@@ -1500,8 +1413,7 @@ rb_reg_cur_kcode(re)
*/
static VALUE
-rb_reg_hash(re)
- VALUE re;
+rb_reg_hash(VALUE re)
{
int hashval, len;
char *p;
@@ -1534,8 +1446,7 @@ rb_reg_hash(re)
*/
static VALUE
-rb_reg_equal(re1, re2)
- VALUE re1, re2;
+rb_reg_equal(VALUE re1, VALUE re2)
{
if (re1 == re2) return Qtrue;
if (TYPE(re2) != T_REGEXP) return Qfalse;
@@ -1550,9 +1461,7 @@ rb_reg_equal(re1, re2)
}
static VALUE
-rb_reg_match_pos(re, str, pos)
- VALUE re, str;
- long pos;
+rb_reg_match_pos(VALUE re, VALUE str, long pos)
{
if (NIL_P(str)) {
rb_backref_set(Qnil);
@@ -1585,8 +1494,7 @@ rb_reg_match_pos(re, str, pos)
*/
VALUE
-rb_reg_match(re, str)
- VALUE re, str;
+rb_reg_match(VALUE re, VALUE str)
{
return rb_reg_match_pos(re, str, 0);
}
@@ -1610,8 +1518,7 @@ rb_reg_match(re, str)
*/
VALUE
-rb_reg_eqq(re, str)
- VALUE re, str;
+rb_reg_eqq(VALUE re, VALUE str)
{
long start;
@@ -1643,8 +1550,7 @@ rb_reg_eqq(re, str)
*/
VALUE
-rb_reg_match2(re)
- VALUE re;
+rb_reg_match2(VALUE re)
{
long start;
VALUE line = rb_lastline_get();
@@ -1678,10 +1584,7 @@ rb_reg_match2(re)
*/
static VALUE
-rb_reg_match_m(argc, argv, re)
- int argc;
- VALUE *argv;
- VALUE re;
+rb_reg_match_m(int argc, VALUE *argv, VALUE re)
{
VALUE result, str, initpos;
long pos;
@@ -1735,10 +1638,7 @@ rb_reg_match_m(argc, argv, re)
*/
static VALUE
-rb_reg_initialize_m(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
{
const char *s;
long len;
@@ -1809,8 +1709,7 @@ rb_reg_initialize_m(argc, argv, self)
}
VALUE
-rb_reg_quote(str)
- VALUE str;
+rb_reg_quote(VALUE str)
{
char *s, *send, *t;
VALUE tmp;
@@ -1908,9 +1807,7 @@ rb_reg_quote(str)
*/
static VALUE
-rb_reg_s_quote(argc, argv)
- int argc;
- VALUE *argv;
+rb_reg_s_quote(int argc, VALUE *argv)
{
VALUE str, kcode;
int kcode_saved = reg_kcode;
@@ -1928,7 +1825,7 @@ rb_reg_s_quote(argc, argv)
}
int
-rb_kcode()
+rb_kcode(void)
{
switch (reg_kcode) {
case KCODE_EUC:
@@ -1944,8 +1841,7 @@ rb_kcode()
}
static int
-rb_reg_get_kcode(re)
- VALUE re;
+rb_reg_get_kcode(VALUE re)
{
switch (RBASIC(re)->flags & KCODE_MASK) {
case KCODE_NONE:
@@ -1962,8 +1858,7 @@ rb_reg_get_kcode(re)
}
int
-rb_reg_options(re)
- VALUE re;
+rb_reg_options(VALUE re)
{
int options;
@@ -1992,9 +1887,7 @@ rb_reg_options(re)
* Regexp.union(/dogs/, /cats/i) #=> /(?-mix:dogs)|(?i-mx:cats)/
*/
static VALUE
-rb_reg_s_union(argc, argv)
- int argc;
- VALUE *argv;
+rb_reg_s_union(int argc, VALUE *argv)
{
if (argc == 0) {
VALUE args[1];
@@ -2069,8 +1962,7 @@ rb_reg_s_union(argc, argv)
/* :nodoc: */
static VALUE
-rb_reg_init_copy(copy, re)
- VALUE copy, re;
+rb_reg_init_copy(VALUE copy, VALUE re)
{
if (copy == re) return copy;
rb_check_frozen(copy);
@@ -2085,9 +1977,7 @@ rb_reg_init_copy(copy, re)
}
VALUE
-rb_reg_regsub(str, src, regs)
- VALUE str, src;
- struct re_registers *regs;
+rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs)
{
VALUE val = 0;
char *p, *s, *e;
@@ -2172,7 +2062,7 @@ rb_reg_regsub(str, src, regs)
}
const char*
-rb_get_kcode()
+rb_get_kcode(void)
{
switch (reg_kcode) {
case KCODE_SJIS:
@@ -2187,14 +2077,13 @@ rb_get_kcode()
}
static VALUE
-kcode_getter()
+kcode_getter(void)
{
return rb_str_new2(rb_get_kcode());
}
void
-rb_set_kcode(code)
- const char *code;
+rb_set_kcode(const char *code)
{
if (code == 0) goto set_no_conversion;
@@ -2227,23 +2116,20 @@ rb_set_kcode(code)
}
static void
-kcode_setter(val)
- VALUE val;
+kcode_setter(VALUE val)
{
may_need_recompile = 1;
rb_set_kcode(StringValuePtr(val));
}
static VALUE
-ignorecase_getter()
+ignorecase_getter(void)
{
return ruby_ignorecase?Qtrue:Qfalse;
}
static void
-ignorecase_setter(val, id)
- VALUE val;
- ID id;
+ignorecase_setter(VALUE val, ID id)
{
rb_warn("modifying %s is deprecated", rb_id2name(id));
may_need_recompile = 1;
@@ -2251,7 +2137,7 @@ ignorecase_setter(val, id)
}
static VALUE
-match_getter()
+match_getter(void)
{
VALUE match = rb_backref_get();
@@ -2261,8 +2147,7 @@ match_getter()
}
static void
-match_setter(val)
- VALUE val;
+match_setter(VALUE val)
{
if (!NIL_P(val)) {
Check_Type(val, T_MATCH);
@@ -2288,9 +2173,7 @@ match_setter(val)
*/
static VALUE
-rb_reg_s_last_match(argc, argv)
- int argc;
- VALUE *argv;
+rb_reg_s_last_match(int argc, VALUE *argv)
{
VALUE nth;
@@ -2312,7 +2195,7 @@ rb_reg_s_last_match(argc, argv)
*/
void
-Init_Regexp()
+Init_Regexp(void)
{
rb_eRegexpError = rb_define_class("RegexpError", rb_eStandardError);
diff --git a/regcomp.c b/regcomp.c
index a2315fcec5..15dc42cc13 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -34,7 +34,7 @@ OnigAmbigType OnigDefaultAmbigFlag =
ONIGENC_AMBIGUOUS_MATCH_NONASCII_CASE);
extern OnigAmbigType
-onig_get_default_ambig_flag()
+onig_get_default_ambig_flag(void)
{
return OnigDefaultAmbigFlag;
}
@@ -4959,7 +4959,7 @@ onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
}
extern int
-onig_init()
+onig_init(void)
{
if (onig_inited != 0)
return 0;
@@ -4981,9 +4981,9 @@ onig_init()
extern int
-onig_end()
+onig_end(void)
{
- extern int onig_free_shared_cclass_table();
+ extern int onig_free_shared_cclass_table(void);
THREAD_ATOMIC_START;
diff --git a/regenc.c b/regenc.c
index a767ca60b6..955dfeecf6 100644
--- a/regenc.c
+++ b/regenc.c
@@ -32,13 +32,13 @@
OnigEncoding OnigEncDefaultCharEncoding = ONIG_ENCODING_INIT_DEFAULT;
extern int
-onigenc_init()
+onigenc_init(void)
{
return 0;
}
extern OnigEncoding
-onigenc_get_default_encoding()
+onigenc_get_default_encoding(void)
{
return OnigEncDefaultCharEncoding;
}
diff --git a/regerror.c b/regerror.c
index 560b5e12c5..348b7b30ed 100644
--- a/regerror.c
+++ b/regerror.c
@@ -30,13 +30,7 @@
#include "regint.h"
#include <stdio.h> /* for vsnprintf() */
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
extern char*
onig_error_code_to_format(int code)
@@ -185,21 +179,14 @@ onig_error_code_to_format(int code)
#define MAX_ERROR_PAR_LEN 30
extern int
-#ifdef HAVE_STDARG_PROTOTYPES
onig_error_code_to_str(UChar* s, int code, ...)
-#else
-onig_error_code_to_str(s, code, va_alist)
- UChar* s;
- int code;
- va_dcl
-#endif
{
UChar *p, *q;
OnigErrorInfo* einfo;
int len;
va_list vargs;
- va_init_list(vargs, code);
+ va_start(vargs, code);
switch (code) {
case ONIGERR_UNDEFINED_NAME_REFERENCE:
@@ -255,26 +242,15 @@ onig_error_code_to_str(s, code, va_alist)
void
-#ifdef HAVE_STDARG_PROTOTYPES
onig_snprintf_with_pattern(char buf[], int bufsize, OnigEncoding enc,
char* pat, char* pat_end, char *fmt, ...)
-#else
-onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
- char buf[];
- int bufsize;
- OnigEncoding enc;
- char* pat;
- char* pat_end;
- const char *fmt;
- va_dcl
-#endif
{
int n, need, len;
UChar *p, *s, *bp;
char bs[6];
va_list args;
- va_init_list(args, fmt);
+ va_start(args, fmt);
n = vsnprintf(buf, bufsize, fmt, args);
va_end(args);
diff --git a/regexec.c b/regexec.c
index e9f6a2b995..3c377d67bb 100644
--- a/regexec.c
+++ b/regexec.c
@@ -227,7 +227,7 @@ onig_region_init(OnigRegion* region)
}
extern OnigRegion*
-onig_region_new()
+onig_region_new(void)
{
OnigRegion* r;
diff --git a/regparse.c b/regparse.c
index 8186bbe589..7a95ded5ea 100644
--- a/regparse.c
+++ b/regparse.c
@@ -1050,7 +1050,7 @@ onig_node_free(Node* node)
#ifdef USE_RECYCLE_NODE
extern int
-onig_free_node_list()
+onig_free_node_list(void)
{
FreeNode* n;
@@ -1066,7 +1066,7 @@ onig_free_node_list()
#endif
static Node*
-node_new()
+node_new(void)
{
Node* node;
@@ -1094,7 +1094,7 @@ initialize_cclass(CClassNode* cc)
}
static Node*
-node_new_cclass()
+node_new_cclass(void)
{
Node* node = node_new();
CHECK_NULL_RETURN(node);
@@ -1163,7 +1163,7 @@ node_new_ctype(int type)
}
static Node*
-node_new_anychar()
+node_new_anychar(void)
{
Node* node = node_new();
CHECK_NULL_RETURN(node);
@@ -1434,7 +1434,7 @@ node_new_str_raw(UChar* s, UChar* end)
}
static Node*
-node_new_empty()
+node_new_empty(void)
{
return node_new_str(NULL, NULL);
}
@@ -4660,7 +4660,7 @@ i_free_shared_class(type_cclass_key* key, Node* node, void* arg)
}
extern int
-onig_free_shared_cclass_table()
+onig_free_shared_cclass_table(void)
{
if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
diff --git a/regparse.h b/regparse.h
index 1a4ac7dea2..f68d07a67f 100644
--- a/regparse.h
+++ b/regparse.h
@@ -303,7 +303,7 @@ extern Node* onig_node_new_anchor P_((int type));
extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
extern Node* onig_node_new_list P_((Node* left, Node* right));
extern void onig_node_str_clear P_((Node* node));
-extern int onig_free_node_list();
+extern int onig_free_node_list(void);
extern int onig_names_free P_((regex_t* reg));
extern int onig_parse_make_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env));
diff --git a/ruby.c b/ruby.c
index 2058efb5db..7682d1e1a4 100644
--- a/ruby.c
+++ b/ruby.c
@@ -74,8 +74,7 @@ static int origargc;
static char **origargv;
static void
-usage(name)
- const char *name;
+usage(const char *name)
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */
@@ -119,9 +118,7 @@ extern VALUE rb_load_path;
#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__
static char *
-rubylib_mangle(s, l)
- char *s;
- unsigned int l;
+rubylib_mangle(char *s, unsigned int l)
{
static char *newp, *oldp;
static int newl, oldl, notfound;
@@ -178,9 +175,7 @@ rubylib_mangle(s, l)
#endif
void
-ruby_push_include(path, filter)
- const char *path;
- VALUE (*filter)_((VALUE));
+ruby_push_include(const char *path, VALUE (*filter) (VALUE))
{
const char sep = PATH_SEP_CHAR;
@@ -216,8 +211,7 @@ ruby_push_include(path, filter)
}
static VALUE
-identical_path(path)
- VALUE path;
+identical_path(VALUE path)
{
return path;
}
@@ -229,8 +223,7 @@ ruby_incpush(const char *path)
}
static VALUE
-expand_include_path(path)
- VALUE path;
+expand_include_path(VALUE path)
{
char *p = RSTRING(path)->ptr;
if (!p) return path;
@@ -250,12 +243,8 @@ ruby_incpush_expand(const char *path)
#endif
#if defined DOSISH || defined __CYGWIN__
-static inline void translate_char _((char *, int, int));
-
static inline void
-translate_char(p, from, to)
- char *p;
- int from, to;
+translate_char(char *p, int from, int to)
{
while (*p) {
if ((unsigned char)*p == from)
@@ -270,7 +259,7 @@ translate_char(p, from, to)
#endif
void
-ruby_init_loadpath()
+ruby_init_loadpath(void)
{
#if defined LOAD_RELATIVE
char libpath[MAXPATHLEN+1];
@@ -353,8 +342,7 @@ struct req_list {
static struct req_list req_list_head, *req_list_last = &req_list_head;
static void
-add_modules(mod)
- const char *mod;
+add_modules(const char *mod)
{
struct req_list *list;
@@ -369,7 +357,7 @@ add_modules(mod)
extern void Init_ext _((void));
static void
-require_libraries()
+require_libraries(void)
{
extern NODE *ruby_eval_tree;
NODE *save[3];
@@ -404,7 +392,7 @@ require_libraries()
}
static void
-process_sflag()
+process_sflag(void)
{
if (sflag) {
long n;
@@ -465,8 +453,7 @@ process_sflag()
static void proc_options _((int argc, char **argv));
static char*
-moreswitches(s)
- char *s;
+moreswitches(char *s)
{
int argc; char *argv[3];
char *p = s;
@@ -487,9 +474,7 @@ moreswitches(s)
NODE *ruby_eval_tree;
static void
-proc_options(argc, argv)
- int argc;
- char **argv;
+proc_options(int argc, char **argv)
{
char *argv0 = argv[0];
int do_search;
@@ -865,9 +850,7 @@ proc_options(argc, argv)
}
static void
-load_file(fname, script)
- const char *fname;
- int script;
+load_file(const char *fname, int script)
{
extern VALUE rb_stdin;
VALUE parser;
@@ -994,14 +977,13 @@ load_file(fname, script)
}
void
-rb_load_file(fname)
- const char *fname;
+rb_load_file(const char *fname)
{
load_file(fname, 0);
}
static void
-load_stdin()
+load_stdin(void)
{
forbid_setid("program input from stdin");
load_file("-", 1);
@@ -1039,9 +1021,7 @@ set_arg0space()
#endif
static void
-set_arg0(val, id)
- VALUE val;
- ID id;
+set_arg0(VALUE val, ID id)
{
char *s;
long i;
@@ -1115,8 +1095,7 @@ set_arg0(val, id)
}
void
-ruby_script(name)
- const char *name;
+ruby_script(const char *name)
{
if (name) {
rb_progname = rb_tainted_str_new2(name);
@@ -1127,7 +1106,7 @@ ruby_script(name)
static int uid, euid, gid, egid;
static void
-init_ids()
+init_ids(void)
{
uid = (int)getuid();
euid = (int)geteuid();
@@ -1143,8 +1122,7 @@ init_ids()
}
static void
-forbid_setid(s)
- const char *s;
+forbid_setid(const char *s)
{
if (euid != uid)
rb_raise(rb_eSecurityError, "no %s allowed while running setuid", s);
@@ -1155,18 +1133,13 @@ forbid_setid(s)
}
static void
-verbose_setter(val, id, variable)
- VALUE val;
- ID id;
- VALUE *variable;
+verbose_setter(VALUE val, ID id, VALUE *variable)
{
ruby_verbose = RTEST(val) ? Qtrue : val;
}
static VALUE
-opt_W_getter(val, id)
- VALUE val;
- ID id;
+opt_W_getter(VALUE val, ID id)
{
if (ruby_verbose == Qnil) return INT2FIX(0);
if (ruby_verbose == Qfalse) return INT2FIX(1);
@@ -1175,7 +1148,7 @@ opt_W_getter(val, id)
}
void
-ruby_prog_init()
+ruby_prog_init(void)
{
init_ids();
@@ -1209,9 +1182,7 @@ ruby_prog_init()
}
void
-ruby_set_argv(argc, argv)
- int argc;
- char **argv;
+ruby_set_argv(int argc, char **argv)
{
int i;
@@ -1232,9 +1203,7 @@ NODE *rb_parser_append_print _((NODE*));
NODE *rb_parser_while_loop _((NODE*, int, int));
void
-ruby_process_options(argc, argv)
- int argc;
- char **argv;
+ruby_process_options(int argc, char **argv)
{
origargc = argc; origargv = argv;
diff --git a/signal.c b/signal.c
index dc71b36317..36634a9c47 100644
--- a/signal.c
+++ b/signal.c
@@ -169,8 +169,7 @@ static struct signals {
};
static int
-signm2signo(nm)
- char *nm;
+signm2signo(char *nm)
{
struct signals *sigs;
@@ -181,8 +180,7 @@ signm2signo(nm)
}
static char*
-signo2signm(no)
- int no;
+signo2signm(int no)
{
struct signals *sigs;
@@ -193,8 +191,7 @@ signo2signm(no)
}
const char *
-ruby_signal_name(no)
- int no;
+ruby_signal_name(int no)
{
return signo2signm(no);
}
@@ -224,9 +221,7 @@ ruby_signal_name(no)
*/
VALUE
-rb_f_kill(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_kill(int argc, VALUE *argv)
{
int negative = 0;
int sig;
@@ -310,7 +305,7 @@ rb_atomic_t rb_trap_immediate;
int rb_prohibit_interrupt = 1;
void
-rb_gc_mark_trap_list()
+rb_gc_mark_trap_list(void)
{
#ifndef MACOS_UNUSE_SIGNAL
int i;
@@ -382,9 +377,7 @@ posix_nativethread_signal(signum, handler)
#define ruby_signal(sig,handler) (rb_trap_accept_nativethreads[sig] = 0, signal((sig),(handler)))
#ifdef HAVE_NATIVETHREAD
static sighandler_t
-ruby_nativethread_signal(signum, handler)
- int signum;
- sighandler_t handler;
+ruby_nativethread_signal(int signum, sighandler_t handler)
{
sighandler_t old;
@@ -395,10 +388,8 @@ ruby_nativethread_signal(signum, handler)
#endif
#endif
-static void signal_exec _((int sig));
static void
-signal_exec(sig)
- int sig;
+signal_exec(int sig)
{
if (trap_list[sig].cmd == 0) {
switch (sig) {
@@ -433,8 +424,7 @@ signal_exec(sig)
}
static void
-sigsend_to_ruby_thread(sig)
- int sig;
+sigsend_to_ruby_thread(int sig)
{
#ifdef HAVE_NATIVETHREAD_KILL
# ifdef HAVE_SIGPROCMASK
@@ -457,8 +447,7 @@ sigsend_to_ruby_thread(sig)
static RETSIGTYPE sighandler _((int));
static RETSIGTYPE
-sighandler(sig)
- int sig;
+sighandler(int sig)
{
#ifdef _WIN32
#define IN_MAIN_CONTEXT(f, a) (rb_w32_main_context(a, f) ? (void)0 : f(a))
@@ -495,10 +484,8 @@ sighandler(sig)
}
#ifdef SIGBUS
-static RETSIGTYPE sigbus _((int));
static RETSIGTYPE
-sigbus(sig)
- int sig;
+sigbus(int sig)
{
#if defined(HAVE_NATIVETHREAD) && defined(HAVE_NATIVETHREAD_KILL)
if (!is_ruby_native_thread() && !rb_trap_accept_nativethreads[sig]) {
@@ -512,10 +499,8 @@ sigbus(sig)
#endif
#ifdef SIGSEGV
-static RETSIGTYPE sigsegv _((int));
static RETSIGTYPE
-sigsegv(sig)
- int sig;
+sigsegv(int sig)
{
#if defined(HAVE_NATIVETHREAD) && defined(HAVE_NATIVETHREAD_KILL)
if (!is_ruby_native_thread() && !rb_trap_accept_nativethreads[sig]) {
@@ -529,17 +514,15 @@ sigsegv(sig)
#endif
#ifdef SIGPIPE
-static RETSIGTYPE sigpipe _((int));
static RETSIGTYPE
-sigpipe(sig)
- int sig;
+sigpipe(int sig)
{
/* do nothing */
}
#endif
void
-rb_trap_exit()
+rb_trap_exit(void)
{
#ifndef MACOS_UNUSE_SIGNAL
if (trap_list[0].cmd) {
@@ -552,7 +535,7 @@ rb_trap_exit()
}
void
-rb_trap_exec()
+rb_trap_exec(void)
{
#ifndef MACOS_UNUSE_SIGNAL
int i;
@@ -585,8 +568,7 @@ static int trap_last_mask;
# endif
static VALUE
-trap(arg)
- struct trap_arg *arg;
+trap(struct trap_arg *arg)
{
sighandler_t func, oldfunc;
VALUE command, tmp, oldcmd;
@@ -740,7 +722,7 @@ trap_ensure(arg)
#endif
void
-rb_trap_restore_mask()
+rb_trap_restore_mask(void)
{
#ifndef _WIN32
# ifdef HAVE_SIGPROCMASK
@@ -780,9 +762,7 @@ rb_trap_restore_mask()
* Terminating: 27460
*/
static VALUE
-sig_trap(argc, argv)
- int argc;
- VALUE *argv;
+sig_trap(int argc, VALUE *argv)
{
struct trap_arg arg;
@@ -827,7 +807,7 @@ sig_trap(argc, argv)
* Signal.list #=> {"ABRT"=>6, "ALRM"=>14, "BUS"=>7, "CHLD"=>17, "CLD"=>17, "CONT"=>18, "FPE"=>8, "HUP"=>1, "ILL"=>4, "INT"=>2, "IO"=>29, "IOT"=>6, "KILL"=>9, "PIPE"=>13, "POLL"=>29, "PROF"=>27, "PWR"=>30, "QUIT"=>3, "SEGV"=>11, "STOP"=>19, "SYS"=>31, "TERM"=>15, "TRAP"=>5, "TSTP"=>20, "TTIN"=>21, "TTOU"=>22, "URG"=>23, "USR1"=>10, "USR2"=>12, "VTALRM"=>26, "WINCH"=>28, "XCPU"=>24, "XFSZ"=>25}
*/
static VALUE
-sig_list()
+sig_list(void)
{
VALUE h = rb_hash_new();
struct signals *sigs;
@@ -839,9 +819,7 @@ sig_list()
}
static void
-install_sighandler(signum, handler)
- int signum;
- sighandler_t handler;
+install_sighandler(int signum, sighandler_t handler)
{
sighandler_t old;
@@ -853,9 +831,7 @@ install_sighandler(signum, handler)
#ifdef HAVE_NATIVETHREAD
static void
-install_nativethread_sighandler(signum, handler)
- int signum;
- sighandler_t handler;
+install_nativethread_sighandler(int signum, sighandler_t handler)
{
sighandler_t old;
int old_st;
@@ -873,8 +849,7 @@ install_nativethread_sighandler(signum, handler)
#endif
static void
-init_sigchld(sig)
- int sig;
+init_sigchld(int sig)
{
sighandler_t oldfunc;
#ifndef _WIN32
@@ -952,7 +927,7 @@ init_sigchld(sig)
* systems; in particular signal delivery may not always be reliable.
*/
void
-Init_signal()
+Init_signal(void)
{
#ifndef MACOS_UNUSE_SIGNAL
VALUE mSignal = rb_define_module("Signal");
diff --git a/sprintf.c b/sprintf.c
index 129c4b78a9..9967f18d4e 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -15,22 +15,14 @@
#include "ruby.h"
#include <ctype.h>
#include <math.h>
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
static void fmt_setup _((char*,int,int,int,int));
static char*
-remove_sign_bits(str, base)
- char *str;
- int base;
+remove_sign_bits(char *str, int base)
{
char *s, *t;
@@ -61,9 +53,7 @@ remove_sign_bits(str, base)
}
static char
-sign_bits(base, p)
- int base;
- const char *p;
+sign_bits(int base, const char *p)
{
char c = '.';
@@ -241,18 +231,13 @@ sign_bits(base, p)
*/
VALUE
-rb_f_sprintf(argc, argv)
- int argc;
- const VALUE *argv;
+rb_f_sprintf(int argc, const VALUE *argv)
{
return rb_str_format(argc - 1, argv + 1, GETNTHARG(0));
}
VALUE
-rb_str_format(argc, argv, fmt)
- int argc;
- const VALUE *argv;
- VALUE fmt;
+rb_str_format(int argc, const VALUE *argv, VALUE fmt)
{
const char *p, *end;
char *buf;
@@ -805,10 +790,7 @@ rb_str_format(argc, argv, fmt)
}
static void
-fmt_setup(buf, c, flags, width, prec)
- char *buf;
- int c;
- int flags, width, prec;
+fmt_setup(char *buf, int c, int flags, int width, int prec)
{
*buf++ = '%';
if (flags & FSHARP) *buf++ = '#';
@@ -852,9 +834,7 @@ fmt_setup(buf, c, flags, width, prec)
#include "missing/vsnprintf.c"
static int
-ruby__sfvwrite(fp, uio)
- register rb_printf_buffer *fp;
- register struct __suio *uio;
+ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
{
struct __siov *iov;
VALUE result = (VALUE)fp->_bf._base;
@@ -880,9 +860,7 @@ ruby__sfvwrite(fp, uio)
}
VALUE
-rb_vsprintf(fmt, ap)
- const char *fmt;
- va_list ap;
+rb_vsprintf(const char *fmt, va_list ap)
{
rb_printf_buffer f;
VALUE result;
@@ -903,18 +881,12 @@ rb_vsprintf(fmt, ap)
}
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_sprintf(const char *format, ...)
-#else
-rb_sprintf(format, va_alist)
- const char *format;
- va_dcl
-#endif
{
VALUE result;
va_list ap;
- va_init_list(ap, format);
+ va_start(ap, format);
result = rb_vsprintf(format, ap);
va_end(ap);
diff --git a/st.c b/st.c
index df4eb7e3ed..8e78fc76c0 100644
--- a/st.c
+++ b/st.c
@@ -117,8 +117,7 @@ static long primes[] = {
};
static int
-new_size(size)
- int size;
+new_size(int size)
{
int i;
@@ -155,9 +154,7 @@ stat_col()
#endif
st_table*
-st_init_table_with_size(type, size)
- struct st_hash_type *type;
- int size;
+st_init_table_with_size(struct st_hash_type *type, int size)
{
st_table *tbl;
@@ -180,8 +177,7 @@ st_init_table_with_size(type, size)
}
st_table*
-st_init_table(type)
- struct st_hash_type *type;
+st_init_table(struct st_hash_type *type)
{
return st_init_table_with_size(type, 0);
}
@@ -193,8 +189,7 @@ st_init_numtable(void)
}
st_table*
-st_init_numtable_with_size(size)
- int size;
+st_init_numtable_with_size(int size)
{
return st_init_table_with_size(&type_numhash, size);
}
@@ -206,15 +201,13 @@ st_init_strtable(void)
}
st_table*
-st_init_strtable_with_size(size)
- int size;
+st_init_strtable_with_size(int size)
{
return st_init_table_with_size(&type_strhash, size);
}
void
-st_free_table(table)
- st_table *table;
+st_free_table(st_table *table)
{
register st_table_entry *ptr, *next;
int i;
@@ -253,10 +246,7 @@ st_free_table(table)
} while (0)
int
-st_lookup(table, key, value)
- st_table *table;
- register st_data_t key;
- st_data_t *value;
+st_lookup(st_table *table, register st_data_t key, st_data_t *value)
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@@ -292,10 +282,7 @@ do {\
} while (0)
int
-st_insert(table, key, value)
- register st_table *table;
- register st_data_t key;
- st_data_t value;
+st_insert(register st_table *table, register st_data_t key, st_data_t value)
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@@ -314,10 +301,7 @@ st_insert(table, key, value)
}
void
-st_add_direct(table, key, value)
- st_table *table;
- st_data_t key;
- st_data_t value;
+st_add_direct(st_table *table, st_data_t key, st_data_t value)
{
unsigned int hash_val, bin_pos;
@@ -327,8 +311,7 @@ st_add_direct(table, key, value)
}
static void
-rehash(table)
- register st_table *table;
+rehash(register st_table *table)
{
register st_table_entry *ptr, *next, **new_bins;
int i, old_num_bins = table->num_bins, new_num_bins;
@@ -353,8 +336,7 @@ rehash(table)
}
st_table*
-st_copy(old_table)
- st_table *old_table;
+st_copy(st_table *old_table)
{
st_table *new_table;
st_table_entry *ptr, *entry;
@@ -394,10 +376,7 @@ st_copy(old_table)
}
int
-st_delete(table, key, value)
- register st_table *table;
- register st_data_t *key;
- st_data_t *value;
+st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
{
unsigned int hash_val;
st_table_entry *tmp;
@@ -436,11 +415,7 @@ st_delete(table, key, value)
}
int
-st_delete_safe(table, key, value, never)
- register st_table *table;
- register st_data_t *key;
- st_data_t *value;
- st_data_t never;
+st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *value, st_data_t never)
{
unsigned int hash_val;
register st_table_entry *ptr;
@@ -467,17 +442,14 @@ st_delete_safe(table, key, value, never)
}
static int
-delete_never(key, value, never)
- st_data_t key, value, never;
+delete_never(st_data_t key, st_data_t value, st_data_t never)
{
if (value == never) return ST_DELETE;
return ST_CONTINUE;
}
void
-st_cleanup_safe(table, never)
- st_table *table;
- st_data_t never;
+st_cleanup_safe(st_table *table, st_data_t never)
{
int num_entries = table->num_entries;
@@ -486,10 +458,7 @@ st_cleanup_safe(table, never)
}
int
-st_foreach(table, func, arg)
- st_table *table;
- int (*func)();
- st_data_t arg;
+st_foreach(st_table *table, int (*func) (/* ??? */), st_data_t arg)
{
st_table_entry *ptr, *last, *tmp;
enum st_retval retval;
@@ -536,8 +505,7 @@ st_foreach(table, func, arg)
}
static int
-strhash(string)
- register const char *string;
+strhash(register const char *string)
{
register int c;
@@ -575,15 +543,13 @@ strhash(string)
}
static int
-numcmp(x, y)
- long x, y;
+numcmp(long x, long y)
{
return x != y;
}
static int
-numhash(n)
- long n;
+numhash(long n)
{
return n;
}
diff --git a/string.c b/string.c
index c17f34baaf..fe27fd4c2f 100644
--- a/string.c
+++ b/string.c
@@ -40,10 +40,7 @@ VALUE rb_cString;
VALUE rb_fs;
static inline void
-str_mod_check(s, p, len)
- VALUE s;
- char *p;
- long len;
+str_mod_check(VALUE s, char *p, long len)
{
if (RSTRING(s)->ptr != p || RSTRING(s)->len != len){
rb_raise(rb_eRuntimeError, "string modified");
@@ -51,18 +48,15 @@ str_mod_check(s, p, len)
}
static inline void
-str_frozen_check(s)
- VALUE s;
+str_frozen_check(VALUE s)
{
if (OBJ_FROZEN(s)) {
rb_raise(rb_eRuntimeError, "string frozen");
}
}
-static VALUE str_alloc _((VALUE));
static VALUE
-str_alloc(klass)
- VALUE klass;
+str_alloc(VALUE klass)
{
NEWOBJ(str, struct RString);
OBJSETUP(str, klass, T_STRING);
@@ -75,10 +69,7 @@ str_alloc(klass)
}
static VALUE
-str_new(klass, ptr, len)
- VALUE klass;
- const char *ptr;
- long len;
+str_new(VALUE klass, const char *ptr, long len)
{
VALUE str;
@@ -98,16 +89,13 @@ str_new(klass, ptr, len)
}
VALUE
-rb_str_new(ptr, len)
- const char *ptr;
- long len;
+rb_str_new(const char *ptr, long len)
{
return str_new(rb_cString, ptr, len);
}
VALUE
-rb_str_new2(ptr)
- const char *ptr;
+rb_str_new2(const char *ptr)
{
if (!ptr) {
rb_raise(rb_eArgError, "NULL pointer given");
@@ -116,9 +104,7 @@ rb_str_new2(ptr)
}
VALUE
-rb_tainted_str_new(ptr, len)
- const char *ptr;
- long len;
+rb_tainted_str_new(const char *ptr, long len)
{
VALUE str = rb_str_new(ptr, len);
@@ -127,8 +113,7 @@ rb_tainted_str_new(ptr, len)
}
VALUE
-rb_tainted_str_new2(ptr)
- const char *ptr;
+rb_tainted_str_new2(const char *ptr)
{
VALUE str = rb_str_new2(ptr);
@@ -137,8 +122,7 @@ rb_tainted_str_new2(ptr)
}
static VALUE
-str_new3(klass, str)
- VALUE klass, str;
+str_new3(VALUE klass, VALUE str)
{
VALUE str2 = str_alloc(klass);
@@ -152,15 +136,13 @@ str_new3(klass, str)
}
VALUE
-rb_str_new3(str)
- VALUE str;
+rb_str_new3(VALUE str)
{
return str_new3(rb_obj_class(str), str);
}
static VALUE
-str_new4(klass, str)
- VALUE klass, str;
+str_new4(VALUE klass, VALUE str)
{
VALUE str2 = str_alloc(klass);
@@ -179,8 +161,7 @@ str_new4(klass, str)
}
VALUE
-rb_str_new4(orig)
- VALUE orig;
+rb_str_new4(VALUE orig)
{
VALUE klass, str;
@@ -207,10 +188,7 @@ rb_str_new4(orig)
}
VALUE
-rb_str_new5(obj, ptr, len)
- VALUE obj;
- const char *ptr;
- long len;
+rb_str_new5(VALUE obj, const char *ptr, long len)
{
return str_new(rb_obj_class(obj), ptr, len);
}
@@ -218,8 +196,7 @@ rb_str_new5(obj, ptr, len)
#define STR_BUF_MIN_SIZE 128
VALUE
-rb_str_buf_new(capa)
- long capa;
+rb_str_buf_new(long capa)
{
VALUE str = str_alloc(rb_cString);
@@ -236,8 +213,7 @@ rb_str_buf_new(capa)
}
VALUE
-rb_str_buf_new2(ptr)
- const char *ptr;
+rb_str_buf_new2(const char *ptr)
{
VALUE str;
long len = strlen(ptr);
@@ -249,15 +225,13 @@ rb_str_buf_new2(ptr)
}
VALUE
-rb_str_to_str(str)
- VALUE str;
+rb_str_to_str(VALUE str)
{
return rb_convert_type(str, T_STRING, "String", "to_str");
}
static void
-rb_str_shared_replace(str, str2)
- VALUE str, str2;
+rb_str_shared_replace(VALUE str, VALUE str2)
{
if (str == str2) return;
rb_str_modify(str);
@@ -282,8 +256,7 @@ rb_str_shared_replace(str, str2)
static ID id_to_s;
VALUE
-rb_obj_as_string(obj)
- VALUE obj;
+rb_obj_as_string(VALUE obj)
{
VALUE str;
@@ -300,8 +273,7 @@ rb_obj_as_string(obj)
static VALUE rb_str_replace _((VALUE, VALUE));
VALUE
-rb_str_dup(str)
- VALUE str;
+rb_str_dup(VALUE str)
{
VALUE dup = str_alloc(rb_obj_class(str));
rb_str_replace(dup, str);
@@ -317,10 +289,7 @@ rb_str_dup(str)
*/
static VALUE
-rb_str_init(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_init(int argc, VALUE *argv, VALUE str)
{
VALUE orig;
@@ -337,8 +306,7 @@ rb_str_init(argc, argv, str)
*/
static VALUE
-rb_str_length(str)
- VALUE str;
+rb_str_length(VALUE str)
{
return LONG2NUM(RSTRING(str)->len);
}
@@ -354,8 +322,7 @@ rb_str_length(str)
*/
static VALUE
-rb_str_empty(str)
- VALUE str;
+rb_str_empty(VALUE str)
{
if (RSTRING(str)->len == 0)
return Qtrue;
@@ -373,8 +340,7 @@ rb_str_empty(str)
*/
VALUE
-rb_str_plus(str1, str2)
- VALUE str1, str2;
+rb_str_plus(VALUE str1, VALUE str2)
{
VALUE str3;
@@ -401,9 +367,7 @@ rb_str_plus(str1, str2)
*/
VALUE
-rb_str_times(str, times)
- VALUE str;
- VALUE times;
+rb_str_times(VALUE str, VALUE times)
{
VALUE str2;
long i, len;
@@ -443,8 +407,7 @@ rb_str_times(str, times)
*/
static VALUE
-rb_str_format_m(str, arg)
- VALUE str, arg;
+rb_str_format_m(VALUE str, VALUE arg)
{
if (TYPE(arg) == T_ARRAY) {
return rb_str_format(RARRAY(arg)->len, RARRAY(arg)->ptr, str);
@@ -453,8 +416,7 @@ rb_str_format_m(str, arg)
}
static int
-str_independent(str)
- VALUE str;
+str_independent(VALUE str)
{
if (FL_TEST(str, STR_TMPLOCK)) {
rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked");
@@ -467,8 +429,7 @@ str_independent(str)
}
static void
-str_make_independent(str)
- VALUE str;
+str_make_independent(VALUE str)
{
char *ptr;
@@ -483,16 +444,14 @@ str_make_independent(str)
}
void
-rb_str_modify(str)
- VALUE str;
+rb_str_modify(VALUE str)
{
if (!str_independent(str))
str_make_independent(str);
}
void
-rb_str_associate(str, add)
- VALUE str, add;
+rb_str_associate(VALUE str, VALUE add)
{
if (FL_TEST(str, STR_ASSOC)) {
/* already associated */
@@ -511,8 +470,7 @@ rb_str_associate(str, add)
}
VALUE
-rb_str_associated(str)
- VALUE str;
+rb_str_associated(VALUE str)
{
if (FL_TEST(str, STR_ASSOC)) {
return RSTRING(str)->aux.shared;
@@ -523,8 +481,7 @@ rb_str_associated(str)
static char *null_str = "";
VALUE
-rb_string_value(ptr)
- volatile VALUE *ptr;
+rb_string_value(volatile VALUE *ptr)
{
VALUE s = *ptr;
if (TYPE(s) != T_STRING) {
@@ -539,15 +496,13 @@ rb_string_value(ptr)
}
char *
-rb_string_value_ptr(ptr)
- volatile VALUE *ptr;
+rb_string_value_ptr(volatile VALUE *ptr)
{
return RSTRING(rb_string_value(ptr))->ptr;
}
char *
-rb_string_value_cstr(ptr)
- volatile VALUE *ptr;
+rb_string_value_cstr(volatile VALUE *ptr)
{
VALUE str = rb_string_value(ptr);
char *s = RSTRING(str)->ptr;
@@ -559,8 +514,7 @@ rb_string_value_cstr(ptr)
}
VALUE
-rb_check_string_type(str)
- VALUE str;
+rb_check_string_type(VALUE str)
{
str = rb_check_convert_type(str, T_STRING, "String", "to_str");
if (!NIL_P(str) && !RSTRING(str)->ptr) {
@@ -571,9 +525,7 @@ rb_check_string_type(str)
}
VALUE
-rb_str_substr(str, beg, len)
- VALUE str;
- long beg, len;
+rb_str_substr(VALUE str, long beg, long len)
{
VALUE str2;
@@ -606,15 +558,13 @@ rb_str_substr(str, beg, len)
}
VALUE
-rb_str_freeze(str)
- VALUE str;
+rb_str_freeze(VALUE str)
{
return rb_obj_freeze(str);
}
VALUE
-rb_str_dup_frozen(str)
- VALUE str;
+rb_str_dup_frozen(VALUE str)
{
if (FL_TEST(str, ELTS_SHARED) && RSTRING(str)->aux.shared) {
VALUE shared = RSTRING(str)->aux.shared;
@@ -630,8 +580,7 @@ rb_str_dup_frozen(str)
}
VALUE
-rb_str_locktmp(str)
- VALUE str;
+rb_str_locktmp(VALUE str)
{
if (FL_TEST(str, STR_TMPLOCK)) {
rb_raise(rb_eRuntimeError, "temporal locking already locked string");
@@ -641,8 +590,7 @@ rb_str_locktmp(str)
}
VALUE
-rb_str_unlocktmp(str)
- VALUE str;
+rb_str_unlocktmp(VALUE str)
{
if (!FL_TEST(str, STR_TMPLOCK)) {
rb_raise(rb_eRuntimeError, "temporal unlocking already unlocked string");
@@ -652,9 +600,7 @@ rb_str_unlocktmp(str)
}
VALUE
-rb_str_resize(str, len)
- VALUE str;
- long len;
+rb_str_resize(VALUE str, long len)
{
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
@@ -675,10 +621,7 @@ rb_str_resize(str, len)
}
VALUE
-rb_str_buf_cat(str, ptr, len)
- VALUE str;
- const char *ptr;
- long len;
+rb_str_buf_cat(VALUE str, const char *ptr, long len)
{
long capa, total;
@@ -709,18 +652,13 @@ rb_str_buf_cat(str, ptr, len)
}
VALUE
-rb_str_buf_cat2(str, ptr)
- VALUE str;
- const char *ptr;
+rb_str_buf_cat2(VALUE str, const char *ptr)
{
return rb_str_buf_cat(str, ptr, strlen(ptr));
}
VALUE
-rb_str_cat(str, ptr, len)
- VALUE str;
- const char *ptr;
- long len;
+rb_str_cat(VALUE str, const char *ptr, long len)
{
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
@@ -738,16 +676,13 @@ rb_str_cat(str, ptr, len)
}
VALUE
-rb_str_cat2(str, ptr)
- VALUE str;
- const char *ptr;
+rb_str_cat2(VALUE str, const char *ptr)
{
return rb_str_cat(str, ptr, strlen(ptr));
}
VALUE
-rb_str_buf_append(str, str2)
- VALUE str, str2;
+rb_str_buf_append(VALUE str, VALUE str2)
{
long capa, len;
@@ -776,8 +711,7 @@ rb_str_buf_append(str, str2)
}
VALUE
-rb_str_append(str, str2)
- VALUE str, str2;
+rb_str_append(VALUE str, VALUE str2)
{
StringValue(str2);
rb_str_modify(str);
@@ -816,8 +750,7 @@ rb_str_append(str, str2)
*/
VALUE
-rb_str_concat(str1, str2)
- VALUE str1, str2;
+rb_str_concat(VALUE str1, VALUE str2)
{
if (FIXNUM_P(str2)) {
int i = FIX2INT(str2);
@@ -832,8 +765,7 @@ rb_str_concat(str1, str2)
}
int
-rb_str_hash(str)
- VALUE str;
+rb_str_hash(VALUE str)
{
register long len = RSTRING(str)->len;
register char *p = RSTRING(str)->ptr;
@@ -875,8 +807,7 @@ rb_str_hash(str)
*/
static VALUE
-rb_str_hash_m(str)
- VALUE str;
+rb_str_hash_m(VALUE str)
{
int key = rb_str_hash(str);
return INT2FIX(key);
@@ -885,8 +816,7 @@ rb_str_hash_m(str)
#define lesser(a,b) (((a)>(b))?(b):(a))
int
-rb_str_cmp(str1, str2)
- VALUE str1, str2;
+rb_str_cmp(VALUE str1, VALUE str2)
{
long len;
int retval;
@@ -913,8 +843,7 @@ rb_str_cmp(str1, str2)
*/
static VALUE
-rb_str_equal(str1, str2)
- VALUE str1, str2;
+rb_str_equal(VALUE str1, VALUE str2)
{
if (str1 == str2) return Qtrue;
if (TYPE(str2) != T_STRING) {
@@ -938,8 +867,7 @@ rb_str_equal(str1, str2)
*/
static VALUE
-rb_str_eql(str1, str2)
- VALUE str1, str2;
+rb_str_eql(VALUE str1, VALUE str2)
{
if (TYPE(str2) != T_STRING || RSTRING(str1)->len != RSTRING(str2)->len)
return Qfalse;
@@ -977,8 +905,7 @@ rb_str_eql(str1, str2)
*/
static VALUE
-rb_str_cmp_m(str1, str2)
- VALUE str1, str2;
+rb_str_cmp_m(VALUE str1, VALUE str2)
{
long result;
@@ -1018,8 +945,7 @@ rb_str_cmp_m(str1, str2)
*/
static VALUE
-rb_str_casecmp(str1, str2)
- VALUE str1, str2;
+rb_str_casecmp(VALUE str1, VALUE str2)
{
long len;
int retval;
@@ -1038,9 +964,7 @@ rb_str_casecmp(str1, str2)
}
static long
-rb_str_index(str, sub, offset)
- VALUE str, sub;
- long offset;
+rb_str_index(VALUE str, VALUE sub, long offset)
{
long pos;
@@ -1076,10 +1000,7 @@ rb_str_index(str, sub, offset)
*/
static VALUE
-rb_str_index_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_index_m(int argc, VALUE *argv, VALUE str)
{
VALUE sub;
VALUE initpos;
@@ -1140,9 +1061,7 @@ rb_str_index_m(argc, argv, str)
}
static long
-rb_str_rindex(str, sub, pos)
- VALUE str, sub;
- long pos;
+rb_str_rindex(VALUE str, VALUE sub, long pos)
{
long len = RSTRING(sub)->len;
char *s, *sbeg, *t;
@@ -1190,10 +1109,7 @@ rb_str_rindex(str, sub, pos)
*/
static VALUE
-rb_str_rindex_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
{
VALUE sub;
VALUE position;
@@ -1272,8 +1188,7 @@ rb_str_rindex_m(argc, argv, str)
*/
static VALUE
-rb_str_match(x, y)
- VALUE x, y;
+rb_str_match(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_STRING:
@@ -1307,10 +1222,7 @@ static VALUE get_pat _((VALUE, int));
*/
static VALUE
-rb_str_match_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_match_m(int argc, VALUE *argv, VALUE str)
{
VALUE re;
if (argc < 1)
@@ -1321,8 +1233,7 @@ rb_str_match_m(argc, argv, str)
}
static char
-succ_char(s)
- char *s;
+succ_char(char *s)
{
char c = *s;
@@ -1372,8 +1283,7 @@ succ_char(s)
*/
static VALUE
-rb_str_succ(orig)
- VALUE orig;
+rb_str_succ(VALUE orig)
{
VALUE str;
char *sbeg, *s;
@@ -1424,8 +1334,7 @@ rb_str_succ(orig)
*/
static VALUE
-rb_str_succ_bang(str)
- VALUE str;
+rb_str_succ_bang(VALUE str)
{
rb_str_shared_replace(str, rb_str_succ(str));
@@ -1433,9 +1342,7 @@ rb_str_succ_bang(str)
}
VALUE
-rb_str_upto(beg, end, excl)
- VALUE beg, end;
- int excl;
+rb_str_upto(VALUE beg, VALUE end, int excl)
{
VALUE current, after_end;
ID succ = rb_intern("succ");
@@ -1482,16 +1389,13 @@ rb_str_upto(beg, end, excl)
*/
static VALUE
-rb_str_upto_m(beg, end)
- VALUE beg, end;
+rb_str_upto_m(VALUE beg, VALUE end)
{
return rb_str_upto(beg, end, Qfalse);
}
static VALUE
-rb_str_subpat(str, re, nth)
- VALUE str, re;
- int nth;
+rb_str_subpat(VALUE str, VALUE re, int nth)
{
if (rb_reg_search(re, str, 0, 0) >= 0) {
return rb_reg_nth_match(nth, rb_backref_get());
@@ -1500,9 +1404,7 @@ rb_str_subpat(str, re, nth)
}
static VALUE
-rb_str_aref(str, indx)
- VALUE str;
- VALUE indx;
+rb_str_aref(VALUE str, VALUE indx)
{
long idx;
@@ -1595,10 +1497,7 @@ rb_str_aref(str, indx)
*/
static VALUE
-rb_str_aref_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_aref_m(int argc, VALUE *argv, VALUE str)
{
if (argc == 2) {
if (TYPE(argv[0]) == T_REGEXP) {
@@ -1613,10 +1512,7 @@ rb_str_aref_m(argc, argv, str)
}
static void
-rb_str_splice(str, beg, len, val)
- VALUE str;
- long beg, len;
- VALUE val;
+rb_str_splice(VALUE str, long beg, long len, VALUE val)
{
if (len < 0) rb_raise(rb_eIndexError, "negative length %ld", len);
@@ -1661,19 +1557,13 @@ rb_str_splice(str, beg, len, val)
}
void
-rb_str_update(str, beg, len, val)
- VALUE str;
- long beg, len;
- VALUE val;
+rb_str_update(VALUE str, long beg, long len, VALUE val)
{
rb_str_splice(str, beg, len, val);
}
static void
-rb_str_subpat_set(str, re, nth, val)
- VALUE str, re;
- int nth;
- VALUE val;
+rb_str_subpat_set(VALUE str, VALUE re, int nth, VALUE val)
{
VALUE match;
long start, end, len;
@@ -1703,9 +1593,7 @@ rb_str_subpat_set(str, re, nth, val)
}
static VALUE
-rb_str_aset(str, indx, val)
- VALUE str;
- VALUE indx, val;
+rb_str_aset(VALUE str, VALUE indx, VALUE val)
{
long idx, beg;
@@ -1787,10 +1675,7 @@ rb_str_aset(str, indx, val)
*/
static VALUE
-rb_str_aset_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_aset_m(int argc, VALUE *argv, VALUE str)
{
if (argc == 3) {
if (TYPE(argv[0]) == T_REGEXP) {
@@ -1825,8 +1710,7 @@ rb_str_aset_m(argc, argv, str)
*/
static VALUE
-rb_str_insert(str, idx, str2)
- VALUE str, idx, str2;
+rb_str_insert(VALUE str, VALUE idx, VALUE str2)
{
long pos = NUM2LONG(idx);
@@ -1864,10 +1748,7 @@ rb_str_insert(str, idx, str2)
*/
static VALUE
-rb_str_slice_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
{
VALUE result;
VALUE buf[3];
@@ -1888,9 +1769,7 @@ rb_str_slice_bang(argc, argv, str)
}
static VALUE
-get_pat(pat, quote)
- VALUE pat;
- int quote;
+get_pat(VALUE pat, int quote)
{
VALUE val;
@@ -1928,10 +1807,7 @@ get_pat(pat, quote)
*/
static VALUE
-rb_str_sub_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
{
VALUE pat, repl, match;
struct re_registers *regs;
@@ -2022,10 +1898,7 @@ rb_str_sub_bang(argc, argv, str)
*/
static VALUE
-rb_str_sub(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_sub(int argc, VALUE *argv, VALUE str)
{
str = rb_str_dup(str);
rb_str_sub_bang(argc, argv, str);
@@ -2033,11 +1906,7 @@ rb_str_sub(argc, argv, str)
}
static VALUE
-str_gsub(argc, argv, str, bang)
- int argc;
- VALUE *argv;
- VALUE str;
- int bang;
+str_gsub(int argc, VALUE *argv, VALUE str, int bang)
{
VALUE pat, val, repl, match, dest;
struct re_registers *regs;
@@ -2171,10 +2040,7 @@ str_gsub(argc, argv, str, bang)
*/
static VALUE
-rb_str_gsub_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_gsub_bang(int argc, VALUE *argv, VALUE str)
{
return str_gsub(argc, argv, str, 1);
}
@@ -2212,10 +2078,7 @@ rb_str_gsub_bang(argc, argv, str)
*/
static VALUE
-rb_str_gsub(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_gsub(int argc, VALUE *argv, VALUE str)
{
return str_gsub(argc, argv, str, 0);
}
@@ -2233,8 +2096,7 @@ rb_str_gsub(argc, argv, str)
*/
static VALUE
-rb_str_replace(str, str2)
- VALUE str, str2;
+rb_str_replace(VALUE str, VALUE str2)
{
if (str == str2) return str;
@@ -2274,8 +2136,7 @@ rb_str_replace(str, str2)
*/
static VALUE
-rb_str_clear(str)
- VALUE str;
+rb_str_clear(VALUE str)
{
/* rb_str_modify() */ /* no need for str_make_independent */
if (str_independent(str)) {
@@ -2290,7 +2151,7 @@ rb_str_clear(str)
}
static VALUE
-uscore_get()
+uscore_get(void)
{
VALUE line;
@@ -2311,9 +2172,7 @@ uscore_get()
*/
static VALUE
-rb_f_sub_bang(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_sub_bang(int argc, VALUE *argv)
{
return rb_str_sub_bang(argc, argv, uscore_get());
}
@@ -2328,9 +2187,7 @@ rb_f_sub_bang(argc, argv)
*/
static VALUE
-rb_f_sub(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_sub(int argc, VALUE *argv)
{
VALUE str = rb_str_dup(uscore_get());
@@ -2354,9 +2211,7 @@ rb_f_sub(argc, argv)
*/
static VALUE
-rb_f_gsub_bang(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_gsub_bang(int argc, VALUE *argv)
{
return rb_str_gsub_bang(argc, argv, uscore_get());
}
@@ -2375,9 +2230,7 @@ rb_f_gsub_bang(argc, argv)
*/
static VALUE
-rb_f_gsub(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_gsub(int argc, VALUE *argv)
{
VALUE str = rb_str_dup(uscore_get());
@@ -2396,8 +2249,7 @@ rb_f_gsub(argc, argv)
*/
static VALUE
-rb_str_reverse_bang(str)
- VALUE str;
+rb_str_reverse_bang(VALUE str)
{
char *s, *e;
char c;
@@ -2426,8 +2278,7 @@ rb_str_reverse_bang(str)
*/
static VALUE
-rb_str_reverse(str)
- VALUE str;
+rb_str_reverse(VALUE str)
{
VALUE obj;
char *s, *e, *p;
@@ -2461,8 +2312,7 @@ rb_str_reverse(str)
*/
static VALUE
-rb_str_include(str, arg)
- VALUE str, arg;
+rb_str_include(VALUE str, VALUE arg)
{
long i;
@@ -2502,10 +2352,7 @@ rb_str_include(str, arg)
*/
static VALUE
-rb_str_to_i(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_to_i(int argc, VALUE *argv, VALUE str)
{
VALUE b;
int base;
@@ -2536,8 +2383,7 @@ rb_str_to_i(argc, argv, str)
*/
static VALUE
-rb_str_to_f(str)
- VALUE str;
+rb_str_to_f(VALUE str)
{
return rb_float_new(rb_str_to_dbl(str, Qfalse));
}
@@ -2552,8 +2398,7 @@ rb_str_to_f(str)
*/
static VALUE
-rb_str_to_s(str)
- VALUE str;
+rb_str_to_s(VALUE str)
{
if (rb_obj_class(str) != rb_cString) {
VALUE dup = str_alloc(rb_cString);
@@ -2578,8 +2423,7 @@ rb_str_to_s(str)
*/
VALUE
-rb_str_inspect(str)
- VALUE str;
+rb_str_inspect(VALUE str)
{
char *p, *pend;
VALUE result = rb_str_buf_new2("\"");
@@ -2650,8 +2494,7 @@ rb_str_inspect(str)
*/
VALUE
-rb_str_dump(str)
- VALUE str;
+rb_str_dump(VALUE str)
{
long len;
char *p, *pend;
@@ -2754,8 +2597,7 @@ rb_str_dump(str)
*/
static VALUE
-rb_str_upcase_bang(str)
- VALUE str;
+rb_str_upcase_bang(VALUE str)
{
char *s, *send;
int modify = 0;
@@ -2790,8 +2632,7 @@ rb_str_upcase_bang(str)
*/
static VALUE
-rb_str_upcase(str)
- VALUE str;
+rb_str_upcase(VALUE str)
{
str = rb_str_dup(str);
rb_str_upcase_bang(str);
@@ -2808,8 +2649,7 @@ rb_str_upcase(str)
*/
static VALUE
-rb_str_downcase_bang(str)
- VALUE str;
+rb_str_downcase_bang(VALUE str)
{
char *s, *send;
int modify = 0;
@@ -2844,8 +2684,7 @@ rb_str_downcase_bang(str)
*/
static VALUE
-rb_str_downcase(str)
- VALUE str;
+rb_str_downcase(VALUE str)
{
str = rb_str_dup(str);
rb_str_downcase_bang(str);
@@ -2867,8 +2706,7 @@ rb_str_downcase(str)
*/
static VALUE
-rb_str_capitalize_bang(str)
- VALUE str;
+rb_str_capitalize_bang(VALUE str)
{
char *s, *send;
int modify = 0;
@@ -2907,8 +2745,7 @@ rb_str_capitalize_bang(str)
*/
static VALUE
-rb_str_capitalize(str)
- VALUE str;
+rb_str_capitalize(VALUE str)
{
str = rb_str_dup(str);
rb_str_capitalize_bang(str);
@@ -2925,8 +2762,7 @@ rb_str_capitalize(str)
*/
static VALUE
-rb_str_swapcase_bang(str)
- VALUE str;
+rb_str_swapcase_bang(VALUE str)
{
char *s, *send;
int modify = 0;
@@ -2965,8 +2801,7 @@ rb_str_swapcase_bang(str)
*/
static VALUE
-rb_str_swapcase(str)
- VALUE str;
+rb_str_swapcase(VALUE str)
{
str = rb_str_dup(str);
rb_str_swapcase_bang(str);
@@ -2981,8 +2816,7 @@ struct tr {
};
static int
-trnext(t)
- struct tr *t;
+trnext(struct tr *t)
{
for (;;) {
if (!t->gen) {
@@ -3017,9 +2851,7 @@ trnext(t)
static VALUE rb_str_delete_bang _((int,VALUE*,VALUE));
static VALUE
-tr_trans(str, src, repl, sflag)
- VALUE str, src, repl;
- int sflag;
+tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
{
struct tr trsrc, trrepl;
int cflag = 0;
@@ -3122,8 +2954,7 @@ tr_trans(str, src, repl, sflag)
*/
static VALUE
-rb_str_tr_bang(str, src, repl)
- VALUE str, src, repl;
+rb_str_tr_bang(VALUE str, VALUE src, VALUE repl)
{
return tr_trans(str, src, repl, 0);
}
@@ -3147,8 +2978,7 @@ rb_str_tr_bang(str, src, repl)
*/
static VALUE
-rb_str_tr(str, src, repl)
- VALUE str, src, repl;
+rb_str_tr(VALUE str, VALUE src, VALUE repl)
{
str = rb_str_dup(str);
tr_trans(str, src, repl, 0);
@@ -3156,10 +2986,7 @@ rb_str_tr(str, src, repl)
}
static void
-tr_setup_table(str, table, init)
- VALUE str;
- char table[256];
- int init;
+tr_setup_table(VALUE str, char table[256], int init)
{
char buf[256];
struct tr tr;
@@ -3199,10 +3026,7 @@ tr_setup_table(str, table, init)
*/
static VALUE
-rb_str_delete_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
{
char *s, *send, *t;
char squeez[256];
@@ -3255,10 +3079,7 @@ rb_str_delete_bang(argc, argv, str)
*/
static VALUE
-rb_str_delete(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_delete(int argc, VALUE *argv, VALUE str)
{
str = rb_str_dup(str);
rb_str_delete_bang(argc, argv, str);
@@ -3275,10 +3096,7 @@ rb_str_delete(argc, argv, str)
*/
static VALUE
-rb_str_squeeze_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
{
char squeez[256];
char *s, *send, *t;
@@ -3339,10 +3157,7 @@ rb_str_squeeze_bang(argc, argv, str)
*/
static VALUE
-rb_str_squeeze(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_squeeze(int argc, VALUE *argv, VALUE str)
{
str = rb_str_dup(str);
rb_str_squeeze_bang(argc, argv, str);
@@ -3359,8 +3174,7 @@ rb_str_squeeze(argc, argv, str)
*/
static VALUE
-rb_str_tr_s_bang(str, src, repl)
- VALUE str, src, repl;
+rb_str_tr_s_bang(VALUE str, VALUE src, VALUE repl)
{
return tr_trans(str, src, repl, 1);
}
@@ -3380,8 +3194,7 @@ rb_str_tr_s_bang(str, src, repl)
*/
static VALUE
-rb_str_tr_s(str, src, repl)
- VALUE str, src, repl;
+rb_str_tr_s(VALUE str, VALUE src, VALUE repl)
{
str = rb_str_dup(str);
tr_trans(str, src, repl, 1);
@@ -3406,10 +3219,7 @@ rb_str_tr_s(str, src, repl)
*/
static VALUE
-rb_str_count(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_count(int argc, VALUE *argv, VALUE str)
{
char table[256];
char *s, *send;
@@ -3482,10 +3292,7 @@ rb_str_count(argc, argv, str)
*/
static VALUE
-rb_str_split_m(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_split_m(int argc, VALUE *argv, VALUE str)
{
VALUE spat;
VALUE limit;
@@ -3616,9 +3423,7 @@ rb_str_split_m(argc, argv, str)
}
VALUE
-rb_str_split(str, sep0)
- VALUE str;
- const char *sep0;
+rb_str_split(VALUE str, const char *sep0)
{
VALUE sep;
@@ -3636,9 +3441,7 @@ rb_str_split(str, sep0)
*/
static VALUE
-rb_f_split(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_split(int argc, VALUE *argv)
{
return rb_str_split_m(argc, argv, uscore_get());
}
@@ -3677,10 +3480,7 @@ rb_f_split(argc, argv)
*/
static VALUE
-rb_str_each_line(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_each_line(int argc, VALUE *argv, VALUE str)
{
VALUE rs;
int newline;
@@ -3749,8 +3549,7 @@ rb_str_each_line(argc, argv, str)
*/
static VALUE
-rb_str_each_byte(str)
- VALUE str;
+rb_str_each_byte(VALUE str)
{
long i;
@@ -3772,8 +3571,7 @@ rb_str_each_byte(str)
*/
static VALUE
-rb_str_chop_bang(str)
- VALUE str;
+rb_str_chop_bang(VALUE str)
{
if (RSTRING(str)->len > 0) {
rb_str_modify(str);
@@ -3809,8 +3607,7 @@ rb_str_chop_bang(str)
*/
static VALUE
-rb_str_chop(str)
- VALUE str;
+rb_str_chop(VALUE str)
{
str = rb_str_dup(str);
rb_str_chop_bang(str);
@@ -3836,8 +3633,7 @@ rb_str_chop(str)
*/
static VALUE
-rb_f_chop_bang(str)
- VALUE str;
+rb_f_chop_bang(VALUE str)
{
return rb_str_chop_bang(uscore_get());
}
@@ -3861,7 +3657,7 @@ rb_f_chop_bang(str)
*/
static VALUE
-rb_f_chop()
+rb_f_chop(void)
{
VALUE str = uscore_get();
@@ -3883,10 +3679,7 @@ rb_f_chop()
*/
static VALUE
-rb_str_chomp_bang(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
{
VALUE rs;
int newline;
@@ -3975,10 +3768,7 @@ rb_str_chomp_bang(argc, argv, str)
*/
static VALUE
-rb_str_chomp(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_chomp(int argc, VALUE *argv, VALUE str)
{
str = rb_str_dup(str);
rb_str_chomp_bang(argc, argv, str);
@@ -4001,9 +3791,7 @@ rb_str_chomp(argc, argv, str)
*/
static VALUE
-rb_f_chomp_bang(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_chomp_bang(int argc, VALUE *argv)
{
return rb_str_chomp_bang(argc, argv, uscore_get());
}
@@ -4026,9 +3814,7 @@ rb_f_chomp_bang(argc, argv)
*/
static VALUE
-rb_f_chomp(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_chomp(int argc, VALUE *argv)
{
VALUE str = uscore_get();
VALUE dup = rb_str_dup(str);
@@ -4053,8 +3839,7 @@ rb_f_chomp(argc, argv)
*/
static VALUE
-rb_str_lstrip_bang(str)
- VALUE str;
+rb_str_lstrip_bang(VALUE str)
{
char *s, *t, *e;
@@ -4087,8 +3872,7 @@ rb_str_lstrip_bang(str)
*/
static VALUE
-rb_str_lstrip(str)
- VALUE str;
+rb_str_lstrip(VALUE str)
{
str = rb_str_dup(str);
rb_str_lstrip_bang(str);
@@ -4109,8 +3893,7 @@ rb_str_lstrip(str)
*/
static VALUE
-rb_str_rstrip_bang(str)
- VALUE str;
+rb_str_rstrip_bang(VALUE str)
{
char *s, *t, *e;
@@ -4146,8 +3929,7 @@ rb_str_rstrip_bang(str)
*/
static VALUE
-rb_str_rstrip(str)
- VALUE str;
+rb_str_rstrip(VALUE str)
{
str = rb_str_dup(str);
rb_str_rstrip_bang(str);
@@ -4164,8 +3946,7 @@ rb_str_rstrip(str)
*/
static VALUE
-rb_str_strip_bang(str)
- VALUE str;
+rb_str_strip_bang(VALUE str)
{
VALUE l = rb_str_lstrip_bang(str);
VALUE r = rb_str_rstrip_bang(str);
@@ -4186,8 +3967,7 @@ rb_str_strip_bang(str)
*/
static VALUE
-rb_str_strip(str)
- VALUE str;
+rb_str_strip(VALUE str)
{
str = rb_str_dup(str);
rb_str_strip_bang(str);
@@ -4195,9 +3975,7 @@ rb_str_strip(str)
}
static VALUE
-scan_once(str, pat, start)
- VALUE str, pat;
- long *start;
+scan_once(VALUE str, VALUE pat, long *start)
{
VALUE result, match;
struct re_registers *regs;
@@ -4264,8 +4042,7 @@ scan_once(str, pat, start)
*/
static VALUE
-rb_str_scan(str, pat)
- VALUE str, pat;
+rb_str_scan(VALUE str, VALUE pat)
{
VALUE result;
long start = 0;
@@ -4303,8 +4080,7 @@ rb_str_scan(str, pat)
*/
static VALUE
-rb_f_scan(self, pat)
- VALUE self, pat;
+rb_f_scan(VALUE self, VALUE pat)
{
return rb_str_scan(uscore_get(), pat);
}
@@ -4325,8 +4101,7 @@ rb_f_scan(self, pat)
*/
static VALUE
-rb_str_hex(str)
- VALUE str;
+rb_str_hex(VALUE str)
{
return rb_str_to_inum(str, 16, Qfalse);
}
@@ -4347,8 +4122,7 @@ rb_str_hex(str)
*/
static VALUE
-rb_str_oct(str)
- VALUE str;
+rb_str_oct(VALUE str)
{
return rb_str_to_inum(str, -8, Qfalse);
}
@@ -4365,10 +4139,9 @@ rb_str_oct(str)
*/
static VALUE
-rb_str_crypt(str, salt)
- VALUE str, salt;
+rb_str_crypt(VALUE str, VALUE salt)
{
- extern char *crypt();
+ extern char *crypt(char *, char *);
VALUE result;
char *s;
@@ -4406,8 +4179,7 @@ rb_str_crypt(str, salt)
*/
VALUE
-rb_str_intern(s)
- VALUE s;
+rb_str_intern(VALUE s)
{
volatile VALUE str = s;
ID id;
@@ -4434,10 +4206,7 @@ rb_str_intern(s)
*/
static VALUE
-rb_str_sum(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_sum(int argc, VALUE *argv, VALUE str)
{
VALUE vbits;
int bits;
@@ -4485,11 +4254,7 @@ rb_str_sum(argc, argv, str)
}
static VALUE
-rb_str_justify(argc, argv, str, jflag)
- int argc;
- VALUE *argv;
- VALUE str;
- char jflag;
+rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
{
VALUE w;
long width, flen = 0;
@@ -4568,10 +4333,7 @@ rb_str_justify(argc, argv, str, jflag)
*/
static VALUE
-rb_str_ljust(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_ljust(int argc, VALUE *argv, VALUE str)
{
return rb_str_justify(argc, argv, str, 'l');
}
@@ -4591,10 +4353,7 @@ rb_str_ljust(argc, argv, str)
*/
static VALUE
-rb_str_rjust(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_rjust(int argc, VALUE *argv, VALUE str)
{
return rb_str_justify(argc, argv, str, 'r');
}
@@ -4614,19 +4373,13 @@ rb_str_rjust(argc, argv, str)
*/
static VALUE
-rb_str_center(argc, argv, str)
- int argc;
- VALUE *argv;
- VALUE str;
+rb_str_center(int argc, VALUE *argv, VALUE str)
{
return rb_str_justify(argc, argv, str, 'c');
}
void
-rb_str_setter(val, id, var)
- VALUE val;
- ID id;
- VALUE *var;
+rb_str_setter(VALUE val, ID id, VALUE *var)
{
if (!NIL_P(val) && TYPE(val) != T_STRING) {
rb_raise(rb_eTypeError, "value of %s must be String", rb_id2name(id));
@@ -4649,7 +4402,7 @@ rb_str_setter(val, id, var)
*/
void
-Init_String()
+Init_String(void)
{
rb_cString = rb_define_class("String", rb_cObject);
rb_include_module(rb_cString, rb_mComparable);
diff --git a/struct.c b/struct.c
index caae4a28bb..c59a7ee6b4 100644
--- a/struct.c
+++ b/struct.c
@@ -17,9 +17,7 @@ VALUE rb_cStruct;
static VALUE struct_alloc _((VALUE));
VALUE
-rb_struct_iv_get(c, name)
- VALUE c;
- char *name;
+rb_struct_iv_get(VALUE c, char *name)
{
ID id;
@@ -34,8 +32,7 @@ rb_struct_iv_get(c, name)
}
VALUE
-rb_struct_s_members(klass)
- VALUE klass;
+rb_struct_s_members(VALUE klass)
{
VALUE members = rb_struct_iv_get(klass, "__members__");
@@ -46,8 +43,7 @@ rb_struct_s_members(klass)
}
VALUE
-rb_struct_members(s)
- VALUE s;
+rb_struct_members(VALUE s)
{
VALUE members = rb_struct_s_members(rb_obj_class(s));
@@ -59,8 +55,7 @@ rb_struct_members(s)
}
static VALUE
-rb_struct_s_members_m(klass)
- VALUE klass;
+rb_struct_s_members_m(VALUE klass)
{
VALUE members, ary;
VALUE *p, *pend;
@@ -89,16 +84,13 @@ rb_struct_s_members_m(klass)
*/
static VALUE
-rb_struct_members_m(obj)
- VALUE obj;
+rb_struct_members_m(VALUE obj)
{
return rb_struct_s_members_m(rb_obj_class(obj));
}
VALUE
-rb_struct_getmember(obj, id)
- VALUE obj;
- ID id;
+rb_struct_getmember(VALUE obj, ID id)
{
VALUE members, slot;
long i;
@@ -115,22 +107,21 @@ rb_struct_getmember(obj, id)
}
static VALUE
-rb_struct_ref(obj)
- VALUE obj;
+rb_struct_ref(VALUE obj)
{
return rb_struct_getmember(obj, rb_frame_this_func());
}
-static VALUE rb_struct_ref0(obj) VALUE obj; {return RSTRUCT(obj)->ptr[0];}
-static VALUE rb_struct_ref1(obj) VALUE obj; {return RSTRUCT(obj)->ptr[1];}
-static VALUE rb_struct_ref2(obj) VALUE obj; {return RSTRUCT(obj)->ptr[2];}
-static VALUE rb_struct_ref3(obj) VALUE obj; {return RSTRUCT(obj)->ptr[3];}
-static VALUE rb_struct_ref4(obj) VALUE obj; {return RSTRUCT(obj)->ptr[4];}
-static VALUE rb_struct_ref5(obj) VALUE obj; {return RSTRUCT(obj)->ptr[5];}
-static VALUE rb_struct_ref6(obj) VALUE obj; {return RSTRUCT(obj)->ptr[6];}
-static VALUE rb_struct_ref7(obj) VALUE obj; {return RSTRUCT(obj)->ptr[7];}
-static VALUE rb_struct_ref8(obj) VALUE obj; {return RSTRUCT(obj)->ptr[8];}
-static VALUE rb_struct_ref9(obj) VALUE obj; {return RSTRUCT(obj)->ptr[9];}
+static VALUE rb_struct_ref0(VALUE obj) {return RSTRUCT(obj)->ptr[0];}
+static VALUE rb_struct_ref1(VALUE obj) {return RSTRUCT(obj)->ptr[1];}
+static VALUE rb_struct_ref2(VALUE obj) {return RSTRUCT(obj)->ptr[2];}
+static VALUE rb_struct_ref3(VALUE obj) {return RSTRUCT(obj)->ptr[3];}
+static VALUE rb_struct_ref4(VALUE obj) {return RSTRUCT(obj)->ptr[4];}
+static VALUE rb_struct_ref5(VALUE obj) {return RSTRUCT(obj)->ptr[5];}
+static VALUE rb_struct_ref6(VALUE obj) {return RSTRUCT(obj)->ptr[6];}
+static VALUE rb_struct_ref7(VALUE obj) {return RSTRUCT(obj)->ptr[7];}
+static VALUE rb_struct_ref8(VALUE obj) {return RSTRUCT(obj)->ptr[8];}
+static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT(obj)->ptr[9];}
#define N_REF_FUNC (sizeof(ref_func) / sizeof(VALUE (*)()))
@@ -148,8 +139,7 @@ static VALUE (*ref_func[])() = {
};
static void
-rb_struct_modify(s)
- VALUE s;
+rb_struct_modify(VALUE s)
{
if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
if (!OBJ_TAINTED(s) && rb_safe_level() >= 4)
@@ -157,8 +147,7 @@ rb_struct_modify(s)
}
static VALUE
-rb_struct_set(obj, val)
- VALUE obj, val;
+rb_struct_set(VALUE obj, VALUE val)
{
VALUE members, slot;
long i;
@@ -177,8 +166,7 @@ rb_struct_set(obj, val)
}
static VALUE
-make_struct(name, members, klass)
- VALUE name, members, klass;
+make_struct(VALUE name, VALUE members, VALUE klass)
{
VALUE nstr;
ID id;
@@ -226,22 +214,10 @@ make_struct(name, members, klass)
return nstr;
}
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_struct_define(const char *name, ...)
-#else
-rb_struct_define(name, va_alist)
- const char *name;
- va_dcl
-#endif
{
va_list ar;
VALUE nm, ary;
@@ -251,7 +227,7 @@ rb_struct_define(name, va_alist)
else nm = rb_str_new2(name);
ary = rb_ary_new();
- va_init_list(ar, name);
+ va_start(ar, name);
while (mem = va_arg(ar, char*)) {
ID slot = rb_intern(mem);
rb_ary_push(ary, ID2SYM(slot));
@@ -296,10 +272,7 @@ rb_struct_define(name, va_alist)
*/
static VALUE
-rb_struct_s_def(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
{
VALUE name, rest;
long i;
@@ -332,8 +305,7 @@ rb_struct_s_def(argc, argv, klass)
*/
static VALUE
-rb_struct_initialize(self, values)
- VALUE self, values;
+rb_struct_initialize(VALUE self, VALUE values)
{
VALUE klass = rb_obj_class(self);
VALUE size;
@@ -354,8 +326,7 @@ rb_struct_initialize(self, values)
}
static VALUE
-struct_alloc(klass)
- VALUE klass;
+struct_alloc(VALUE klass)
{
VALUE size;
long n;
@@ -373,20 +344,13 @@ struct_alloc(klass)
}
VALUE
-rb_struct_alloc(klass, values)
- VALUE klass, values;
+rb_struct_alloc(VALUE klass, VALUE values)
{
return rb_class_new_instance(RARRAY(values)->len, RARRAY(values)->ptr, klass);
}
VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
rb_struct_new(VALUE klass, ...)
-#else
-rb_struct_new(klass, va_alist)
- VALUE klass;
- va_dcl
-#endif
{
VALUE sz, *mem;
long size, i;
@@ -395,7 +359,7 @@ rb_struct_new(klass, va_alist)
sz = rb_struct_iv_get(klass, "__size__");
size = FIX2LONG(sz);
mem = ALLOCA_N(VALUE, size);
- va_init_list(args, klass);
+ va_start(args, klass);
for (i=0; i<size; i++) {
mem[i] = va_arg(args, VALUE);
}
@@ -423,8 +387,7 @@ rb_struct_new(klass, va_alist)
*/
static VALUE
-rb_struct_each(s)
- VALUE s;
+rb_struct_each(VALUE s)
{
long i;
@@ -454,8 +417,7 @@ rb_struct_each(s)
*/
static VALUE
-rb_struct_each_pair(s)
- VALUE s;
+rb_struct_each_pair(VALUE s)
{
VALUE members;
long i;
@@ -469,9 +431,7 @@ rb_struct_each_pair(s)
}
static VALUE
-inspect_struct(s, dummy, recur)
- VALUE s, dummy;
- int recur;
+inspect_struct(VALUE s, VALUE dummy, int recur)
{
char *cname = rb_class2name(rb_obj_class(s));
VALUE str, members;
@@ -518,8 +478,7 @@ inspect_struct(s, dummy, recur)
*/
static VALUE
-rb_struct_inspect(s)
- VALUE s;
+rb_struct_inspect(VALUE s)
{
return rb_exec_recursive(inspect_struct, s, 0);
}
@@ -537,16 +496,14 @@ rb_struct_inspect(s)
*/
static VALUE
-rb_struct_to_a(s)
- VALUE s;
+rb_struct_to_a(VALUE s)
{
return rb_ary_new4(RSTRUCT(s)->len, RSTRUCT(s)->ptr);
}
/* :nodoc: */
static VALUE
-rb_struct_init_copy(copy, s)
- VALUE copy, s;
+rb_struct_init_copy(VALUE copy, VALUE s)
{
if (copy == s) return copy;
rb_check_frozen(copy);
@@ -561,9 +518,7 @@ rb_struct_init_copy(copy, s)
}
static VALUE
-rb_struct_aref_id(s, id)
- VALUE s;
- ID id;
+rb_struct_aref_id(VALUE s, ID id)
{
VALUE members;
long i, len;
@@ -599,8 +554,7 @@ rb_struct_aref_id(s, id)
*/
VALUE
-rb_struct_aref(s, idx)
- VALUE s, idx;
+rb_struct_aref(VALUE s, VALUE idx)
{
long i;
@@ -620,9 +574,7 @@ rb_struct_aref(s, idx)
}
static VALUE
-rb_struct_aset_id(s, id, val)
- VALUE s, val;
- ID id;
+rb_struct_aset_id(VALUE s, ID id, VALUE val)
{
VALUE members;
long i, len;
@@ -665,8 +617,7 @@ rb_struct_aset_id(s, id, val)
*/
VALUE
-rb_struct_aset(s, idx, val)
- VALUE s, idx, val;
+rb_struct_aset(VALUE s, VALUE idx, VALUE val)
{
long i;
@@ -688,11 +639,8 @@ rb_struct_aset(s, idx, val)
return RSTRUCT(s)->ptr[i] = val;
}
-static VALUE struct_entry _((VALUE, long));
static VALUE
-struct_entry(s, n)
- VALUE s;
- long n;
+struct_entry(VALUE s, long n)
{
return rb_struct_aref(s, LONG2NUM(n));
}
@@ -714,10 +662,7 @@ struct_entry(s, n)
*/
static VALUE
-rb_struct_values_at(argc, argv, s)
- int argc;
- VALUE *argv;
- VALUE s;
+rb_struct_values_at(int argc, VALUE *argv, VALUE s)
{
return rb_get_values_at(s, RSTRUCT(s)->len, argc, argv, struct_entry);
}
@@ -743,10 +688,7 @@ rb_struct_values_at(argc, argv, s)
*/
static VALUE
-rb_struct_select(argc, argv, s)
- int argc;
- VALUE *argv;
- VALUE s;
+rb_struct_select(int argc, VALUE *argv, VALUE s)
{
VALUE result;
long i;
@@ -782,8 +724,7 @@ rb_struct_select(argc, argv, s)
*/
static VALUE
-rb_struct_equal(s, s2)
- VALUE s, s2;
+rb_struct_equal(VALUE s, VALUE s2)
{
long i;
@@ -808,8 +749,7 @@ rb_struct_equal(s, s2)
*/
static VALUE
-rb_struct_hash(s)
- VALUE s;
+rb_struct_hash(VALUE s)
{
long i, h;
VALUE n;
@@ -832,8 +772,7 @@ rb_struct_hash(s)
*/
static VALUE
-rb_struct_eql(s, s2)
- VALUE s, s2;
+rb_struct_eql(VALUE s, VALUE s2)
{
long i;
@@ -863,8 +802,7 @@ rb_struct_eql(s, s2)
*/
static VALUE
-rb_struct_size(s)
- VALUE s;
+rb_struct_size(VALUE s)
{
return LONG2FIX(RSTRUCT(s)->len);
}
@@ -885,7 +823,7 @@ rb_struct_size(s)
* <code>Symbol</code> (such as <code>:name</code>).
*/
void
-Init_Struct()
+Init_Struct(void)
{
rb_cStruct = rb_define_class("Struct", rb_cObject);
rb_include_module(rb_cStruct, rb_mEnumerable);
diff --git a/time.c b/time.c
index eaf8f5acc0..140543e477 100644
--- a/time.c
+++ b/time.c
@@ -32,19 +32,14 @@ struct time_object {
#define GetTimeval(obj, tobj) \
Data_Get_Struct(obj, struct time_object, tobj)
-static void time_free _((void *));
-
static void
-time_free(tobj)
- void *tobj;
+time_free(void *tobj)
{
if (tobj) free(tobj);
}
-static VALUE time_s_alloc _((VALUE));
static VALUE
-time_s_alloc(klass)
- VALUE klass;
+time_s_alloc(VALUE klass)
{
VALUE obj;
struct time_object *tobj;
@@ -58,8 +53,7 @@ time_s_alloc(klass)
}
static void
-time_modify(time)
- VALUE time;
+time_modify(VALUE time)
{
rb_check_frozen(time);
if (!OBJ_TAINTED(time) && rb_safe_level() >= 4)
@@ -91,8 +85,7 @@ time_modify(time)
*/
static VALUE
-time_init(time)
- VALUE time;
+time_init(VALUE time)
{
struct time_object *tobj;
@@ -112,8 +105,7 @@ time_init(time)
#define NMOD(x,y) ((y)-(-((x)+1)%(y))-1)
void
-time_overflow_p(secp, usecp)
- time_t *secp, *usecp;
+time_overflow_p(time_t *secp, time_t *usecp)
{
time_t tmp, sec = *secp, usec = *usecp;
@@ -142,9 +134,7 @@ time_overflow_p(secp, usecp)
}
static VALUE
-time_new_internal(klass, sec, usec)
- VALUE klass;
- time_t sec, usec;
+time_new_internal(VALUE klass, time_t sec, time_t usec)
{
VALUE time = time_s_alloc(klass);
struct time_object *tobj;
@@ -158,16 +148,13 @@ time_new_internal(klass, sec, usec)
}
VALUE
-rb_time_new(sec, usec)
- time_t sec, usec;
+rb_time_new(time_t sec, time_t usec)
{
return time_new_internal(rb_cTime, sec, usec);
}
static struct timeval
-time_timeval(time, interval)
- VALUE time;
- int interval;
+time_timeval(VALUE time, int interval)
{
struct timeval t;
char *tstr = interval ? "time interval" : "time";
@@ -215,15 +202,13 @@ time_timeval(time, interval)
}
struct timeval
-rb_time_interval(time)
- VALUE time;
+rb_time_interval(VALUE time)
{
return time_timeval(time, Qtrue);
}
struct timeval
-rb_time_timeval(time)
- VALUE time;
+rb_time_timeval(VALUE time)
{
struct time_object *tobj;
struct timeval t;
@@ -252,10 +237,7 @@ rb_time_timeval(time)
*/
static VALUE
-time_s_at(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+time_s_at(int argc, VALUE *argv, VALUE klass)
{
struct timeval tv;
VALUE time, t;
@@ -284,8 +266,7 @@ static char *months [12] = {
};
static long
-obj2long(obj)
- VALUE obj;
+obj2long(VALUE obj)
{
if (TYPE(obj) == T_STRING) {
obj = rb_str_to_inum(obj, 10, Qfalse);
@@ -295,11 +276,7 @@ obj2long(obj)
}
static void
-time_arg(argc, argv, tm, usec)
- int argc;
- VALUE *argv;
- struct tm *tm;
- time_t *usec;
+time_arg(int argc, VALUE *argv, struct tm *tm, time_t *usec)
{
VALUE v[8];
int i;
@@ -401,8 +378,7 @@ static VALUE time_localtime _((VALUE));
static VALUE time_get_tm _((VALUE, int));
static int
-leap_year_p(y)
- long y;
+leap_year_p(long y)
{
return ((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0);
}
@@ -410,8 +386,7 @@ leap_year_p(y)
#define DIV(n,d) ((n)<0 ? NDIV((n),(d)) : (n)/(d))
static time_t
-timegm_noleapsecond(tm)
- struct tm *tm;
+timegm_noleapsecond(struct tm *tm)
{
static int common_year_yday_offset[] = {
-1,
@@ -466,9 +441,7 @@ timegm_noleapsecond(tm)
}
static int
-tmcmp(a, b)
- struct tm *a;
- struct tm *b;
+tmcmp(struct tm *a, struct tm *b)
{
if (a->tm_year != b->tm_year)
return a->tm_year < b->tm_year ? -1 : 1;
@@ -487,9 +460,7 @@ tmcmp(a, b)
}
static time_t
-search_time_t(tptr, utc_p)
- struct tm *tptr;
- int utc_p;
+search_time_t(struct tm *tptr, int utc_p)
{
time_t guess, guess_lo, guess_hi;
struct tm *tm, tm_lo, tm_hi;
@@ -743,9 +714,7 @@ search_time_t(tptr, utc_p)
}
static time_t
-make_time_t(tptr, utc_p)
- struct tm *tptr;
- int utc_p;
+make_time_t(struct tm *tptr, int utc_p)
{
time_t t;
struct tm *tmp, buf;
@@ -789,11 +758,7 @@ make_time_t(tptr, utc_p)
}
static VALUE
-time_utc_or_local(argc, argv, utc_p, klass)
- int argc;
- VALUE *argv;
- int utc_p;
- VALUE klass;
+time_utc_or_local(int argc, VALUE *argv, int utc_p, VALUE klass)
{
struct tm tm;
VALUE time;
@@ -827,10 +792,7 @@ time_utc_or_local(argc, argv, utc_p, klass)
* Time.gm(2000,"jan",1,20,15,1) #=> Sat Jan 01 20:15:01 UTC 2000
*/
static VALUE
-time_s_mkutc(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+time_s_mkutc(int argc, VALUE *argv, VALUE klass)
{
return time_utc_or_local(argc, argv, Qtrue, klass);
}
@@ -849,10 +811,7 @@ time_s_mkutc(argc, argv, klass)
*/
static VALUE
-time_s_mktime(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
+time_s_mktime(int argc, VALUE *argv, VALUE klass)
{
return time_utc_or_local(argc, argv, Qfalse, klass);
}
@@ -871,8 +830,7 @@ time_s_mktime(argc, argv, klass)
*/
static VALUE
-time_to_i(time)
- VALUE time;
+time_to_i(VALUE time)
{
struct time_object *tobj;
@@ -893,8 +851,7 @@ time_to_i(time)
*/
static VALUE
-time_to_f(time)
- VALUE time;
+time_to_f(VALUE time)
{
struct time_object *tobj;
@@ -915,8 +872,7 @@ time_to_f(time)
*/
static VALUE
-time_usec(time)
- VALUE time;
+time_usec(VALUE time)
{
struct time_object *tobj;
@@ -941,8 +897,7 @@ time_usec(time)
*/
static VALUE
-time_cmp(time1, time2)
- VALUE time1, time2;
+time_cmp(VALUE time1, VALUE time2)
{
struct time_object *tobj1, *tobj2;
@@ -971,8 +926,7 @@ time_cmp(time1, time2)
*/
static VALUE
-time_eql(time1, time2)
- VALUE time1, time2;
+time_eql(VALUE time1, VALUE time2)
{
struct time_object *tobj1, *tobj2;
@@ -1006,8 +960,7 @@ time_eql(time1, time2)
*/
static VALUE
-time_utc_p(time)
- VALUE time;
+time_utc_p(VALUE time)
{
struct time_object *tobj;
@@ -1024,8 +977,7 @@ time_utc_p(time)
*/
static VALUE
-time_hash(time)
- VALUE time;
+time_hash(VALUE time)
{
struct time_object *tobj;
long hash;
@@ -1037,8 +989,7 @@ time_hash(time)
/* :nodoc: */
static VALUE
-time_init_copy(copy, time)
- VALUE copy, time;
+time_init_copy(VALUE copy, VALUE time)
{
struct time_object *tobj, *tcopy;
@@ -1055,8 +1006,7 @@ time_init_copy(copy, time)
}
static VALUE
-time_dup(time)
- VALUE time;
+time_dup(VALUE time)
{
VALUE dup = time_s_alloc(rb_cTime);
time_init_copy(dup, time);
@@ -1077,8 +1027,7 @@ time_dup(time)
*/
static VALUE
-time_localtime(time)
- VALUE time;
+time_localtime(VALUE time)
{
struct time_object *tobj;
struct tm *tm_tmp;
@@ -1121,8 +1070,7 @@ time_localtime(time)
*/
static VALUE
-time_gmtime(time)
- VALUE time;
+time_gmtime(VALUE time)
{
struct time_object *tobj;
struct tm *tm_tmp;
@@ -1161,8 +1109,7 @@ time_gmtime(time)
*/
static VALUE
-time_getlocaltime(time)
- VALUE time;
+time_getlocaltime(VALUE time)
{
return time_localtime(time_dup(time));
}
@@ -1183,16 +1130,13 @@ time_getlocaltime(time)
*/
static VALUE
-time_getgmtime(time)
- VALUE time;
+time_getgmtime(VALUE time)
{
return time_gmtime(time_dup(time));
}
static VALUE
-time_get_tm(time, gmt)
- VALUE time;
- int gmt;
+time_get_tm(VALUE time, int gmt)
{
if (gmt) return time_gmtime(time);
return time_localtime(time);
@@ -1209,8 +1153,7 @@ time_get_tm(time, gmt)
*/
static VALUE
-time_asctime(time)
- VALUE time;
+time_asctime(VALUE time)
{
struct time_object *tobj;
char *s;
@@ -1239,8 +1182,7 @@ time_asctime(time)
*/
static VALUE
-time_to_s(time)
- VALUE time;
+time_to_s(VALUE time)
{
struct time_object *tobj;
char buf[128];
@@ -1270,10 +1212,7 @@ typedef unsigned long long unsigned_time_t;
#endif
static VALUE
-time_add(tobj, offset, sign)
- struct time_object *tobj;
- VALUE offset;
- int sign;
+time_add(struct time_object *tobj, VALUE offset, int sign)
{
double v = NUM2DBL(offset);
double f, d;
@@ -1324,8 +1263,7 @@ time_add(tobj, offset, sign)
*/
static VALUE
-time_plus(time1, time2)
- VALUE time1, time2;
+time_plus(VALUE time1, VALUE time2)
{
struct time_object *tobj;
GetTimeval(time1, tobj);
@@ -1352,8 +1290,7 @@ time_plus(time1, time2)
*/
static VALUE
-time_minus(time1, time2)
- VALUE time1, time2;
+time_minus(VALUE time1, VALUE time2)
{
struct time_object *tobj;
@@ -1380,8 +1317,7 @@ time_minus(time1, time2)
*/
static VALUE
-time_succ(time)
- VALUE time;
+time_succ(VALUE time)
{
struct time_object *tobj;
@@ -1403,8 +1339,7 @@ time_succ(time)
*/
static VALUE
-time_sec(time)
- VALUE time;
+time_sec(VALUE time)
{
struct time_object *tobj;
@@ -1426,8 +1361,7 @@ time_sec(time)
*/
static VALUE
-time_min(time)
- VALUE time;
+time_min(VALUE time)
{
struct time_object *tobj;
@@ -1449,8 +1383,7 @@ time_min(time)
*/
static VALUE
-time_hour(time)
- VALUE time;
+time_hour(VALUE time)
{
struct time_object *tobj;
@@ -1474,8 +1407,7 @@ time_hour(time)
*/
static VALUE
-time_mday(time)
- VALUE time;
+time_mday(VALUE time)
{
struct time_object *tobj;
@@ -1499,8 +1431,7 @@ time_mday(time)
*/
static VALUE
-time_mon(time)
- VALUE time;
+time_mon(VALUE time)
{
struct time_object *tobj;
@@ -1522,8 +1453,7 @@ time_mon(time)
*/
static VALUE
-time_year(time)
- VALUE time;
+time_year(VALUE time)
{
struct time_object *tobj;
@@ -1546,8 +1476,7 @@ time_year(time)
*/
static VALUE
-time_wday(time)
- VALUE time;
+time_wday(VALUE time)
{
struct time_object *tobj;
@@ -1569,8 +1498,7 @@ time_wday(time)
*/
static VALUE
-time_yday(time)
- VALUE time;
+time_yday(VALUE time)
{
struct time_object *tobj;
@@ -1596,8 +1524,7 @@ time_yday(time)
*/
static VALUE
-time_isdst(time)
- VALUE time;
+time_isdst(VALUE time)
{
struct time_object *tobj;
@@ -1622,8 +1549,7 @@ time_isdst(time)
*/
static VALUE
-time_zone(time)
- VALUE time;
+time_zone(VALUE time)
{
struct time_object *tobj;
#if !defined(HAVE_TM_ZONE) && (!defined(HAVE_TZNAME) || !defined(HAVE_DAYLIGHT))
@@ -1665,8 +1591,7 @@ time_zone(time)
*/
static VALUE
-time_utc_offset(time)
- VALUE time;
+time_utc_offset(VALUE time)
{
struct time_object *tobj;
@@ -1722,8 +1647,7 @@ time_utc_offset(time)
*/
static VALUE
-time_to_a(time)
- VALUE time;
+time_to_a(VALUE time)
{
struct time_object *tobj;
@@ -1746,10 +1670,10 @@ time_to_a(time)
#define SMALLBUF 100
static int
-rb_strftime(buf, format, time)
- char ** volatile buf;
- char * volatile format;
- struct tm * volatile time;
+rb_strftime(
+ char ** volatile buf,
+ char * volatile format,
+ struct tm * volatile time)
{
volatile int size;
int len, flen;
@@ -1820,8 +1744,7 @@ rb_strftime(buf, format, time)
*/
static VALUE
-time_strftime(time, format)
- VALUE time, format;
+time_strftime(VALUE time, VALUE format)
{
struct time_object *tobj;
char buffer[SMALLBUF];
@@ -1874,8 +1797,7 @@ time_strftime(time, format)
*/
static VALUE
-time_s_times(obj)
- VALUE obj;
+time_s_times(VALUE obj)
{
rb_warn("obsolete method Time::times; use Process::times");
return rb_proc_times(obj);
@@ -1886,8 +1808,7 @@ time_s_times(obj)
*/
static VALUE
-time_mdump(time)
- VALUE time;
+time_mdump(VALUE time)
{
struct time_object *tobj;
struct tm *tm;
@@ -1934,10 +1855,7 @@ time_mdump(time)
*/
static VALUE
-time_dump(argc, argv, time)
- int argc;
- VALUE *argv;
- VALUE time;
+time_dump(int argc, VALUE *argv, VALUE time)
{
VALUE str;
@@ -1953,8 +1871,7 @@ time_dump(argc, argv, time)
*/
static VALUE
-time_mload(time, str)
- VALUE time, str;
+time_mload(VALUE time, VALUE str)
{
struct time_object *tobj;
unsigned long p, s;
@@ -2014,8 +1931,7 @@ time_mload(time, str)
*/
static VALUE
-time_load(klass, str)
- VALUE klass, str;
+time_load(VALUE klass, VALUE str)
{
VALUE time = time_s_alloc(klass);
@@ -2043,7 +1959,7 @@ time_load(klass, str)
*/
void
-Init_Time()
+Init_Time(void)
{
rb_cTime = rb_define_class("Time", rb_cObject);
rb_include_module(rb_cTime, rb_mComparable);
diff --git a/util.h b/util.h
index ca879cab5e..6683364039 100644
--- a/util.h
+++ b/util.h
@@ -40,7 +40,7 @@ unsigned long scan_oct _((const char*, int, int*));
unsigned long scan_hex _((const char*, int, int*));
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(_WIN32)
-void ruby_add_suffix();
+void ruby_add_suffix(VALUE str, char *suffix);
#endif
void ruby_qsort _((void*, const int, const int, int (*)(), void*));
diff --git a/variable.c b/variable.c
index ddb416c3ef..bd8e6a20ac 100644
--- a/variable.c
+++ b/variable.c
@@ -23,7 +23,7 @@ st_table *rb_class_tbl;
static ID autoload, classpath, tmp_classpath;
void
-Init_var_tables()
+Init_var_tables(void)
{
rb_global_tbl = st_init_numtable();
rb_class_tbl = st_init_numtable();
@@ -41,9 +41,7 @@ struct fc_result {
};
static VALUE
-fc_path(fc, name)
- struct fc_result *fc;
- ID name;
+fc_path(struct fc_result *fc, ID name)
{
VALUE path, tmp;
@@ -68,10 +66,7 @@ fc_path(fc, name)
}
static int
-fc_i(key, value, res)
- ID key;
- VALUE value;
- struct fc_result *res;
+fc_i(ID key, VALUE value, struct fc_result *res)
{
if (!rb_is_const_id(key)) return ST_CONTINUE;
@@ -113,8 +108,7 @@ fc_i(key, value, res)
}
static VALUE
-find_class_path(klass)
- VALUE klass;
+find_class_path(VALUE klass)
{
struct fc_result arg;
@@ -141,8 +135,7 @@ find_class_path(klass)
}
static VALUE
-classname(klass)
- VALUE klass;
+classname(VALUE klass)
{
VALUE path = Qnil;
@@ -174,8 +167,7 @@ classname(klass)
*/
VALUE
-rb_mod_name(mod)
- VALUE mod;
+rb_mod_name(VALUE mod)
{
VALUE path = classname(mod);
@@ -184,8 +176,7 @@ rb_mod_name(mod)
}
VALUE
-rb_class_path(klass)
- VALUE klass;
+rb_class_path(VALUE klass)
{
VALUE path = classname(klass);
@@ -213,9 +204,7 @@ rb_class_path(klass)
}
void
-rb_set_class_path(klass, under, name)
- VALUE klass, under;
- const char *name;
+rb_set_class_path(VALUE klass, VALUE under, const char *name)
{
VALUE str;
@@ -231,8 +220,7 @@ rb_set_class_path(klass, under, name)
}
VALUE
-rb_path2class(path)
- const char *path;
+rb_path2class(const char *path)
{
const char *pbeg, *p;
ID id;
@@ -271,30 +259,25 @@ rb_path2class(path)
}
void
-rb_name_class(klass, id)
- VALUE klass;
- ID id;
+rb_name_class(VALUE klass, ID id)
{
rb_iv_set(klass, "__classid__", ID2SYM(id));
}
VALUE
-rb_class_name(klass)
- VALUE klass;
+rb_class_name(VALUE klass)
{
return rb_class_path(rb_class_real(klass));
}
char *
-rb_class2name(klass)
- VALUE klass;
+rb_class2name(VALUE klass)
{
return RSTRING(rb_class_name(klass))->ptr;
}
char *
-rb_obj_classname(obj)
- VALUE obj;
+rb_obj_classname(VALUE obj)
{
return rb_class2name(CLASS_OF(obj));
}
@@ -321,21 +304,20 @@ struct global_entry {
ID id;
};
-static VALUE undef_getter();
-static void undef_setter();
-static void undef_marker();
+static VALUE undef_getter(ID id);
+static void undef_setter(VALUE val, ID id, void *data, struct global_variable *var);
+static void undef_marker(void);
-static VALUE val_getter();
-static void val_setter();
-static void val_marker();
+static VALUE val_getter(ID id, VALUE val);
+static void val_setter(VALUE val, ID id, void *data, struct global_variable *var);
+static void val_marker(VALUE data);
-static VALUE var_getter();
-static void var_setter();
-static void var_marker();
+static VALUE var_getter(ID id, VALUE *var);
+static void var_setter(VALUE val, ID id, VALUE *var);
+static void var_marker(VALUE *var);
struct global_entry*
-rb_global_entry(id)
- ID id;
+rb_global_entry(ID id)
{
struct global_entry *entry;
@@ -359,8 +341,7 @@ rb_global_entry(id)
}
static VALUE
-undef_getter(id)
- ID id;
+undef_getter(ID id)
{
rb_warning("global variable `%s' not initialized", rb_id2name(id));
@@ -368,11 +349,7 @@ undef_getter(id)
}
static void
-undef_setter(val, id, data, var)
- VALUE val;
- ID id;
- void *data;
- struct global_variable *var;
+undef_setter(VALUE val, ID id, void *data, struct global_variable *var)
{
var->getter = val_getter;
var->setter = val_setter;
@@ -382,73 +359,55 @@ undef_setter(val, id, data, var)
}
static void
-undef_marker()
+undef_marker(void)
{
}
static VALUE
-val_getter(id, val)
- ID id;
- VALUE val;
+val_getter(ID id, VALUE val)
{
return val;
}
static void
-val_setter(val, id, data, var)
- VALUE val;
- ID id;
- void *data;
- struct global_variable *var;
+val_setter(VALUE val, ID id, void *data, struct global_variable *var)
{
var->data = (void*)val;
}
static void
-val_marker(data)
- VALUE data;
+val_marker(VALUE data)
{
if (data) rb_gc_mark_maybe(data);
}
static VALUE
-var_getter(id, var)
- ID id;
- VALUE *var;
+var_getter(ID id, VALUE *var)
{
if (!var) return Qnil;
return *var;
}
static void
-var_setter(val, id, var)
- VALUE val;
- ID id;
- VALUE *var;
+var_setter(VALUE val, ID id, VALUE *var)
{
*var = val;
}
static void
-var_marker(var)
- VALUE *var;
+var_marker(VALUE *var)
{
if (var) rb_gc_mark_maybe(*var);
}
static void
-readonly_setter(val, id, var)
- VALUE val;
- ID id;
- void *var;
+readonly_setter(VALUE val, ID id, void *var)
{
rb_name_error(id, "%s is a read-only variable", rb_id2name(id));
}
static int
-mark_global_entry(key, entry)
- ID key;
- struct global_entry *entry;
+mark_global_entry(ID key, struct global_entry *entry)
{
struct trace_var *trace;
struct global_variable *var = entry->var;
@@ -463,14 +422,13 @@ mark_global_entry(key, entry)
}
void
-rb_gc_mark_global_tbl()
+rb_gc_mark_global_tbl(void)
{
st_foreach_safe(rb_global_tbl, mark_global_entry, 0);
}
static ID
-global_id(name)
- const char *name;
+global_id(const char *name)
{
ID id;
@@ -485,11 +443,11 @@ global_id(name)
}
void
-rb_define_hooked_variable(name, var, getter, setter)
- const char *name;
- VALUE *var;
- VALUE (*getter)();
- void (*setter)();
+rb_define_hooked_variable(
+ const char *name,
+ VALUE *var,
+ VALUE (*getter) (/* ??? */),
+ void (*setter) (/* ??? */))
{
struct global_variable *gvar;
ID id = global_id(name);
@@ -502,26 +460,22 @@ rb_define_hooked_variable(name, var, getter, setter)
}
void
-rb_define_variable(name, var)
- const char *name;
- VALUE *var;
+rb_define_variable(const char *name, VALUE *var)
{
rb_define_hooked_variable(name, var, 0, 0);
}
void
-rb_define_readonly_variable(name, var)
- const char *name;
- VALUE *var;
+rb_define_readonly_variable(const char *name, VALUE *var)
{
rb_define_hooked_variable(name, var, 0, readonly_setter);
}
void
-rb_define_virtual_variable(name, getter, setter)
- const char *name;
- VALUE (*getter)();
- void (*setter)();
+rb_define_virtual_variable(
+ const char *name,
+ VALUE (*getter) (/* ??? */),
+ void (*setter) (/* ??? */))
{
if (!getter) getter = val_getter;
if (!setter) setter = readonly_setter;
@@ -529,8 +483,7 @@ rb_define_virtual_variable(name, getter, setter)
}
static void
-rb_trace_eval(cmd, val)
- VALUE cmd, val;
+rb_trace_eval(VALUE cmd, VALUE val)
{
rb_eval_cmd(cmd, rb_ary_new3(1, val), 0);
}
@@ -559,9 +512,7 @@ rb_trace_eval(cmd, val)
*/
VALUE
-rb_f_trace_var(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_trace_var(int argc, VALUE *argv)
{
VALUE var, cmd;
struct global_entry *entry;
@@ -589,8 +540,7 @@ rb_f_trace_var(argc, argv)
}
static void
-remove_trace(var)
- struct global_variable *var;
+remove_trace(struct global_variable *var)
{
struct trace_var *trace = var->trace;
struct trace_var t;
@@ -622,9 +572,7 @@ remove_trace(var)
*/
VALUE
-rb_f_untrace_var(argc, argv)
- int argc;
- VALUE *argv;
+rb_f_untrace_var(int argc, VALUE *argv)
{
VALUE var, cmd;
ID id;
@@ -665,8 +613,7 @@ rb_f_untrace_var(argc, argv)
}
VALUE
-rb_gvar_get(entry)
- struct global_entry *entry;
+rb_gvar_get(struct global_entry *entry)
{
struct global_variable *var = entry->var;
return (*var->getter)(entry->id, var->data, var);
@@ -678,8 +625,7 @@ struct trace_data {
};
static VALUE
-trace_ev(data)
- struct trace_data *data;
+trace_ev(struct trace_data *data)
{
struct trace_var *trace = data->trace;
@@ -691,8 +637,7 @@ trace_ev(data)
}
static VALUE
-trace_en(var)
- struct global_variable *var;
+trace_en(struct global_variable *var)
{
var->block_trace = 0;
remove_trace(var);
@@ -700,9 +645,7 @@ trace_en(var)
}
VALUE
-rb_gvar_set(entry, val)
- struct global_entry *entry;
- VALUE val;
+rb_gvar_set(struct global_entry *entry, VALUE val)
{
struct trace_data trace;
struct global_variable *var = entry->var;
@@ -721,9 +664,7 @@ rb_gvar_set(entry, val)
}
VALUE
-rb_gv_set(name, val)
- const char *name;
- VALUE val;
+rb_gv_set(const char *name, VALUE val)
{
struct global_entry *entry;
@@ -732,8 +673,7 @@ rb_gv_set(name, val)
}
VALUE
-rb_gv_get(name)
- const char *name;
+rb_gv_get(const char *name)
{
struct global_entry *entry;
@@ -742,18 +682,14 @@ rb_gv_get(name)
}
VALUE
-rb_gvar_defined(entry)
- struct global_entry *entry;
+rb_gvar_defined(struct global_entry *entry)
{
if (entry->var->getter == undef_getter) return Qfalse;
return Qtrue;
}
static int
-gvar_i(key, entry, ary)
- ID key;
- struct global_entry *entry;
- VALUE ary;
+gvar_i(ID key, struct global_entry *entry, VALUE ary)
{
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
return ST_CONTINUE;
@@ -769,7 +705,7 @@ gvar_i(key, entry, ary)
*/
VALUE
-rb_f_global_variables()
+rb_f_global_variables(void)
{
VALUE ary = rb_ary_new();
char buf[4];
@@ -786,9 +722,7 @@ rb_f_global_variables()
}
void
-rb_alias_variable(name1, name2)
- ID name1;
- ID name2;
+rb_alias_variable(ID name1, ID name2)
{
struct global_entry *entry1, *entry2;
@@ -828,8 +762,7 @@ static int special_generic_ivar = 0;
static st_table *generic_iv_tbl;
st_table*
-rb_generic_ivar_table(obj)
- VALUE obj;
+rb_generic_ivar_table(VALUE obj)
{
st_table *tbl;
@@ -840,10 +773,7 @@ rb_generic_ivar_table(obj)
}
static VALUE
-generic_ivar_get(obj, id, warn)
- VALUE obj;
- ID id;
- int warn;
+generic_ivar_get(VALUE obj, ID id, int warn)
{
st_table *tbl;
VALUE val;
@@ -862,10 +792,7 @@ generic_ivar_get(obj, id, warn)
}
static void
-generic_ivar_set(obj, id, val)
- VALUE obj;
- ID id;
- VALUE val;
+generic_ivar_set(VALUE obj, ID id, VALUE val)
{
st_table *tbl;
@@ -887,9 +814,7 @@ generic_ivar_set(obj, id, val)
}
static VALUE
-generic_ivar_defined(obj, id)
- VALUE obj;
- ID id;
+generic_ivar_defined(VALUE obj, ID id)
{
st_table *tbl;
VALUE val;
@@ -903,10 +828,7 @@ generic_ivar_defined(obj, id)
}
static int
-generic_ivar_remove(obj, id, valp)
- VALUE obj;
- ID id;
- VALUE *valp;
+generic_ivar_remove(VALUE obj, ID id, VALUE *valp)
{
st_table *tbl;
int status;
@@ -922,8 +844,7 @@ generic_ivar_remove(obj, id, valp)
}
void
-rb_mark_generic_ivar(obj)
- VALUE obj;
+rb_mark_generic_ivar(VALUE obj)
{
st_table *tbl;
@@ -934,18 +855,14 @@ rb_mark_generic_ivar(obj)
}
static int
-givar_mark_i(key, value)
- ID key;
- VALUE value;
+givar_mark_i(ID key, VALUE value)
{
rb_gc_mark(value);
return ST_CONTINUE;
}
static int
-givar_i(obj, tbl)
- VALUE obj;
- st_table *tbl;
+givar_i(VALUE obj, st_table *tbl)
{
if (rb_special_const_p(obj)) {
st_foreach_safe(tbl, givar_mark_i, 0);
@@ -954,7 +871,7 @@ givar_i(obj, tbl)
}
void
-rb_mark_generic_ivar_tbl()
+rb_mark_generic_ivar_tbl(void)
{
if (!generic_iv_tbl) return;
if (special_generic_ivar == 0) return;
@@ -962,8 +879,7 @@ rb_mark_generic_ivar_tbl()
}
void
-rb_free_generic_ivar(obj)
- VALUE obj;
+rb_free_generic_ivar(VALUE obj)
{
st_table *tbl;
@@ -973,8 +889,7 @@ rb_free_generic_ivar(obj)
}
void
-rb_copy_generic_ivar(clone, obj)
- VALUE clone, obj;
+rb_copy_generic_ivar(VALUE clone, VALUE obj)
{
st_table *tbl;
@@ -995,10 +910,7 @@ rb_copy_generic_ivar(clone, obj)
}
static VALUE
-ivar_get(obj, id, warn)
- VALUE obj;
- ID id;
- int warn;
+ivar_get(VALUE obj, ID id, int warn)
{
VALUE val;
@@ -1021,26 +933,19 @@ ivar_get(obj, id, warn)
}
VALUE
-rb_ivar_get(obj, id)
- VALUE obj;
- ID id;
+rb_ivar_get(VALUE obj, ID id)
{
return ivar_get(obj, id, Qtrue);
}
VALUE
-rb_attr_get(obj, id)
- VALUE obj;
- ID id;
+rb_attr_get(VALUE obj, ID id)
{
return ivar_get(obj, id, Qfalse);
}
VALUE
-rb_ivar_set(obj, id, val)
- VALUE obj;
- ID id;
- VALUE val;
+rb_ivar_set(VALUE obj, ID id, VALUE val)
{
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify instance variable");
@@ -1060,9 +965,7 @@ rb_ivar_set(obj, id, val)
}
VALUE
-rb_ivar_defined(obj, id)
- VALUE obj;
- ID id;
+rb_ivar_defined(VALUE obj, ID id)
{
switch (TYPE(obj)) {
case T_OBJECT:
@@ -1080,10 +983,7 @@ rb_ivar_defined(obj, id)
}
static int
-ivar_i(key, entry, ary)
- ID key;
- struct global_entry *entry;
- VALUE ary;
+ivar_i(ID key, struct global_entry *entry, VALUE ary)
{
if (rb_is_instance_id(key)) {
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
@@ -1109,8 +1009,7 @@ ivar_i(key, entry, ary)
*/
VALUE
-rb_obj_instance_variables(obj)
- VALUE obj;
+rb_obj_instance_variables(VALUE obj)
{
VALUE ary;
@@ -1160,8 +1059,7 @@ rb_obj_instance_variables(obj)
*/
VALUE
-rb_obj_remove_instance_variable(obj, name)
- VALUE obj, name;
+rb_obj_remove_instance_variable(VALUE obj, VALUE name)
{
VALUE val = Qnil;
ID id = rb_to_id(name);
@@ -1195,9 +1093,7 @@ rb_obj_remove_instance_variable(obj, name)
NORETURN(static void uninitialized_constant _((VALUE, ID)));
static void
-uninitialized_constant(klass, id)
- VALUE klass;
- ID id;
+uninitialized_constant(VALUE klass, ID id)
{
if (klass && klass != rb_cObject)
rb_name_error(id, "uninitialized constant %s::%s",
@@ -1209,9 +1105,7 @@ uninitialized_constant(klass, id)
}
static VALUE
-const_missing(klass, id)
- VALUE klass;
- ID id;
+const_missing(VALUE klass, ID id)
{
return rb_funcall(klass, rb_intern("const_missing"), 1, ID2SYM(id));
}
@@ -1246,8 +1140,7 @@ const_missing(klass, id)
*/
VALUE
-rb_mod_const_missing(klass, name)
- VALUE klass, name;
+rb_mod_const_missing(VALUE klass, VALUE name)
{
ruby_frame = ruby_frame->prev; /* pop frame for "const_missing" */
uninitialized_constant(klass, rb_to_id(name));
@@ -1255,8 +1148,7 @@ rb_mod_const_missing(klass, name)
}
static struct st_table *
-check_autoload_table(av)
- VALUE av;
+check_autoload_table(VALUE av)
{
Check_Type(av, T_DATA);
if (RDATA(av)->dmark != (RUBY_DATA_FUNC)rb_mark_tbl ||
@@ -1267,10 +1159,7 @@ check_autoload_table(av)
}
void
-rb_autoload(mod, id, file)
- VALUE mod;
- ID id;
- const char *file;
+rb_autoload(VALUE mod, ID id, const char *file)
{
VALUE av, fn;
struct st_table *tbl;
@@ -1302,9 +1191,7 @@ rb_autoload(mod, id, file)
}
static NODE*
-autoload_delete(mod, id)
- VALUE mod;
- ID id;
+autoload_delete(VALUE mod, ID id)
{
VALUE val;
st_data_t load = 0;
@@ -1329,9 +1216,7 @@ autoload_delete(mod, id)
}
void
-rb_autoload_load(klass, id)
- VALUE klass;
- ID id;
+rb_autoload_load(VALUE klass, ID id)
{
VALUE file;
NODE *load = autoload_delete(klass, id);
@@ -1343,9 +1228,7 @@ rb_autoload_load(klass, id)
}
static VALUE
-autoload_file(mod, id)
- VALUE mod;
- ID id;
+autoload_file(VALUE mod, ID id)
{
VALUE val, file;
struct st_table *tbl;
@@ -1378,9 +1261,7 @@ autoload_file(mod, id)
}
VALUE
-rb_autoload_p(mod, id)
- VALUE mod;
- ID id;
+rb_autoload_p(VALUE mod, ID id)
{
struct st_table *tbl = RCLASS(mod)->iv_tbl;
VALUE val;
@@ -1392,10 +1273,7 @@ rb_autoload_p(mod, id)
}
static VALUE
-rb_const_get_0(klass, id, exclude, recurse)
- VALUE klass;
- ID id;
- int exclude, recurse;
+rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
{
VALUE value, tmp;
int mod_retry = 0;
@@ -1427,25 +1305,19 @@ rb_const_get_0(klass, id, exclude, recurse)
}
VALUE
-rb_const_get_from(klass, id)
- VALUE klass;
- ID id;
+rb_const_get_from(VALUE klass, ID id)
{
return rb_const_get_0(klass, id, Qtrue, Qtrue);
}
VALUE
-rb_const_get(klass, id)
- VALUE klass;
- ID id;
+rb_const_get(VALUE klass, ID id)
{
return rb_const_get_0(klass, id, Qfalse, Qtrue);
}
VALUE
-rb_const_get_at(klass, id)
- VALUE klass;
- ID id;
+rb_const_get_at(VALUE klass, ID id)
{
return rb_const_get_0(klass, id, Qtrue, Qfalse);
}
@@ -1460,8 +1332,7 @@ rb_const_get_at(klass, id)
*/
VALUE
-rb_mod_remove_const(mod, name)
- VALUE mod, name;
+rb_mod_remove_const(VALUE mod, VALUE name)
{
ID id = rb_to_id(name);
VALUE val;
@@ -1490,10 +1361,7 @@ rb_mod_remove_const(mod, name)
}
static int
-sv_i(key, value, tbl)
- ID key;
- VALUE value;
- st_table *tbl;
+sv_i(ID key, VALUE value, st_table *tbl)
{
if (rb_is_const_id(key)) {
if (!st_lookup(tbl, key, 0)) {
@@ -1504,9 +1372,7 @@ sv_i(key, value, tbl)
}
void*
-rb_mod_const_at(mod, data)
- VALUE mod;
- void *data;
+rb_mod_const_at(VALUE mod, void *data)
{
st_table *tbl = data;
if (!tbl) {
@@ -1519,9 +1385,7 @@ rb_mod_const_at(mod, data)
}
void*
-rb_mod_const_of(mod, data)
- VALUE mod;
- void *data;
+rb_mod_const_of(VALUE mod, void *data)
{
VALUE tmp = mod;
for (;;) {
@@ -1534,17 +1398,14 @@ rb_mod_const_of(mod, data)
}
static int
-list_i(key, value, ary)
- ID key, value;
- VALUE ary;
+list_i(ID key, ID value, VALUE ary)
{
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
return ST_CONTINUE;
}
VALUE
-rb_const_list(data)
- void *data;
+rb_const_list(void *data)
{
st_table *tbl = data;
VALUE ary;
@@ -1567,17 +1428,13 @@ rb_const_list(data)
*/
VALUE
-rb_mod_constants(mod)
- VALUE mod;
+rb_mod_constants(VALUE mod)
{
return rb_const_list(rb_mod_const_of(mod, 0));
}
static int
-rb_const_defined_0(klass, id, exclude, recurse)
- VALUE klass;
- ID id;
- int exclude, recurse;
+rb_const_defined_0(VALUE klass, ID id, int exclude, int recurse)
{
VALUE value, tmp;
int mod_retry = 0;
@@ -1602,35 +1459,25 @@ rb_const_defined_0(klass, id, exclude, recurse)
}
int
-rb_const_defined_from(klass, id)
- VALUE klass;
- ID id;
+rb_const_defined_from(VALUE klass, ID id)
{
return rb_const_defined_0(klass, id, Qtrue, Qtrue);
}
int
-rb_const_defined(klass, id)
- VALUE klass;
- ID id;
+rb_const_defined(VALUE klass, ID id)
{
return rb_const_defined_0(klass, id, Qfalse, Qtrue);
}
int
-rb_const_defined_at(klass, id)
- VALUE klass;
- ID id;
+rb_const_defined_at(VALUE klass, ID id)
{
return rb_const_defined_0(klass, id, Qtrue, Qfalse);
}
static void
-mod_av_set(klass, id, val, isconst)
- VALUE klass;
- ID id;
- VALUE val;
- int isconst;
+mod_av_set(VALUE klass, ID id, VALUE val, int isconst)
{
char *dest = isconst ? "constant" : "class variable";
@@ -1662,19 +1509,13 @@ mod_av_set(klass, id, val, isconst)
}
void
-rb_const_set(klass, id, val)
- VALUE klass;
- ID id;
- VALUE val;
+rb_const_set(VALUE klass, ID id, VALUE val)
{
mod_av_set(klass, id, val, Qtrue);
}
void
-rb_define_const(klass, name, val)
- VALUE klass;
- const char *name;
- VALUE val;
+rb_define_const(VALUE klass, const char *name, VALUE val)
{
ID id = rb_intern(name);
@@ -1688,27 +1529,19 @@ rb_define_const(klass, name, val)
}
void
-rb_define_global_const(name, val)
- const char *name;
- VALUE val;
+rb_define_global_const(const char *name, VALUE val)
{
rb_define_const(rb_cObject, name, val);
}
void
-rb_cvar_set(klass, id, val, warn)
- VALUE klass;
- ID id;
- VALUE val;
- int warn;
+rb_cvar_set(VALUE klass, ID id, VALUE val, int warn)
{
mod_av_set(klass, id, val, Qfalse);
}
VALUE
-rb_cvar_get(klass, id)
- VALUE klass;
- ID id;
+rb_cvar_get(VALUE klass, ID id)
{
VALUE value;
@@ -1722,9 +1555,7 @@ rb_cvar_get(klass, id)
}
VALUE
-rb_cvar_defined(klass, id)
- VALUE klass;
- ID id;
+rb_cvar_defined(VALUE klass, ID id)
{
if (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl,id,0)) {
return Qtrue;
@@ -1733,10 +1564,7 @@ rb_cvar_defined(klass, id)
}
void
-rb_cv_set(klass, name, val)
- VALUE klass;
- const char *name;
- VALUE val;
+rb_cv_set(VALUE klass, const char *name, VALUE val)
{
ID id = rb_intern(name);
if (!rb_is_class_id(id)) {
@@ -1746,9 +1574,7 @@ rb_cv_set(klass, name, val)
}
VALUE
-rb_cv_get(klass, name)
- VALUE klass;
- const char *name;
+rb_cv_get(VALUE klass, const char *name)
{
ID id = rb_intern(name);
if (!rb_is_class_id(id)) {
@@ -1758,10 +1584,7 @@ rb_cv_get(klass, name)
}
void
-rb_define_class_variable(klass, name, val)
- VALUE klass;
- const char *name;
- VALUE val;
+rb_define_class_variable(VALUE klass, const char *name, VALUE val)
{
ID id = rb_intern(name);
@@ -1772,10 +1595,7 @@ rb_define_class_variable(klass, name, val)
}
static int
-cv_i(key, value, ary)
- ID key;
- VALUE value;
- VALUE ary;
+cv_i(ID key, VALUE value, VALUE ary)
{
if (rb_is_class_id(key)) {
VALUE kval = rb_str_new2(rb_id2name(key));
@@ -1803,8 +1623,7 @@ cv_i(key, value, ary)
*/
VALUE
-rb_mod_class_variables(obj)
- VALUE obj;
+rb_mod_class_variables(VALUE obj)
{
VALUE ary = rb_ary_new();
@@ -1835,8 +1654,7 @@ rb_mod_class_variables(obj)
*/
VALUE
-rb_mod_remove_cvar(mod, name)
- VALUE mod, name;
+rb_mod_remove_cvar(VALUE mod, VALUE name)
{
ID id = rb_to_id(name);
VALUE val;
@@ -1861,9 +1679,7 @@ rb_mod_remove_cvar(mod, name)
}
VALUE
-rb_iv_get(obj, name)
- VALUE obj;
- const char *name;
+rb_iv_get(VALUE obj, const char *name)
{
ID id = rb_intern(name);
@@ -1871,10 +1687,7 @@ rb_iv_get(obj, name)
}
VALUE
-rb_iv_set(obj, name, val)
- VALUE obj;
- const char *name;
- VALUE val;
+rb_iv_set(VALUE obj, const char *name, VALUE val)
{
ID id = rb_intern(name);
diff --git a/version.c b/version.c
index acf34ce5f1..94df60cdde 100644
--- a/version.c
+++ b/version.c
@@ -19,7 +19,7 @@ const char ruby_release_date[] = RUBY_RELEASE_DATE;
const char ruby_platform[] = RUBY_PLATFORM;
void
-Init_version()
+Init_version(void)
{
VALUE v = rb_obj_freeze(rb_str_new2(ruby_version));
VALUE d = rb_obj_freeze(rb_str_new2(ruby_release_date));
@@ -31,14 +31,14 @@ Init_version()
}
void
-ruby_show_version()
+ruby_show_version(void)
{
printf("ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM);
fflush(stdout);
}
void
-ruby_show_copyright()
+ruby_show_copyright(void)
{
printf("ruby - Copyright (C) 1993-%d Yukihiro Matsumoto\n", RUBY_RELEASE_YEAR);
exit(0);