1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner

<stefan at huehner.org>.  [ruby-core:08029]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-06-20 18:02:17 +00:00
parent 866e083484
commit 1b7465e893
25 changed files with 254 additions and 567 deletions

View file

@ -1,3 +1,8 @@
Wed Jun 21 03:01:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner
<stefan at huehner.org>. [ruby-core:08029]
Wed Jun 21 01:40:25 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (reswords): modifier token is no longer returned in fname

48
eval.c
View file

@ -1207,7 +1207,7 @@ error_print(void)
{
VALUE errat = Qnil; /* OK */
volatile VALUE eclass, e;
char *einfo;
const char *einfo;
long elen;
if (NIL_P(ruby_errinfo)) return;
@ -2519,7 +2519,7 @@ set_trace_func(VALUE obj, VALUE trace)
return trace;
}
static char *
static const char *
get_event_name(rb_event_t event)
{
switch (event) {
@ -2551,7 +2551,7 @@ call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass /*
struct FRAME *prev;
NODE *node_save;
VALUE srcfile;
char *event_name;
const char *event_name;
if (!trace_func) return;
if (tracing) return;
@ -4575,7 +4575,7 @@ static void
proc_jump_error(int state, VALUE result)
{
char mesg[32];
char *statement;
const char *statement;
switch (state) {
case TAG_BREAK:
@ -5378,7 +5378,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
char *format = 0;
const char *format = 0;
NODE *cnode = ruby_current_node;
if (argc == 0 || !SYMBOL_P(argv[0])) {
@ -9752,8 +9752,7 @@ enum thread_status {
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
void
rb_fd_init(fds)
volatile rb_fdset_t *fds;
rb_fd_init(volatile rb_fdset_t *fds)
{
fds->maxfd = 0;
fds->fdset = ALLOC(fd_set);
@ -9761,8 +9760,7 @@ rb_fd_init(fds)
}
void
rb_fd_term(fds)
rb_fdset_t *fds;
rb_fd_term(rb_fdset_t *fds)
{
if (fds->fdset) free(fds->fdset);
fds->maxfd = 0;
@ -9770,8 +9768,7 @@ rb_fd_term(fds)
}
void
rb_fd_zero(fds)
rb_fdset_t *fds;
rb_fd_zero(rb_fdset_t *fds)
{
if (fds->fdset) {
MEMZERO(fds->fdset, fd_mask, howmany(fds->maxfd, NFDBITS));
@ -9780,9 +9777,7 @@ rb_fd_zero(fds)
}
static void
rb_fd_resize(n, fds)
int n;
rb_fdset_t *fds;
rb_fd_resize(int n, rb_fdset_t *fds)
{
int m = howmany(n + 1, NFDBITS) * sizeof(fd_mask);
int o = howmany(fds->maxfd, NFDBITS) * sizeof(fd_mask);
@ -9798,37 +9793,28 @@ rb_fd_resize(n, fds)
}
void
rb_fd_set(n, fds)
int n;
rb_fdset_t *fds;
rb_fd_set(int n, rb_fdset_t *fds)
{
rb_fd_resize(n, fds);
FD_SET(n, fds->fdset);
}
void
rb_fd_clr(n, fds)
int n;
rb_fdset_t *fds;
rb_fd_clr(int n, rb_fdset_t *fds)
{
if (n >= fds->maxfd) return;
FD_CLR(n, fds->fdset);
}
int
rb_fd_isset(n, fds)
int n;
const rb_fdset_t *fds;
rb_fd_isset(int n, const rb_fdset_t *fds)
{
if (n >= fds->maxfd) return 0;
return FD_ISSET(n, fds->fdset) != 0; /* "!= 0" avoids FreeBSD PR 91421 */
}
void
rb_fd_copy(dst, src, max)
rb_fdset_t *dst;
const fd_set *src;
int max;
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
{
int size = howmany(max, NFDBITS) * sizeof(fd_mask);
@ -9839,10 +9825,7 @@ rb_fd_copy(dst, src, max)
}
int
rb_fd_select(n, readfds, writefds, exceptfds, timeout)
int n;
rb_fdset_t *readfds, *writefds, *exceptfds;
struct timeval *timeout;
rb_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout)
{
rb_fd_resize(n - 1, readfds);
rb_fd_resize(n - 1, writefds);
@ -11788,8 +11771,7 @@ rb_thread_stop_timer()
}
#elif defined(HAVE_SETITIMER)
static void
catch_timer(sig)
int sig;
catch_timer(int sig)
{
#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
signal(sig, catch_timer);

View file

@ -1823,7 +1823,7 @@ VpInit(U_LONG BaseVal)
}
VP_EXPORT Real *
VpOne()
VpOne(void)
{
return VpConstOne;
}

View file

@ -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);
/*
* ------------------

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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 = &params;
@ -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 = &params;
@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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) {

View file

@ -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 );

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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;

2
file.c
View file

@ -1480,7 +1480,7 @@ rb_file_s_size(VALUE klass, VALUE fname)
static VALUE
rb_file_ftype(const struct stat *st)
{
char *t;
const char *t;
if (S_ISREG(st->st_mode)) {
t = "file";

14
io.c
View file

@ -1643,7 +1643,7 @@ rb_io_getline_fast(OpenFile *fptr, unsigned char delim)
}
static int
rscheck(char *rsptr, long rslen, VALUE rs)
rscheck(const char *rsptr, long rslen, VALUE rs)
{
if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen)
rb_raise(rb_eRuntimeError, "rs modified");
@ -1667,7 +1667,7 @@ rb_io_getline(VALUE rs, VALUE io)
}
else {
int c, newline;
char *rsptr;
const char *rsptr;
long rslen;
int rspara = 0;
@ -2527,7 +2527,7 @@ rb_io_binmode(VALUE io)
return io;
}
static char*
static const char*
rb_io_flags_mode(int flags)
{
#ifdef O_BINARY
@ -2666,7 +2666,7 @@ rb_io_mode_modenum(const char *mode)
#define MODENUM_MAX 4
static char*
static const char*
rb_io_modenum_mode(int flags)
{
#ifdef O_BINARY
@ -3154,7 +3154,7 @@ pipe_open(int argc, VALUE *argv, const char *mode)
static VALUE
rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
{
char *mode;
const char *mode;
VALUE pname, pmode, port, tmp;
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
@ -3199,7 +3199,7 @@ static VALUE
rb_open_file(int argc, VALUE *argv, VALUE io)
{
VALUE fname, vmode, perm;
char *mode;
const char *mode;
int flags, fmode;
rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
@ -3514,7 +3514,7 @@ static VALUE
rb_io_reopen(int argc, VALUE *argv, VALUE file)
{
VALUE fname, nmode;
char *mode;
const char *mode;
OpenFile *fptr;
rb_secure(4);

2
re.c
View file

@ -660,7 +660,7 @@ rb_reg_options_m(VALUE re)
static VALUE
rb_reg_kcode_m(VALUE re)
{
char *kcode;
const char *kcode;
if (FL_TEST(re, KCODE_FIXED)) {
switch (RBASIC(re)->flags & KCODE_MASK) {

2
ruby.c
View file

@ -62,7 +62,7 @@ static VALUE do_loop = Qfalse, do_print = Qfalse;
static VALUE do_check = Qfalse, do_line = Qfalse;
static VALUE do_split = Qfalse;
static char *script;
static const char *script;
static int origargc;
static char **origargv;

View file

@ -464,7 +464,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
{
volatile VALUE val = GETARG();
char fbuf[32], nbuf[64], *s, *t;
char *prefix = 0;
const char *prefix = 0;
int sign = 0;
char sc = 0;
long v = 0;
@ -716,7 +716,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
fval = RFLOAT(rb_Float(val))->value;
if (isnan(fval) || isinf(fval)) {
char *expr;
const char *expr;
if (isnan(fval)) {
expr = "NaN";

View file

@ -3988,7 +3988,7 @@ rb_str_crypt(VALUE str, VALUE salt)
{
extern char *crypt(const char *, const char *);
VALUE result;
char *s;
const char *s;
StringValue(salt);
if (RSTRING(salt)->len < 2)