diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 2 | ||||
-rw-r--r-- | ext/bigdecimal/bigdecimal.h | 2 | ||||
-rw-r--r-- | ext/etc/etc.c | 6 | ||||
-rw-r--r-- | ext/io/wait/wait.c | 5 | ||||
-rw-r--r-- | ext/pty/pty.c | 2 | ||||
-rw-r--r-- | ext/racc/cparse/cparse.c | 67 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 33 | ||||
-rw-r--r-- | ext/socket/getnameinfo.c | 15 | ||||
-rw-r--r-- | ext/stringio/stringio.c | 171 | ||||
-rw-r--r-- | ext/strscan/strscan.c | 153 | ||||
-rw-r--r-- | ext/syck/emitter.c | 6 | ||||
-rw-r--r-- | ext/syck/rubyext.c | 229 | ||||
-rw-r--r-- | ext/syck/syck.h | 2 | ||||
-rw-r--r-- | ext/syck/yaml2byte.c | 2 | ||||
-rw-r--r-- | ext/tk/stubs.c | 30 | ||||
-rw-r--r-- | ext/tk/tcltklib.c | 8 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 9 |
17 files changed, 221 insertions, 521 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 46ed596b7..97a9c63e7 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -1823,7 +1823,7 @@ VpInit(U_LONG BaseVal) } VP_EXPORT Real * -VpOne() +VpOne(void) { return VpConstOne; } diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h index 80a1ba816..4f77feab0 100644 --- a/ext/bigdecimal/bigdecimal.h +++ b/ext/bigdecimal/bigdecimal.h @@ -155,7 +155,7 @@ VP_EXPORT void VpFrac(Real *y,Real *x); VP_EXPORT int VpPower(Real *y,Real *x,S_INT n); /* VP constants */ -VP_EXPORT Real *VpOne(); +VP_EXPORT Real *VpOne(void); /* * ------------------ diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 6235d76a7..64d46c75c 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -40,8 +40,7 @@ char *getlogin(); * Etc.getlogin -> 'guest' */ static VALUE -etc_getlogin(obj) - VALUE obj; +etc_getlogin(VALUE obj) { char *login; @@ -60,8 +59,7 @@ etc_getlogin(obj) #if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT) static VALUE -safe_setup_str(str) - const char *str; +safe_setup_str(const char *str) { if (str == 0) str = ""; return rb_tainted_str_new2(str); diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index 20aab9dd6..13daaf6b5 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -92,10 +92,7 @@ wait_readable(VALUE p) =end */ static VALUE -io_wait(argc, argv, io) - int argc; - VALUE *argv; - VALUE io; +io_wait(int argc, VALUE *argv, VALUE io) { OpenFile *fptr; struct wait_readable_arg arg; diff --git a/ext/pty/pty.c b/ext/pty/pty.c index ef357ace5..5f73d286f 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -196,7 +196,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info) int status; if (argc == 0) { - char *shellname; + const char *shellname; if ((p = getenv("SHELL")) != NULL) { shellname = p; diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c index 24c4e36f2..678d6ad37 100644 --- a/ext/racc/cparse/cparse.c +++ b/ext/racc/cparse/cparse.c @@ -67,8 +67,7 @@ static inline long num_to_long _((VALUE n)); #endif static ID -value_to_id(v) - VALUE v; +value_to_id(VALUE v) { #ifndef SYMBOL_P # define SYMBOL_P(v) FIXNUM_P(v) @@ -88,8 +87,7 @@ value_to_id(v) #endif static inline long -num_to_long(n) - VALUE n; +num_to_long(VALUE n) { return NUM2LONG(n); } @@ -106,9 +104,7 @@ static VALUE get_stack_tail _((VALUE stack, long len)); static void cut_stack_tail _((VALUE stack, long len)); static VALUE -get_stack_tail(stack, len) - VALUE stack; - long len; +get_stack_tail(VALUE stack, long len) { if (len < 0) return Qnil; /* system error */ if (len > RARRAY(stack)->len) len = RARRAY(stack)->len; @@ -116,9 +112,7 @@ get_stack_tail(stack, len) } static void -cut_stack_tail(stack, len) - VALUE stack; - long len; +cut_stack_tail(VALUE stack, long len) { while (len > 0) { rb_ary_pop(stack); @@ -231,8 +225,7 @@ static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self)); #endif static VALUE -racc_cparse(parser, arg, sysdebug) - VALUE parser, arg, sysdebug; +racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug) { struct cparse_params params; struct cparse_params *v = ¶ms; @@ -247,8 +240,7 @@ racc_cparse(parser, arg, sysdebug) } static VALUE -racc_yyparse(parser, lexer, lexmid, arg, sysdebug) - VALUE parser, lexer, lexmid, arg, sysdebug; +racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug) { struct cparse_params params; struct cparse_params *v = ¶ms; @@ -269,15 +261,13 @@ racc_yyparse(parser, lexer, lexmid, arg, sysdebug) } static void -call_lexer(v) - struct cparse_params *v; +call_lexer(struct cparse_params *v) { rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v); } static VALUE -lexer_iter(data) - VALUE data; +lexer_iter(VALUE data) { struct cparse_params *v; @@ -287,8 +277,7 @@ lexer_iter(data) } static VALUE -lexer_i(block_args, data, self) - VALUE block_args, data, self; +lexer_i(VALUE block_args, VALUE data, VALUE self) { struct cparse_params *v; VALUE tok, val; @@ -304,32 +293,27 @@ lexer_i(block_args, data, self) } static VALUE -assert_array(a) - VALUE a; +assert_array(VALUE a) { Check_Type(a, T_ARRAY); return a; } static VALUE -assert_hash(h) - VALUE h; +assert_hash(VALUE h) { Check_Type(h, T_HASH); return h; } static long -assert_integer(n) - VALUE n; +assert_integer(VALUE n) { return NUM2LONG(n); } static void -initialize_params(v, parser, arg, lexer, lexmid) - struct cparse_params *v; - VALUE parser, arg, lexer, lexmid; +initialize_params(struct cparse_params *v, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid) { v->value_v = Data_Wrap_Struct(CparseParams, 0, 0, v); @@ -380,10 +364,7 @@ initialize_params(v, parser, arg, lexer, lexmid) } static void -extract_user_token(v, block_args, tok, val) - struct cparse_params *v; - VALUE block_args; - VALUE *tok, *val; +extract_user_token(struct cparse_params *v, VALUE block_args, VALUE *tok, VALUE *val) { if (NIL_P(block_args)) { /* EOF */ @@ -426,10 +407,7 @@ extract_user_token(v, block_args, tok, val) } while (0) static void -parse_main(v, tok, val, resume) - struct cparse_params *v; - VALUE tok, val; - int resume; +parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume) { long i; /* table index */ long act; /* action type */ @@ -636,10 +614,7 @@ parse_main(v, tok, val, resume) } static void -shift(v, act, tok, val) - struct cparse_params *v; - long act; - VALUE tok, val; +shift(struct cparse_params *v, long act, VALUE tok, VALUE val) { PUSH(v->vstack, val); if (v->debug) { @@ -652,9 +627,7 @@ shift(v, act, tok, val) } static int -reduce(v, act) - struct cparse_params *v; - long act; +reduce(struct cparse_params *v, long act) { VALUE code; v->ruleno = -act * 3; @@ -664,15 +637,13 @@ reduce(v, act) } static VALUE -catch_iter(dummy) - VALUE dummy; +catch_iter(VALUE dummy) { return rb_funcall(rb_mKernel, id_catch, 1, sym_raccjump); } static VALUE -reduce0(val, data, self) - VALUE val, data, self; +reduce0(VALUE val, VALUE data, VALUE self) { struct cparse_params *v; VALUE reduce_to, reduce_len, method_id; diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index 02f2ab9d3..5a3c1377f 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -198,8 +198,7 @@ if (pai->ai_flags & AI_CANONNAME) {\ const #endif char * -gai_strerror(ecode) - int ecode; +gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_MAX) ecode = EAI_MAX; @@ -207,7 +206,7 @@ gai_strerror(ecode) } void -freeaddrinfo(ai) +freeaddrinfo(struct addrinfo *ai) struct addrinfo *ai; { struct addrinfo *next; @@ -222,8 +221,7 @@ freeaddrinfo(ai) } static int -str_isnumber(p) - const char *p; +str_isnumber(const char *p) { char *q = (char *)p; while (*q) { @@ -237,10 +235,7 @@ str_isnumber(p) #ifndef HAVE_INET_PTON static int -inet_pton(af, hostname, pton) - int af; - const char *hostname; - void *pton; +inet_pton(int af, const char *hostname, void *pton) { struct in_addr in; @@ -268,10 +263,7 @@ inet_pton(af, hostname, pton) #endif int -getaddrinfo(hostname, servname, hints, res) - const char *hostname, *servname; - const struct addrinfo *hints; - struct addrinfo **res; +getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) { struct addrinfo sentinel; struct addrinfo *top = NULL; @@ -538,13 +530,7 @@ getaddrinfo(hostname, servname, hints, res) } static int -get_name(addr, afd, res, numaddr, pai, port0) - const char *addr; - const struct afd *afd; - struct addrinfo **res; - char *numaddr; - struct addrinfo *pai; - int port0; +get_name(const char *addr, const struct aft *afd, struct addrinfo **res, char *numaddr, struct addrinfo *pai, int port0) { u_short port = port0 & 0xffff; struct hostent *hp; @@ -584,12 +570,7 @@ get_name(addr, afd, res, numaddr, pai, port0) } static int -get_addr(hostname, af, res, pai, port0) - const char *hostname; - int af; - struct addrinfo **res; - struct addrinfo *pai; - int port0; +get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *pai, int port0) { u_short port = port0 & 0xffff; struct addrinfo sentinel; diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index 4c9c8f03c..91e18e916 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -115,11 +115,7 @@ static struct afd { #ifndef HAVE_INET_NTOP static const char * -inet_ntop(af, addr, numaddr, numaddr_len) - int af; - const void *addr; - char *numaddr; - size_t numaddr_len; +inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len) { #ifdef HAVE_INET_NTOA struct in_addr in; @@ -136,14 +132,7 @@ inet_ntop(af, addr, numaddr, numaddr_len) #endif int -getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) - const struct sockaddr *sa; - size_t salen; - char *host; - size_t hostlen; - char *serv; - size_t servlen; - int flags; +getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { struct afd *afd; struct servent *sp; diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index a1beaae37..de28393fe 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -53,8 +53,7 @@ strio_alloc() } static void -strio_mark(ptr) - struct StringIO *ptr; +strio_mark(struct StringIO *ptr) { if (ptr) { rb_gc_mark(ptr->string); @@ -62,8 +61,7 @@ strio_mark(ptr) } static void -strio_free(ptr) - struct StringIO *ptr; +strio_free(struct StringIO *ptr) { if (--ptr->count <= 0) { xfree(ptr); @@ -71,8 +69,7 @@ strio_free(ptr) } static struct StringIO* -check_strio(self) - VALUE self; +check_strio(VALUE self) { Check_Type(self, T_DATA); if (!IS_STRIO(self)) { @@ -83,8 +80,7 @@ check_strio(self) } static struct StringIO* -get_strio(self) - VALUE self; +get_strio(VALUE self) { struct StringIO *ptr = check_strio(self); @@ -101,8 +97,7 @@ get_strio(self) #define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE) static struct StringIO* -readable(ptr) - struct StringIO *ptr; +readable(struct StringIO *ptr) { if (!READABLE(ptr)) { rb_raise(rb_eIOError, "not opened for reading"); @@ -111,8 +106,7 @@ readable(ptr) } static struct StringIO* -writable(ptr) - struct StringIO *ptr; +writable(struct StringIO *ptr) { if (!WRITABLE(ptr)) { rb_raise(rb_eIOError, "not opened for writing"); @@ -124,8 +118,7 @@ writable(ptr) } static void -check_modifiable(ptr) - struct StringIO *ptr; +check_modifiable(struct StringIO *ptr) { if (OBJ_FROZEN(ptr->string)) { rb_raise(rb_eIOError, "not modifiable string"); @@ -193,10 +186,7 @@ strio_s_allocate(klass) * returned from the block. */ static VALUE -strio_s_open(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +strio_s_open(int argc, VALUE *argv, VALUE klass) { VALUE obj = rb_class_new_instance(argc, argv, klass); if (!rb_block_given_p()) return obj; @@ -209,10 +199,7 @@ strio_s_open(argc, argv, klass) * Creates new StringIO instance from with _string_ and _mode_. */ static VALUE -strio_initialize(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_initialize(int argc, VALUE *argv, VALUE self) { struct StringIO *ptr = check_strio(self); VALUE string, mode; @@ -257,8 +244,7 @@ strio_initialize(argc, argv, self) } static VALUE -strio_finalize(self) - VALUE self; +strio_finalize(VALUE self) { struct StringIO *ptr = StringIO(self); ptr->string = Qnil; @@ -270,8 +256,7 @@ strio_finalize(self) * Returns +false+. Just for compatibility to IO. */ static VALUE -strio_false(self) - VALUE self; +strio_false(VALUE self) { StringIO(self); return Qfalse; @@ -281,8 +266,7 @@ strio_false(self) * Returns +nil+. Just for compatibility to IO. */ static VALUE -strio_nil(self) - VALUE self; +strio_nil(VALUE self) { StringIO(self); return Qnil; @@ -292,8 +276,7 @@ strio_nil(self) * Returns *strio* itself. Just for compatibility to IO. */ static VALUE -strio_self(self) - VALUE self; +strio_self(VALUE self) { StringIO(self); return self; @@ -303,8 +286,7 @@ strio_self(self) * Returns 0. Just for compatibility to IO. */ static VALUE -strio_0(self) - VALUE self; +strio_0(VALUE self) { StringIO(self); return INT2FIX(0); @@ -314,8 +296,7 @@ strio_0(self) * Returns the argument unchanged. Just for compatibility to IO. */ static VALUE -strio_first(self, arg) - VALUE self, arg; +strio_first(VALUE self, VALUE arg) { StringIO(self); return arg; @@ -325,10 +306,7 @@ strio_first(self, arg) * Raises NotImplementedError. */ static VALUE -strio_unimpl(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_unimpl(int argc, VALUE *argv, VALUE self) { StringIO(self); rb_notimplement(); @@ -341,8 +319,7 @@ strio_unimpl(argc, argv, self) * Returns underlying String object, the subject of IO. */ static VALUE -strio_get_string(self) - VALUE self; +strio_get_string(VALUE self) { return StringIO(self)->string; } @@ -354,8 +331,7 @@ strio_get_string(self) * Changes underlying String object, the subject of IO. */ static VALUE -strio_set_string(self, string) - VALUE self, string; +strio_set_string(VALUE self, VALUE string) { struct StringIO *ptr = StringIO(self); @@ -376,8 +352,7 @@ strio_set_string(self, string) * operations; an +IOError+ is raised if such an attempt is made. */ static VALUE -strio_close(self) - VALUE self; +strio_close(VALUE self) { struct StringIO *ptr = StringIO(self); if (CLOSED(ptr)) { @@ -395,8 +370,7 @@ strio_close(self) * *strio* is not readable. */ static VALUE -strio_close_read(self) - VALUE self; +strio_close_read(VALUE self) { struct StringIO *ptr = StringIO(self); if (!READABLE(ptr)) { @@ -414,8 +388,7 @@ strio_close_read(self) * *strio* is not writeable. */ static VALUE -strio_close_write(self) - VALUE self; +strio_close_write(VALUE self) { struct StringIO *ptr = StringIO(self); if (!WRITABLE(ptr)) { @@ -432,8 +405,7 @@ strio_close_write(self) * Returns +true+ if *strio* is completely closed, +false+ otherwise. */ static VALUE -strio_closed(self) - VALUE self; +strio_closed(VALUE self) { struct StringIO *ptr = StringIO(self); if (!CLOSED(ptr)) return Qfalse; @@ -447,8 +419,7 @@ strio_closed(self) * Returns +true+ if *strio* is not readable, +false+ otherwise. */ static VALUE -strio_closed_read(self) - VALUE self; +strio_closed_read(VALUE self) { struct StringIO *ptr = StringIO(self); if (READABLE(ptr)) return Qfalse; @@ -462,8 +433,7 @@ strio_closed_read(self) * Returns +true+ if *strio* is not writable, +false+ otherwise. */ static VALUE -strio_closed_write(self) - VALUE self; +strio_closed_write(VALUE self) { struct StringIO *ptr = StringIO(self); if (WRITABLE(ptr)) return Qfalse; @@ -479,8 +449,7 @@ strio_closed_write(self) * opened for reading or an +IOError+ will be raised. */ static VALUE -strio_eof(self) - VALUE self; +strio_eof(VALUE self) { struct StringIO *ptr = readable(StringIO(self)); if (ptr->pos < RSTRING(ptr->string)->len) return Qfalse; @@ -516,8 +485,7 @@ strio_copy(VALUE copy, VALUE orig) * newline. See also the <code>$.</code> variable. */ static VALUE -strio_get_lineno(self) - VALUE self; +strio_get_lineno(VALUE self) { return LONG2NUM(StringIO(self)->lineno); } @@ -530,8 +498,7 @@ strio_get_lineno(self) * <code>$.</code> is updated only on the next read. */ static VALUE -strio_set_lineno(self, lineno) - VALUE self, lineno; +strio_set_lineno(VALUE self, VALUE lineno) { StringIO(self)->lineno = NUM2LONG(lineno); return lineno; @@ -575,8 +542,7 @@ strio_reopen(int argc, VALUE *argv, VALUE self) * Returns the current offset (in bytes) of *strio*. */ static VALUE -strio_get_pos(self) - VALUE self; +strio_get_pos(VALUE self) { return LONG2NUM(StringIO(self)->pos); } @@ -588,9 +554,7 @@ strio_get_pos(self) * Seeks to the given position (in bytes) in *strio*. */ static VALUE -strio_set_pos(self, pos) - VALUE self; - VALUE pos; +strio_set_pos(VALUE self, VALUE pos) { struct StringIO *ptr = StringIO(self); long p = NUM2LONG(pos); @@ -609,8 +573,7 @@ strio_set_pos(self, pos) * +lineno+ to zero. */ static VALUE -strio_rewind(self) - VALUE self; +strio_rewind(VALUE self) { struct StringIO *ptr = StringIO(self); ptr->pos = 0; @@ -626,10 +589,7 @@ strio_rewind(self) * the value of _whence_ (see IO#seek). */ static VALUE -strio_seek(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_seek(int argc, VALUE *argv, VALUE self) { VALUE whence; struct StringIO *ptr = StringIO(self); @@ -663,8 +623,7 @@ strio_seek(argc, argv, self) * Returns +true+ always. */ static VALUE -strio_get_sync(self) - VALUE self; +strio_get_sync(VALUE self) { StringIO(self); return Qtrue; @@ -682,8 +641,7 @@ strio_get_sync(self) * See IO#each_byte. */ static VALUE -strio_each_byte(self) - VALUE self; +strio_each_byte(VALUE self) { struct StringIO *ptr = readable(StringIO(self)); while (ptr->pos < RSTRING(ptr->string)->len) { @@ -700,8 +658,7 @@ strio_each_byte(self) * See IO#getc. */ static VALUE -strio_getc(self) - VALUE self; +strio_getc(VALUE self) { struct StringIO *ptr = readable(StringIO(self)); int c; @@ -740,8 +697,7 @@ strio_extend(struct StringIO *ptr, long pos, long len) * In other case, there is no limitation for multiple pushbacks. */ static VALUE -strio_ungetc(self, ch) - VALUE self, ch; +strio_ungetc(VALUE self, VALUE ch) { struct StringIO *ptr = readable(StringIO(self)); int cc = NUM2INT(ch); @@ -767,8 +723,7 @@ strio_ungetc(self, ch) * See IO#readchar. */ static VALUE -strio_readchar(self) - VALUE self; +strio_readchar(VALUE self) { VALUE c = strio_getc(self); if (NIL_P(c)) rb_eof_error(); @@ -776,10 +731,7 @@ strio_readchar(self) } static void -bm_init_skip(skip, pat, m) - long *skip; - const char *pat; - long m; +bm_init_skip(long *skip, const char *pat, long m) { int c; @@ -792,12 +744,7 @@ bm_init_skip(skip, pat, m) } static long -bm_search(little, llen, big, blen, skip) - const char *little; - long llen; - const char *big; - long blen; - const long *skip; +bm_search(const char *little, long llen, const char *big, long blen, const long *skip) { long i, j, k; @@ -816,10 +763,7 @@ bm_search(little, llen, big, blen, skip) } static VALUE -strio_getline(argc, argv, ptr) - int argc; - VALUE *argv; - struct StringIO *ptr; +strio_getline(int argc, VALUE *argv, struct StringIO *ptr) { const char *s, *e, *p; long n; @@ -897,10 +841,7 @@ strio_getline(argc, argv, ptr) * See IO#gets. */ static VALUE -strio_gets(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_gets(int argc, VALUE *argv, VALUE self) { VALUE str = strio_getline(argc, argv, readable(StringIO(self))); @@ -915,10 +856,7 @@ strio_gets(argc, argv, self) * See IO#readline. */ static VALUE -strio_readline(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_readline(int argc, VALUE *argv, VALUE self) { VALUE line = strio_getline(argc, argv, readable(StringIO(self))); if (NIL_P(line)) rb_eof_error(); @@ -933,10 +871,7 @@ strio_readline(argc, argv, self) * See IO#each. */ static VALUE -strio_each(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_each(int argc, VALUE *argv, VALUE self) { struct StringIO *ptr = StringIO(self); VALUE line; @@ -954,10 +889,7 @@ strio_each(argc, argv, self) * See IO#readlines. */ static VALUE -strio_readlines(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_readlines(int argc, VALUE *argv, VALUE self) { struct StringIO *ptr = StringIO(self); VALUE ary = rb_ary_new(), line; @@ -978,8 +910,7 @@ strio_readlines(argc, argv, self) * Returns the number of bytes written. See IO#write. */ static VALUE -strio_write(self, str) - VALUE self, str; +strio_write(VALUE self, VALUE str) { struct StringIO *ptr = writable(StringIO(self)); long len, olen; @@ -1037,8 +968,7 @@ strio_write(self, str) * See IO#putc. */ static VALUE -strio_putc(self, ch) - VALUE self, ch; +strio_putc(VALUE self, VALUE ch) { struct StringIO *ptr = writable(StringIO(self)); int c = NUM2CHR(ch); @@ -1070,10 +1000,7 @@ strio_putc(self, ch) * See IO#read. */ static VALUE -strio_read(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_read(int argc, VALUE *argv, VALUE self) { struct StringIO *ptr = readable(StringIO(self)); VALUE str = Qnil; @@ -1178,8 +1105,7 @@ strio_sysread(int argc, VALUE *argv, VALUE self) * Returns the size of the buffer string. */ static VALUE -strio_size(self) - VALUE self; +strio_size(VALUE self) { VALUE string = StringIO(self)->string; if (NIL_P(string)) { @@ -1196,8 +1122,7 @@ strio_size(self) * must be opened for writing. */ static VALUE -strio_truncate(self, len) - VALUE self, len; +strio_truncate(VALUE self, VALUE len) { VALUE string = writable(StringIO(self))->string; long l = NUM2LONG(len); diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 913c6b53c..1dd61e596 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -119,18 +119,14 @@ static VALUE inspect2 _((struct strscanner *p)); ======================================================================= */ static VALUE -infect(str, p) - VALUE str; - struct strscanner *p; +infect(VALUE str, struct strscanner *p) { OBJ_INFECT(str, p->str); return str; } static VALUE -extract_range(p, beg_i, end_i) - struct strscanner *p; - long beg_i, end_i; +extract_range(struct strscanner *p, long beg_i, long end_i) { if (beg_i > S_LEN(p)) return Qnil; if (end_i > S_LEN(p)) @@ -139,9 +135,7 @@ extract_range(p, beg_i, end_i) } static VALUE -extract_beg_len(p, beg_i, len) - struct strscanner *p; - long beg_i, len; +extract_beg_len(struct strscanner *p, long beg_i, long len) { if (beg_i > S_LEN(p)) return Qnil; if (beg_i + len > S_LEN(p)) @@ -154,23 +148,20 @@ extract_beg_len(p, beg_i, len) ======================================================================= */ static void -strscan_mark(p) - struct strscanner *p; +strscan_mark(struct strscanner *p) { rb_gc_mark(p->str); } static void -strscan_free(p) - struct strscanner *p; +strscan_free(struct strscanner *p) { onig_region_free(&(p->regs), 0); free(p); } static VALUE -strscan_s_allocate(klass) - VALUE klass; +strscan_s_allocate(VALUE klass) { struct strscanner *p; @@ -189,10 +180,7 @@ strscan_s_allocate(klass) * +dup+ argument is obsolete and not used now. */ static VALUE -strscan_initialize(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strscan_initialize(int argc, VALUE *argv, VALUE self) { struct strscanner *p; VALUE str, need_dup; @@ -206,8 +194,7 @@ strscan_initialize(argc, argv, self) } void -check_strscan(obj) - VALUE obj; +check_strscan(VALUE obj) { if (TYPE(obj) != T_DATA || RDATA(obj)->dmark != (RUBY_DATA_FUNC)strscan_mark) { rb_raise(rb_eTypeError, @@ -224,8 +211,7 @@ check_strscan(obj) * Duplicates a StringScanner object. */ static VALUE -strscan_init_copy(vself, vorig) - VALUE vself, vorig; +strscan_init_copy(VALUE vself, VALUE vorig) { struct strscanner *self, *orig; @@ -253,8 +239,7 @@ strscan_init_copy(vself, vorig) * This method is defined for backward compatibility. */ static VALUE -strscan_s_mustc(self) - VALUE self; +strscan_s_mustc(VALUE self) { return self; } @@ -281,8 +266,7 @@ strscan_reset(VALUE self) * Set the scan pointer to the end of the string and clear matching data. */ static VALUE -strscan_terminate(self) - VALUE self; +strscan_terminate(VALUE self) { struct strscanner *p; @@ -297,8 +281,7 @@ strscan_terminate(self) * This method is obsolete; use #terminate instead. */ static VALUE -strscan_clear(self) - VALUE self; +strscan_clear(VALUE self) { rb_warning("StringScanner#clear is obsolete; use #terminate instead"); return strscan_terminate(self); @@ -308,8 +291,7 @@ strscan_clear(self) * Returns the string being scanned. */ static VALUE -strscan_get_string(self) - VALUE self; +strscan_get_string(VALUE self) { struct strscanner *p; @@ -324,8 +306,7 @@ strscan_get_string(self) * Returns +str+. */ static VALUE -strscan_set_string(self, str) - VALUE self, str; +strscan_set_string(VALUE self, VALUE str) { struct strscanner *p; @@ -353,8 +334,7 @@ strscan_set_string(self, str) * s.scan(/Dec/) # -> "Dec" */ static VALUE -strscan_concat(self, str) - VALUE self, str; +strscan_concat(VALUE self, VALUE str) { struct strscanner *p; @@ -379,8 +359,7 @@ strscan_concat(self, str) * s.pos # -> 11 */ static VALUE -strscan_get_pos(self) - VALUE self; +strscan_get_pos(VALUE self) { struct strscanner *p; @@ -398,8 +377,7 @@ strscan_get_pos(self) * s.rest # -> "ring" */ static VALUE -strscan_set_pos(self, v) - VALUE self, v; +strscan_set_pos(VALUE self, VALUE v) { struct strscanner *p; long i; @@ -417,9 +395,7 @@ strscan_set_pos(self, v) #define strscan_prepare_re(re) /* none */ static VALUE -strscan_do_scan(self, regex, succptr, getstr, headonly) - VALUE self, regex; - int succptr, getstr, headonly; +strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly) { struct strscanner *p; int ret; @@ -479,8 +455,7 @@ strscan_do_scan(self, regex, succptr, getstr, headonly) * */ static VALUE -strscan_scan(self, re) - VALUE self, re; +strscan_scan(VALUE self, VALUE re) { return strscan_do_scan(self, re, 1, 1, 1); } @@ -497,8 +472,7 @@ strscan_scan(self, re) * p s.match?(/\s+/) # -> nil */ static VALUE -strscan_match_p(self, re) - VALUE self, re; +strscan_match_p(VALUE self, VALUE re) { return strscan_do_scan(self, re, 0, 0, 1); } @@ -521,8 +495,7 @@ strscan_match_p(self, re) * */ static VALUE -strscan_skip(self, re) - VALUE self, re; +strscan_skip(VALUE self, VALUE re) { return strscan_do_scan(self, re, 1, 0, 1); } @@ -543,8 +516,7 @@ strscan_skip(self, re) * Mnemonic: it "checks" to see whether a #scan will return a value. */ static VALUE -strscan_check(self, re) - VALUE self, re; +strscan_check(VALUE self, VALUE re) { return strscan_do_scan(self, re, 0, 1, 1); } @@ -560,8 +532,7 @@ strscan_check(self, re) * "full" means "#scan with full parameters". */ static VALUE -strscan_scan_full(self, re, s, f) - VALUE self, re, s, f; +strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f) { return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1); } @@ -579,8 +550,7 @@ strscan_scan_full(self, re, s, f) * s.scan_until(/XYZ/) # -> nil */ static VALUE -strscan_scan_until(self, re) - VALUE self, re; +strscan_scan_until(VALUE self, VALUE re) { return strscan_do_scan(self, re, 1, 1, 0); } @@ -621,8 +591,7 @@ strscan_exist_p(VALUE self, VALUE re) * s # */ static VALUE -strscan_skip_until(self, re) - VALUE self, re; +strscan_skip_until(VALUE self, VALUE re) { return strscan_do_scan(self, re, 1, 0, 0); } @@ -641,8 +610,7 @@ strscan_skip_until(self, re) * Mnemonic: it "checks" to see whether a #scan_until will return a value. */ static VALUE -strscan_check_until(self, re) - VALUE self, re; +strscan_check_until(VALUE self, VALUE re) { return strscan_do_scan(self, re, 0, 1, 0); } @@ -657,15 +625,13 @@ strscan_check_until(self, re) * This method does affect the match register. */ static VALUE -strscan_search_full(self, re, s, f) - VALUE self, re, s, f; +strscan_search_full(VALUE self, VALUE re, VALUE s, VALUE f) { return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0); } static void -adjust_registers_to_matched(p) - struct strscanner *p; +adjust_registers_to_matched(struct strscanner *p) { onig_region_clear(&(p->regs)); onig_region_set(&(p->regs), 0, 0, p->curr - p->prev); @@ -686,8 +652,7 @@ adjust_registers_to_matched(p) * s.getch # => nil */ static VALUE -strscan_getch(self) - VALUE self; +strscan_getch(VALUE self) { struct strscanner *p; long len; @@ -726,8 +691,7 @@ strscan_getch(self) * s.get_byte # => nil */ static VALUE -strscan_get_byte(self) - VALUE self; +strscan_get_byte(VALUE self) { struct strscanner *p; @@ -749,8 +713,7 @@ strscan_get_byte(self) * This method is obsolete; use #get_byte instead. */ static VALUE -strscan_getbyte(self) - VALUE self; +strscan_getbyte(VALUE self) { rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead"); return strscan_get_byte(self); @@ -768,8 +731,7 @@ strscan_getbyte(self) * */ static VALUE -strscan_peek(self, vlen) - VALUE self, vlen; +strscan_peek(VALUE self, VALUE vlen) { struct strscanner *p; long len; @@ -790,8 +752,7 @@ strscan_peek(self, vlen) * This method is obsolete; use #peek instead. */ static VALUE -strscan_peep(self, vlen) - VALUE self, vlen; +strscan_peep(VALUE self, VALUE vlen) { rb_warning("StringScanner#peep is obsolete; use #peek instead"); return strscan_peek(self, vlen); @@ -809,8 +770,7 @@ strscan_peep(self, vlen) * s.unscan # ScanError: unscan failed: previous match record not exist */ static VALUE -strscan_unscan(self) - VALUE self; +strscan_unscan(VALUE self) { struct strscanner *p; @@ -835,8 +795,7 @@ strscan_unscan(self) * s.bol? # => true */ static VALUE -strscan_bol_p(self) - VALUE self; +strscan_bol_p(VALUE self) { struct strscanner *p; @@ -857,8 +816,7 @@ strscan_bol_p(self) * p s.eos? # => true */ static VALUE -strscan_eos_p(self) - VALUE self; +strscan_eos_p(VALUE self) { struct strscanner *p; @@ -871,8 +829,7 @@ strscan_eos_p(self) * This method is obsolete, use #eos? instead. */ static VALUE -strscan_empty_p(self) - VALUE self; +strscan_empty_p(VALUE self) { rb_warning("StringScanner#empty? is obsolete; use #eos? instead"); return strscan_eos_p(self); @@ -887,8 +844,7 @@ strscan_empty_p(self) * s.rest? # are opposites. */ static VALUE -strscan_rest_p(self) - VALUE self; +strscan_rest_p(VALUE self) { struct strscanner *p; @@ -906,8 +862,7 @@ strscan_rest_p(self) * s.matched? # => false */ static VALUE -strscan_matched_p(self) - VALUE self; +strscan_matched_p(VALUE self) { struct strscanner *p; @@ -923,8 +878,7 @@ strscan_matched_p(self) * s.matched # -> "test" */ static VALUE -strscan_matched(self) - VALUE self; +strscan_matched(VALUE self) { struct strscanner *p; @@ -945,8 +899,7 @@ strscan_matched(self) * s.matched_size # -> nil */ static VALUE -strscan_matched_size(self) - VALUE self; +strscan_matched_size(VALUE self) { struct strscanner *p; @@ -981,8 +934,7 @@ strscan_matchedsize(VALUE self) * s.pre_match # -> "" */ static VALUE -strscan_aref(self, idx) - VALUE self, idx; +strscan_aref(VALUE self, VALUE idx) { struct strscanner *p; long i; @@ -1011,8 +963,7 @@ strscan_aref(self, idx) * s.post_match # -> "string" */ static VALUE -strscan_pre_match(self) - VALUE self; +strscan_pre_match(VALUE self) { struct strscanner *p; @@ -1031,8 +982,7 @@ strscan_pre_match(self) * s.post_match # -> "string" */ static VALUE -strscan_post_match(self) - VALUE self; +strscan_post_match(VALUE self) { struct strscanner *p; @@ -1046,8 +996,7 @@ strscan_post_match(self) * If there is no more data (eos? = true), it returns <tt>""</tt>. */ static VALUE -strscan_rest(self) - VALUE self; +strscan_rest(VALUE self) { struct strscanner *p; @@ -1062,8 +1011,7 @@ strscan_rest(self) * <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>. */ static VALUE -strscan_rest_size(self) - VALUE self; +strscan_rest_size(VALUE self) { struct strscanner *p; long i; @@ -1102,8 +1050,7 @@ strscan_restsize(VALUE self) * s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">' */ static VALUE -strscan_inspect(self) - VALUE self; +strscan_inspect(VALUE self) { struct strscanner *p; char buf[BUFSIZE]; @@ -1140,8 +1087,7 @@ strscan_inspect(self) } static VALUE -inspect1(p) - struct strscanner *p; +inspect1(struct strscanner *p) { char buf[BUFSIZE]; char *bp = buf; @@ -1160,8 +1106,7 @@ inspect1(p) } static VALUE -inspect2(p) - struct strscanner *p; +inspect2(struct strscanner *p) { char buf[BUFSIZE]; char *bp = buf; diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index f5c6c3c4b..40d91931d 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -106,7 +106,7 @@ syck_base64dec( char *s, long len ) * Allocate an emitter */ SyckEmitter * -syck_new_emitter() +syck_new_emitter(void) { SyckEmitter *e; e = S_ALLOC( SyckEmitter ); @@ -786,8 +786,8 @@ syck_emitter_escape( SyckEmitter *e, char *src, long len ) else { syck_emitter_write( e, "x", 1 ); - syck_emitter_write( e, (char *)hex_table + ((src[i] & 0xF0) >> 4), 1 ); - syck_emitter_write( e, (char *)hex_table + (src[i] & 0x0F), 1 ); + syck_emitter_write( e, (const char *)hex_table + ((src[i] & 0xF0) >> 4), 1 ); + syck_emitter_write( e, (const char *)hex_table + (src[i] & 0x0F), 1 ); } } else diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index 4c66e30f2..ec2fe8b5e 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -97,8 +97,7 @@ struct emitter_xtra { * Convert YAML to bytecode */ VALUE -rb_syck_compile(self, port) - VALUE self, port; +rb_syck_compile(VALUE self, VALUE port) { SYMID oid; int taint; @@ -164,9 +163,7 @@ rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip ) * (returns tainted? boolean) */ int -syck_parser_assign_io(parser, pport) - SyckParser *parser; - VALUE *pport; +syck_parser_assign_io(SyckParser *parser, VALUE *pport) { int taint = Qtrue; VALUE tmp, port = *pport; @@ -192,8 +189,7 @@ syck_parser_assign_io(parser, pport) * Get value in hash by key, forcing an empty hash if nil. */ VALUE -syck_get_hash_aref(hsh, key) - VALUE hsh, key; +syck_get_hash_aref(VALUE hsh, VALUE key) { VALUE val = rb_hash_aref( hsh, key ); if ( NIL_P( val ) ) @@ -208,9 +204,7 @@ syck_get_hash_aref(hsh, key) * creating timestamps */ SYMID -rb_syck_mktime(str, len) - char *str; - long len; +rb_syck_mktime(char *str, long len) { VALUE time; char *ptr = str; @@ -315,8 +309,7 @@ rb_syck_mktime(str, len) * (see http://www.yaml.org/type/merge/) */ VALUE -syck_merge_i( entry, hsh ) - VALUE entry, hsh; +syck_merge_i(VALUE entry, VALUE hsh ) { VALUE tmp; if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) ) @@ -331,9 +324,7 @@ syck_merge_i( entry, hsh ) * default handler for ruby.yaml.org types */ int -yaml_org_handler( n, ref ) - SyckNode *n; - VALUE *ref; +yaml_org_handler( SyckNode *n, VALUE *ref ) { char *type_id = n->type_id; int transferred = 0; @@ -602,9 +593,7 @@ static void syck_node_mark( SyckNode *n ); * - Converts data into native Ruby types */ SYMID -rb_syck_load_handler(p, n) - SyckParser *p; - SyckNode *n; +rb_syck_load_handler(SyckParser *p, SyckNode *n) { VALUE obj = Qnil; struct parser_xtra *bonus = (struct parser_xtra *)p->bonus; @@ -640,9 +629,7 @@ rb_syck_load_handler(p, n) * friendly errors. */ void -rb_syck_err_handler(p, msg) - SyckParser *p; - char *msg; +rb_syck_err_handler(SyckParser *p, char *msg) { char *endl = p->cursor; @@ -661,9 +648,7 @@ rb_syck_err_handler(p, msg) * provide bad anchor object to the parser. */ SyckNode * -rb_syck_bad_anchor_handler(p, a) - SyckParser *p; - char *a; +rb_syck_bad_anchor_handler(SyckParser *p, char *a) { VALUE anchor_name = rb_str_new2( a ); SyckNode *badanc = syck_new_map( rb_str_new2( "name" ), anchor_name ); @@ -675,8 +660,7 @@ rb_syck_bad_anchor_handler(p, a) * data loaded based on the model requested. */ void -syck_set_model( p, input, model ) - VALUE p, input, model; +syck_set_model(VALUE p, VALUE input, VALUE model) { SyckParser *parser; Data_Get_Struct(p, SyckParser, parser); @@ -716,8 +700,7 @@ syck_st_mark_nodes( char *key, SyckNode *n, char *arg ) * mark parser nodes */ static void -syck_mark_parser(parser) - SyckParser *parser; +syck_mark_parser(SyckParser *parser) { struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus; rb_gc_mark_maybe(parser->root); @@ -740,8 +723,7 @@ syck_mark_parser(parser) * Free the parser and any bonus attachment. */ void -rb_syck_free_parser(p) - SyckParser *p; +rb_syck_free_parser(SyckParser *p) { S_FREE( p->bonus ); syck_free_parser(p); @@ -752,8 +734,7 @@ rb_syck_free_parser(p) */ VALUE syck_parser_s_alloc _((VALUE)); VALUE -syck_parser_s_alloc(class) - VALUE class; +syck_parser_s_alloc(VALUE class) { VALUE pobj; SyckParser *parser = syck_new_parser(); @@ -772,10 +753,7 @@ syck_parser_s_alloc(class) * YAML::Syck::Parser.initialize( resolver, options ) */ static VALUE -syck_parser_initialize(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +syck_parser_initialize(int argc, VALUE *argv, VALUE self) { VALUE options; if (rb_scan_args(argc, argv, "01", &options) == 0) @@ -795,8 +773,7 @@ syck_parser_initialize(argc, argv, self) * YAML::Syck::Parser.bufsize = Integer */ static VALUE -syck_parser_bufsize_set( self, size ) - VALUE self, size; +syck_parser_bufsize_set(VALUE self, VALUE size) { SyckParser *parser; @@ -812,8 +789,7 @@ syck_parser_bufsize_set( self, size ) * YAML::Syck::Parser.bufsize => Integer */ static VALUE -syck_parser_bufsize_get( self ) - VALUE self; +syck_parser_bufsize_get(VALUE self) { SyckParser *parser; @@ -825,10 +801,7 @@ syck_parser_bufsize_get( self ) * YAML::Syck::Parser.load( IO or String ) */ VALUE -syck_parser_load(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +syck_parser_load(int argc, VALUE *argv, VALUE self) { VALUE port, proc, model, input; SyckParser *parser; @@ -855,10 +828,7 @@ syck_parser_load(argc, argv, self) * YAML::Syck::Parser.load_documents( IO or String ) { |doc| } */ VALUE -syck_parser_load_documents(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +syck_parser_load_documents(int argc, VALUE *argv, VALUE self) { VALUE port, proc, v, input, model; SyckParser *parser; @@ -899,8 +869,7 @@ syck_parser_load_documents(argc, argv, self) * YAML::Syck::Parser#set_resolver */ VALUE -syck_parser_set_resolver( self, resolver ) - VALUE self, resolver; +syck_parser_set_resolver(VALUE self, VALUE resolver) { rb_ivar_set( self, s_resolver, resolver ); return self; @@ -910,8 +879,7 @@ syck_parser_set_resolver( self, resolver ) * YAML::Syck::Resolver.initialize */ static VALUE -syck_resolver_initialize( self ) - VALUE self; +syck_resolver_initialize(VALUE self) { VALUE tags = rb_hash_new(); rb_ivar_set(self, s_tags, rb_hash_new()); @@ -922,8 +890,7 @@ syck_resolver_initialize( self ) * YAML::Syck::Resolver#add_type */ VALUE -syck_resolver_add_type( self, taguri, cls ) - VALUE self, taguri, cls; +syck_resolver_add_type(VALUE self, VALUE taguri, VALUE cls) { VALUE tags = rb_attr_get(self, s_tags); rb_hash_aset( tags, taguri, cls ); @@ -934,8 +901,7 @@ syck_resolver_add_type( self, taguri, cls ) * YAML::Syck::Resolver#use_types_at */ VALUE -syck_resolver_use_types_at( self, hsh ) - VALUE self, hsh; +syck_resolver_use_types_at(VALUE self, VALUE hsh) { rb_ivar_set( self, s_tags, hsh ); return Qnil; @@ -945,8 +911,7 @@ syck_resolver_use_types_at( self, hsh ) * YAML::Syck::Resolver#detect_implicit */ VALUE -syck_resolver_detect_implicit( self, val ) - VALUE self, val; +syck_resolver_detect_implicit(VALUE self, VALUE val) { char *type_id; return rb_str_new2( "" ); @@ -956,8 +921,7 @@ syck_resolver_detect_implicit( self, val ) * YAML::Syck::Resolver#node_import */ VALUE -syck_resolver_node_import( self, node ) - VALUE self, node; +syck_resolver_node_import(VALUE self, VALUE node) { SyckNode *n; VALUE obj; @@ -1037,8 +1001,7 @@ syck_resolver_node_import( self, node ) * Set instance variables */ VALUE -syck_set_ivars( vars, obj ) - VALUE vars, obj; +syck_set_ivars(VALUE vars, VALUE obj) { VALUE ivname = rb_ary_entry( vars, 0 ); char *ivn; @@ -1055,8 +1018,7 @@ syck_set_ivars( vars, obj ) * YAML::Syck::Resolver#const_find */ VALUE -syck_const_find( const_name ) - VALUE const_name; +syck_const_find(VALUE const_name) { VALUE tclass = rb_cObject; VALUE tparts = rb_str_split( const_name, "::" ); @@ -1073,8 +1035,7 @@ syck_const_find( const_name ) * YAML::Syck::Resolver#transfer */ VALUE -syck_resolver_transfer( self, type, val ) - VALUE self, type, val; +syck_resolver_transfer(VALUE self, VALUE type, VALUE val) { if (NIL_P(type) || RSTRING(StringValue(type))->len == 0) { @@ -1205,8 +1166,7 @@ syck_resolver_transfer( self, type, val ) * YAML::Syck::Resolver#tagurize */ VALUE -syck_resolver_tagurize( self, val ) - VALUE self, val; +syck_resolver_tagurize(VALUE self, VALUE val) { VALUE tmp = rb_check_string_type(val); @@ -1224,8 +1184,7 @@ syck_resolver_tagurize( self, val ) * YAML::Syck::DefaultResolver#detect_implicit */ VALUE -syck_defaultresolver_detect_implicit( self, val ) - VALUE self, val; +syck_defaultresolver_detect_implicit(VALUE self, VALUE val) { char *type_id; VALUE tmp = rb_check_string_type(val); @@ -1244,8 +1203,7 @@ syck_defaultresolver_detect_implicit( self, val ) * YAML::Syck::DefaultResolver#node_import */ VALUE -syck_defaultresolver_node_import( self, node ) - VALUE self, node; +syck_defaultresolver_node_import(VALUE self, VALUE node) { SyckNode *n; VALUE obj; @@ -1261,8 +1219,7 @@ syck_defaultresolver_node_import( self, node ) * YAML::Syck::GenericResolver#node_import */ VALUE -syck_genericresolver_node_import( self, node ) - VALUE self, node; +syck_genericresolver_node_import(VALUE self, VALUE node) { SyckNode *n; int i = 0; @@ -1339,8 +1296,7 @@ syck_genericresolver_node_import( self, node ) * YAML::Syck::BadAlias.initialize */ VALUE -syck_badalias_initialize( self, val ) - VALUE self, val; +syck_badalias_initialize(VALUE self, VALUE val) { rb_iv_set( self, "@name", val ); return self; @@ -1350,8 +1306,7 @@ syck_badalias_initialize( self, val ) * YAML::Syck::BadAlias.<=> */ VALUE -syck_badalias_cmp( alias1, alias2 ) - VALUE alias1, alias2; +syck_badalias_cmp(VALUE alias1, VALUE alias2) { VALUE str1 = rb_ivar_get( alias1, s_name ); VALUE str2 = rb_ivar_get( alias2, s_name ); @@ -1363,8 +1318,7 @@ syck_badalias_cmp( alias1, alias2 ) * YAML::DomainType.initialize */ VALUE -syck_domaintype_initialize( self, domain, type_id, val ) - VALUE self, domain, type_id, val; +syck_domaintype_initialize(VALUE self, VALUE domain, VALUE type_id, VALUE val) { rb_iv_set( self, "@domain", domain ); rb_iv_set( self, "@type_id", type_id ); @@ -1376,8 +1330,7 @@ syck_domaintype_initialize( self, domain, type_id, val ) * YAML::Object.initialize */ VALUE -syck_yobject_initialize( self, klass, ivars ) - VALUE self, klass, ivars; +syck_yobject_initialize(VALUE self, VALUE klass, VALUE ivars) { rb_iv_set( self, "@class", klass ); rb_iv_set( self, "@ivars", ivars ); @@ -1388,8 +1341,7 @@ syck_yobject_initialize( self, klass, ivars ) * YAML::PrivateType.initialize */ VALUE -syck_privatetype_initialize( self, type_id, val ) - VALUE self, type_id, val; +syck_privatetype_initialize(VALUE self, VALUE type_id, VALUE val) { rb_iv_set( self, "@type_id", type_id ); rb_iv_set( self, "@value", val ); @@ -1400,8 +1352,7 @@ syck_privatetype_initialize( self, type_id, val ) * Mark node contents. */ static void -syck_node_mark( n ) - SyckNode *n; +syck_node_mark(SyckNode *n) { int i; rb_gc_mark_maybe( n->id ); @@ -1431,8 +1382,7 @@ syck_node_mark( n ) * YAML::Syck::Scalar.allocate */ VALUE -syck_scalar_alloc( class ) - VALUE class; +syck_scalar_alloc(VALUE class) { SyckNode *node = syck_alloc_str(); VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node ); @@ -1444,8 +1394,7 @@ syck_scalar_alloc( class ) * YAML::Syck::Scalar.initialize */ VALUE -syck_scalar_initialize( self, type_id, val, style ) - VALUE self, type_id, val, style; +syck_scalar_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style) { rb_iv_set( self, "@kind", sym_scalar ); rb_funcall( self, s_type_id_set, 1, type_id ); @@ -1458,8 +1407,7 @@ syck_scalar_initialize( self, type_id, val, style ) * YAML::Syck::Scalar.style= */ VALUE -syck_scalar_style_set( self, style ) - VALUE self, style; +syck_scalar_style_set(VALUE self, VALUE style) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1497,8 +1445,7 @@ syck_scalar_style_set( self, style ) * YAML::Syck::Scalar.value= */ VALUE -syck_scalar_value_set( self, val ) - VALUE self, val; +syck_scalar_value_set(VALUE self, VALUE val) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1516,8 +1463,7 @@ syck_scalar_value_set( self, val ) * YAML::Syck::Seq.allocate */ VALUE -syck_seq_alloc( class ) - VALUE class; +syck_seq_alloc(VALUE class) { SyckNode *node; VALUE obj; @@ -1531,8 +1477,7 @@ syck_seq_alloc( class ) * YAML::Syck::Seq.initialize */ VALUE -syck_seq_initialize( self, type_id, val, style ) - VALUE self, type_id, val, style; +syck_seq_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1548,8 +1493,7 @@ syck_seq_initialize( self, type_id, val, style ) * YAML::Syck::Seq.value= */ VALUE -syck_seq_value_set( self, val ) - VALUE self, val; +syck_seq_value_set(VALUE self, VALUE val) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1572,8 +1516,7 @@ syck_seq_value_set( self, val ) * YAML::Syck::Seq.add */ VALUE -syck_seq_add_m( self, val ) - VALUE self, val; +syck_seq_add_m(VALUE self, VALUE val) { SyckNode *node; VALUE emitter = rb_ivar_get( self, s_emitter ); @@ -1592,8 +1535,7 @@ syck_seq_add_m( self, val ) * YAML::Syck::Seq.style= */ VALUE -syck_seq_style_set( self, style ) - VALUE self, style; +syck_seq_style_set(VALUE self, VALUE style) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1615,8 +1557,7 @@ syck_seq_style_set( self, style ) * YAML::Syck::Map.allocate */ VALUE -syck_map_alloc( class ) - VALUE class; +syck_map_alloc(VALUE class) { SyckNode *node; VALUE obj; @@ -1630,8 +1571,7 @@ syck_map_alloc( class ) * YAML::Syck::Map.initialize */ VALUE -syck_map_initialize( self, type_id, val, style ) - VALUE self, type_id, val, style; +syck_map_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1665,8 +1605,7 @@ syck_map_initialize( self, type_id, val, style ) * YAML::Syck::Map.value= */ VALUE -syck_map_value_set( self, val ) - VALUE self, val; +syck_map_value_set(VALUE self, VALUE val) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1698,8 +1637,7 @@ syck_map_value_set( self, val ) * YAML::Syck::Map.add */ VALUE -syck_map_add_m( self, key, val ) - VALUE self, key, val; +syck_map_add_m(VALUE self, VALUE key, VALUE val) { SyckNode *node; VALUE emitter = rb_ivar_get( self, s_emitter ); @@ -1719,8 +1657,7 @@ syck_map_add_m( self, key, val ) * YAML::Syck::Map.style= */ VALUE -syck_map_style_set( self, style ) - VALUE self, style; +syck_map_style_set(VALUE self, VALUE style) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1742,8 +1679,7 @@ syck_map_style_set( self, style ) * Cloning method for all node types */ VALUE -syck_node_init_copy( copy, orig ) - VALUE copy, orig; +syck_node_init_copy(VALUE copy, VALUE orig) { SyckNode *copy_n; SyckNode *orig_n; @@ -1766,8 +1702,7 @@ syck_node_init_copy( copy, orig ) * YAML::Syck::Node#type_id= */ VALUE -syck_node_type_id_set( self, type_id ) - VALUE self, type_id; +syck_node_type_id_set(VALUE self, VALUE type_id) { SyckNode *node; Data_Get_Struct( self, SyckNode, node ); @@ -1787,8 +1722,7 @@ syck_node_type_id_set( self, type_id ) * YAML::Syck::Node.transform */ VALUE -syck_node_transform( self ) - VALUE self; +syck_node_transform(VALUE self) { VALUE t; SyckNode *n; @@ -1844,9 +1778,7 @@ syck_node_transform( self ) * No one could possibly object. */ void -rb_syck_emitter_handler(e, data) - SyckEmitter *e; - st_data_t data; +rb_syck_emitter_handler(SyckEmitter *e, st_data_t data) { SyckNode *n; Data_Get_Struct((VALUE)data, SyckNode, n); @@ -1890,10 +1822,7 @@ rb_syck_emitter_handler(e, data) * Handle output from the emitter */ void -rb_syck_output_handler( emitter, str, len ) - SyckEmitter *emitter; - char *str; - long len; +rb_syck_output_handler(SyckEmitter * emitter, char *str, long len) { struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus; VALUE dest = bonus->port; @@ -1909,8 +1838,7 @@ rb_syck_output_handler( emitter, str, len ) * symbol table. */ void -syck_out_mark( emitter, node ) - VALUE emitter, node; +syck_out_mark(VALUE emitter, VALUE node) { SyckEmitter *emitterPtr; struct emitter_xtra *bonus; @@ -1927,8 +1855,7 @@ syck_out_mark( emitter, node ) * Mark emitter values. */ static void -syck_mark_emitter(emitter) - SyckEmitter *emitter; +syck_mark_emitter(SyckEmitter *emitter) { struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus; rb_gc_mark( bonus->oid ); @@ -1940,8 +1867,7 @@ syck_mark_emitter(emitter) * Free the emitter and any bonus attachment. */ void -rb_syck_free_emitter(e) - SyckEmitter *e; +rb_syck_free_emitter(SyckEmitter *e) { S_FREE( e->bonus ); syck_free_emitter(e); @@ -1952,8 +1878,7 @@ rb_syck_free_emitter(e) */ VALUE syck_emitter_s_alloc _((VALUE)); VALUE -syck_emitter_s_alloc(class) - VALUE class; +syck_emitter_s_alloc(VALUE class) { VALUE pobj; SyckEmitter *emitter = syck_new_emitter(); @@ -1973,10 +1898,7 @@ syck_emitter_s_alloc(class) * YAML::Syck::Emitter.reset( options ) */ VALUE -syck_emitter_reset( argc, argv, self ) - int argc; - VALUE *argv; - VALUE self; +syck_emitter_reset(int argc, VALUE *argv, VALUE self) { VALUE options, tmp; SyckEmitter *emitter; @@ -2018,10 +1940,7 @@ syck_emitter_reset( argc, argv, self ) * YAML::Syck::Emitter.emit( object_id ) { |out| ... } */ VALUE -syck_emitter_emit( argc, argv, self ) - int argc; - VALUE *argv; - VALUE self; +syck_emitter_emit(int argc, VALUE *argv, VALUE self) { VALUE oid, proc; char *anchor_name; @@ -2062,8 +1981,7 @@ syck_emitter_emit( argc, argv, self ) * YAML::Syck::Emitter#node_export */ VALUE -syck_emitter_node_export( self, node ) - VALUE self, node; +syck_emitter_node_export(VALUE self, VALUE node) { return rb_funcall( node, s_to_yaml, 1, self ); } @@ -2072,8 +1990,7 @@ syck_emitter_node_export( self, node ) * YAML::Syck::Emitter#set_resolver */ VALUE -syck_emitter_set_resolver( self, resolver ) - VALUE self, resolver; +syck_emitter_set_resolver(VALUE self, VALUE resolver) { rb_ivar_set( self, s_resolver, resolver ); return self; @@ -2083,8 +2000,7 @@ syck_emitter_set_resolver( self, resolver ) * YAML::Syck::Out::initialize */ VALUE -syck_out_initialize( self, emitter ) - VALUE self, emitter; +syck_out_initialize(VALUE self, VALUE emitter) { rb_ivar_set( self, s_emitter, emitter ); return self; @@ -2094,10 +2010,7 @@ syck_out_initialize( self, emitter ) * YAML::Syck::Out::map */ VALUE -syck_out_map( argc, argv, self ) - int argc; - VALUE *argv; - VALUE self; +syck_out_map(int argc, VALUE *argv, VALUE self) { VALUE type_id, style, map; if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) { @@ -2113,10 +2026,7 @@ syck_out_map( argc, argv, self ) * YAML::Syck::Out::seq */ VALUE -syck_out_seq( argc, argv, self ) - int argc; - VALUE *argv; - VALUE self; +syck_out_seq(int argc, VALUE *argv, VALUE self) { VALUE type_id, style, seq; if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) { @@ -2134,10 +2044,7 @@ syck_out_scalar( self, type_id, str, style ) VALUE self, type_id, str, style; */ VALUE -syck_out_scalar( argc, argv, self ) - int argc; - VALUE *argv; - VALUE self; +syck_out_scalar(int argc, VALUE *argv, VALUE self) { VALUE type_id, str, style, scalar; if (rb_scan_args(argc, argv, "21", &type_id, &str, &style) == 2) { diff --git a/ext/syck/syck.h b/ext/syck/syck.h index eb91b242c..083364452 100644 --- a/ext/syck/syck.h +++ b/ext/syck/syck.h @@ -363,7 +363,7 @@ long syck_io_file_read( char *, SyckIoFile *, long, long ); long syck_io_str_read( char *, SyckIoStr *, long, long ); char *syck_base64enc( char *, long ); char *syck_base64dec( char *, long ); -SyckEmitter *syck_new_emitter(); +SyckEmitter *syck_new_emitter(void); SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t ); void syck_emitter_ignore_id( SyckEmitter *, SYMID ); void syck_output_handler( SyckEmitter *, SyckOutputHandler ); diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c index 821a3cd5b..bcc428e1c 100644 --- a/ext/syck/yaml2byte.c +++ b/ext/syck/yaml2byte.c @@ -35,7 +35,7 @@ typedef struct { long remaining; int printed; } bytestring_t; -bytestring_t *bytestring_alloc() { +bytestring_t *bytestring_alloc(void) { bytestring_t *ret; /*TRACE0("bytestring_alloc()");*/ ret = S_ALLOC(bytestring_t); diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c index 23ff42a4f..654b926e6 100644 --- a/ext/tk/stubs.c +++ b/ext/tk/stubs.c @@ -86,8 +86,7 @@ static DL_HANDLE tcl_dll = (DL_HANDLE)0; static DL_HANDLE tk_dll = (DL_HANDLE)0; int -ruby_open_tcl_dll(appname) - char *appname; +ruby_open_tcl_dll(char *appname) { void (*p_Tcl_FindExecutable)(const char *); int n; @@ -169,8 +168,7 @@ ruby_open_tk_dll() } int -ruby_open_tcltk_dll(appname) - char *appname; +ruby_open_tcltk_dll(char *appname) { return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() ); } @@ -189,8 +187,7 @@ tk_stubs_init_p() Tcl_Interp * -ruby_tcl_create_ip_and_stubs_init(st) - int *st; +ruby_tcl_create_ip_and_stubs_init(int *st) { Tcl_Interp *tcl_ip; @@ -272,8 +269,7 @@ ruby_tcl_stubs_init() } int -ruby_tk_stubs_init(tcl_ip) - Tcl_Interp *tcl_ip; +ruby_tk_stubs_init(Tcl_Interp *tcl_ip) { Tcl_ResetResult(tcl_ip); @@ -308,8 +304,7 @@ ruby_tk_stubs_init(tcl_ip) } int -ruby_tk_stubs_safeinit(tcl_ip) - Tcl_Interp *tcl_ip; +ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip) { Tcl_ResetResult(tcl_ip); @@ -395,8 +390,7 @@ static int open_tcl_dll = 0; static int call_tk_stubs_init = 0; int -ruby_open_tcl_dll(appname) - char *appname; +ruby_open_tcl_dll(char *appname) { if (appname) { Tcl_FindExecutable(appname); @@ -418,8 +412,7 @@ int ruby_open_tk_dll() return TCLTK_STUBS_OK; } -int ruby_open_tcltk_dll(appname) - char *appname; +int ruby_open_tcltk_dll(char *appname) { return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() ); } @@ -437,8 +430,7 @@ tk_stubs_init_p() } Tcl_Interp * -ruby_tcl_create_ip_and_stubs_init(st) - int *st; +ruby_tcl_create_ip_and_stubs_init(int *st) { Tcl_Interp *tcl_ip; @@ -466,8 +458,7 @@ ruby_tcl_stubs_init() } int -ruby_tk_stubs_init(tcl_ip) - Tcl_Interp *tcl_ip; +ruby_tk_stubs_init(Tcl_Interp *tcl_ip) { if (Tk_Init(tcl_ip) == TCL_ERROR) return FAIL_Tk_Init; @@ -483,8 +474,7 @@ ruby_tk_stubs_init(tcl_ip) } int -ruby_tk_stubs_safeinit(tcl_ip) - Tcl_Interp *tcl_ip; +ruby_tk_stubs_safeinit(Tcl_Interp *tcl_ip) { #if TCL_MAJOR_VERSION >= 8 if (Tk_SafeInit(tcl_ip) == TCL_ERROR) diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index e43b98e2c..862e817a7 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -124,9 +124,7 @@ static VALUE tk_funcall _((VALUE(), int, VALUE*, VALUE)); /* safe Tcl_Eval and Tcl_GlobalEval */ static int -tcl_eval(interp, cmd) - Tcl_Interp *interp; - const char *cmd; /* don't have to be writable */ +tcl_eval(Tcp_Interp interp, const char *cmd) { char *buf = strdup(cmd); const int ret = Tcl_Eval(interp, buf); @@ -138,9 +136,7 @@ tcl_eval(interp, cmd) #define Tcl_Eval tcl_eval static int -tcl_global_eval(interp, cmd) - Tcl_Interp *interp; - const char *cmd; /* don't have to be writable */ +tcl_global_eval(Tcp_Interp *interp, const char *cmd) { char *buf = strdup(cmd); const int ret = Tcl_GlobalEval(interp, buf); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 0be5aa9ae..c54e83eac 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -478,7 +478,7 @@ zstream_append_buffer(struct zstream *z, const Bytef *src, int len) { if (NIL_P(z->buf)) { z->buf = rb_str_buf_new(len); - rb_str_buf_cat(z->buf, (char*)src, len); + rb_str_buf_cat(z->buf, (const char*)src, len); z->buf_filled = len; z->stream.next_out = (Bytef*)RSTRING(z->buf)->ptr; z->stream.avail_out = 0; @@ -573,11 +573,11 @@ zstream_append_input(struct zstream *z, const Bytef *src, unsigned int len) if (NIL_P(z->input)) { z->input = rb_str_buf_new(len); - rb_str_buf_cat(z->input, (char*)src, len); + rb_str_buf_cat(z->input, (const char*)src, len); RBASIC(z->input)->klass = 0; } else { - rb_str_buf_cat(z->input, (char*)src, len); + rb_str_buf_cat(z->input, (const char*)src, len); } } @@ -2995,7 +2995,8 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj) struct gzfile *gz = get_gzfile(obj); volatile VALUE rs; VALUE dst; - char *rsptr, *p, *res; + const char *rsptr; + char *p, *res; long rslen, n; int rspara; |