From 9b383bd6cf96e1fe21c41528dec1f3ed508f335b Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 9 Jun 2006 21:20:17 +0000 Subject: * sprintf.c (rb_str_format): allow %c to print one character string (e.g. ?x). * lib/tempfile.rb (Tempfile::make_tmpname): put dot between basename and pid. [ruby-talk:196272] * parse.y (do_block): remove -> style block. * parse.y (parser_yylex): remove tLAMBDA_ARG. * eval.c (rb_call0): binding for the return event hook should have consistent scope. [ruby-core:07928] * eval.c (proc_invoke): return behavior should depend whether it is surrounded by a lambda or a mere block. * eval.c (formal_assign): handles post splat arguments. * eval.c (rb_call0): ditto. * st.c (strhash): use FNV-1a hash. * parse.y (parser_yylex): removed experimental ';;' terminator. * eval.c (rb_node_arity): should be aware of post splat arguments. * eval.c (rb_proc_arity): ditto. * parse.y (f_args): syntax rule enhanced to support arguments after the splat. * parse.y (block_param): ditto for block parameters. * parse.y (f_post_arg): mandatory formal arguments after the splat argument. * parse.y (new_args_gen): generate nodes for mandatory formal arguments after the splat argument. * eval.c (rb_eval): dispatch mandatory formal arguments after the splat argument. * parse.y (args): allow more than one splat in the argument list. * parse.y (method_call): allow aref [] to accept all kind of method argument, including assocs, splat, and block argument. * eval.c (SETUP_ARGS0): prepare block argument as well. * lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931] * eval.c (error_line): print receivers true/false/nil specially. * eval.c (rb_proc_yield): handles parameters in yield semantics. * eval.c (nil_yield): gives LocalJumpError to denote no block error. * io.c (rb_io_getc): now takes one-character string. * string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo hashing algorithm. * string.c (rb_str_aref): str[0] now returns 1 character string, instead of a fixnum. [Ruby2] * parse.y (parser_yylex): ?c now returns 1 character string, instead of a fixnum. [Ruby2] * string.c (rb_str_aset): no longer support fixnum insertion. * eval.c (umethod_bind): should not update original class. [ruby-dev:28636] * eval.c (ev_const_get): should support constant access from within instance_eval(). [ruby-dev:28327] * time.c (time_timeval): should round for usec floating number. [ruby-core:07896] * time.c (time_add): ditto. * dir.c (sys_warning): should not call a vararg function rb_sys_warning() indirectly. [ruby-core:07886] * numeric.c (flo_divmod): the first element of Float#divmod should be an integer. [ruby-dev:28589] * test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder. * re.c (rb_reg_initialize): should not allow modifying literal regexps. frozen check moved from rb_reg_initialize_m as well. * re.c (rb_reg_initialize): should not modify untainted objects in safe levels higher than 3. * re.c (rb_memcmp): type change from char* to const void*. * dir.c (dir_close): should not close untainted dir stream. * dir.c (GetDIR): add tainted/frozen check for each dir operation. * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg): typo fixed. a patch from Florian Gross . * eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from event_hooks. no guarantee for arbitrary hook deletion. [ruby-dev:28632] * util.c (ruby_strtod): differ addition to minimize error. [ruby-dev:28619] * util.c (ruby_strtod): should not raise ERANGE when the input string does not have any digits. [ruby-dev:28629] * eval.c (proc_invoke): should restore old ruby_frame->block. thanks to ts . [ruby-core:07833] also fix [ruby-dev:28614] as well. * signal.c (trap): sig should be less then NSIG. Coverity found this bug. a patch from Kevin Tew . [ruby-core:07823] * math.c (math_log2): add new method inspired by [ruby-talk:191237]. * math.c (math_log): add optional base argument to Math::log(). [ruby-talk:191308] * ext/syck/emitter.c (syck_scan_scalar): avoid accessing uninitialized array element. a patch from Pat Eyler . [ruby-core:07809] * array.c (rb_ary_fill): initialize local variables first. a patch from Pat Eyler . [ruby-core:07810] * ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free type_tag. a patch from Pat Eyler . [ruby-core:07808] * ext/socket/socket.c (make_hostent_internal): accept ai_family check from Sam Roberts . [ruby-core:07691] * util.c (ruby_strtod): should not cut off 18 digits for no reason. [ruby-core:07796] * array.c (rb_ary_fill): internalize local variable "beg" to pacify Coverity. [ruby-core:07770] * pack.c (pack_unpack): now supports CRLF newlines. a patch from . [ruby-dev:28601] * applied code clean-up patch from Stefan Huehner . [ruby-core:07764] * lib/jcode.rb (String::tr_s): should have translated non squeezing character sequence (i.e. a character) as well. thanks to Hiroshi Ichikawa [ruby-list:42090] * ext/socket/socket.c: document update patch from Sam Roberts . [ruby-core:07701] * lib/mathn.rb (Integer): need not to remove gcd2. a patch from NARUSE, Yui . [ruby-dev:28570] * parse.y (arg): too much NEW_LIST() * eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen. * eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1. [ruby-dev:28585] * parse.y (arg): use NODE_ARGSCAT for placeholder. * lib/getoptlong.rb (GetoptLong::get): RDoc update patch from mathew . [ruby-core:07738] * variable.c (rb_const_set): raise error when no target klass is supplied. [ruby-dev:28582] * prec.c (prec_prec_f): documentation patch from . [ruby-core:07689] * bignum.c (rb_big_pow): second operand may be too big even if it's a Fixnum. [ruby-talk:187984] * README.EXT: update symbol description. [ruby-talk:188104] * COPYING: explicitly note GPLv2. [ruby-talk:187922] * parse.y: remove some obsolete syntax rules (unparenthesized method calls in argument list). * eval.c (rb_call0): insecure calling should be checked for non NODE_SCOPE method invocations too. * eval.c (rb_alias): should preserve the current safe level as well as method definition. * process.c (rb_f_sleep): remove RDoc description about SIGALRM which is not valid on the current implementation. [ruby-dev:28464] Thu Mar 23 21:40:47 2006 K.Kosako * eval.c (method_missing): should support argument splat in super. a bug in combination of super, splat and method_missing. [ruby-talk:185438] * configure.in: Solaris SunPro compiler -rapth patch from . [ruby-dev:28443] * configure.in: remove enable_rpath=no for Solaris. [ruby-dev:28440] * ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior of converting OLE Variant object with VT_ARRAY|VT_UI1 and Ruby String object. * ruby.1: a clarification patch from David Lutterkort . [ruby-core:7508] * lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems directories. a patch from Eric Hodel . [ruby-core:07423] * eval.c (rb_clear_cache_by_class): clearing wrong cache. * ext/extmk.rb: use :remove_destination to install extension libraries to avoid SEGV. [ruby-dev:28417] * eval.c (rb_thread_fd_writable): should not re-schedule output from KILLED thread (must be error printing). * array.c (rb_ary_flatten_bang): allow specifying recursion level. [ruby-talk:182170] * array.c (rb_ary_flatten): ditto. * gc.c (add_heap): a heap_slots may overflow. a patch from Stefan Weil . * eval.c (rb_call): use separate cache for fcall/vcall invocation. * eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local functions. * eval.c (rb_mod_local): a new method to specify newly added visibility "local". * eval.c (search_method): search for local methods which are visible only from the current class. * class.c (rb_class_local_methods): a method to list local methods. * object.c (Init_Object): add BasicObject class as a top level BlankSlate class. * ruby.h (SYM2ID): should not cast to signed long. [ruby-core:07414] * class.c (rb_include_module): allow module duplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/.document | 3 +- ext/Setup | 1 - ext/bigdecimal/bigdecimal.c | 12 +- ext/bigdecimal/bigdecimal.h | 10 +- ext/curses/curses.c | 192 +++++------------ ext/etc/etc.c | 44 ++-- ext/extmk.rb | 4 +- ext/iconv/iconv.c | 2 +- ext/io/wait/wait.c | 3 +- ext/nkf/nkf-utf8/nkf.c | 114 +++------- ext/nkf/nkf.c | 15 +- ext/openssl/ossl_asn1.c | 2 +- ext/openssl/ossl_pkcs7.c | 2 +- ext/openssl/ossl_ssl.c | 8 +- ext/pty/pty.c | 41 ++-- ext/readline/readline.c | 123 ++++------- ext/ripper/eventids2.c | 3 +- ext/stringio/stringio.c | 17 +- ext/strscan/strscan.c | 12 +- ext/syck/emitter.c | 10 +- ext/syck/handler.c | 2 +- ext/syck/implicit.c | 2 +- ext/syck/node.c | 4 +- ext/syck/syck.c | 2 +- ext/syck/syck.h | 14 +- ext/syck/yaml2byte.c | 1 + ext/tk/tcltklib.c | 4 + ext/zlib/zlib.c | 500 +++++++++++++------------------------------- 28 files changed, 353 insertions(+), 794 deletions(-) (limited to 'ext') diff --git a/ext/.document b/ext/.document index 92370174fa..0985f45328 100644 --- a/ext/.document +++ b/ext/.document @@ -3,7 +3,8 @@ iconv/iconv.c nkf/lib/kconv.rb nkf/nkf.c +socket/socket.c stringio/stringio.c strscan/strscan.c -zlib/zlib.c win32ole +zlib/zlib.c diff --git a/ext/Setup b/ext/Setup index 41817c0f79..b0f29b9f7b 100644 --- a/ext/Setup +++ b/ext/Setup @@ -10,7 +10,6 @@ #digest/sha1 #digest/sha2 #dl -#enumerator #etc #fcntl #gdbm diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 7f3f1520ee..46ed596b7e 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -302,7 +302,7 @@ VpNewRbClass(U_LONG mx, char *str, VALUE klass) } VP_EXPORT Real * -VpCreateRbObject(U_LONG mx, char *str) +VpCreateRbObject(U_LONG mx, const char *str) { Real *pv = VpAlloc(mx,str); pv->obj = (VALUE)Data_Wrap_Struct(rb_cBigDecimal, 0, BigDecimal_delete, pv); @@ -917,7 +917,7 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self) { ENTER(5); Real *c, *a; - int iLoc; + int iLoc = 0; U_LONG mx; VALUE vLoc; VALUE vRound; @@ -1578,7 +1578,7 @@ VpIsNegDoubleZero(double v) } VP_EXPORT int -VpException(unsigned short f,char *str,int always) +VpException(unsigned short f, const char *str,int always) { VALUE exc; int fatal=0; @@ -1720,7 +1720,7 @@ NaN: * returns number of chars needed to represent vp in specified format. */ VP_EXPORT U_LONG -VpNumOfChars(Real *vp,char *pszFmt) +VpNumOfChars(Real *vp,const char *pszFmt) { S_INT ex; U_LONG nc; @@ -1873,7 +1873,7 @@ overflow: * NULL be returned if memory allocation is failed,or any error. */ VP_EXPORT Real * -VpAlloc(U_LONG mx, char *szVal) +VpAlloc(U_LONG mx, const char *szVal) { U_LONG i, ni, ipn, ipf, nf, ipe, ne, nalloc; char v,*psz; @@ -3277,7 +3277,7 @@ VpToFString(Real *a,char *psz,int fFmt,int fPlus) * ne ... number of characters in exp_chr[],not including '+/-'. */ VP_EXPORT int -VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr, U_LONG ne) +VpCtoV(Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, const char *exp_chr, U_LONG ne) { U_LONG i, j, ind_a, ma, mi, me; U_LONG loc; diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h index aabc551a76..80a1ba816c 100644 --- a/ext/bigdecimal/bigdecimal.h +++ b/ext/bigdecimal/bigdecimal.h @@ -105,7 +105,7 @@ typedef struct { VP_EXPORT Real * VpNewRbClass(U_LONG mx,char *str,VALUE klass); -VP_EXPORT Real *VpCreateRbObject(U_LONG mx,char *str); +VP_EXPORT Real *VpCreateRbObject(U_LONG mx,const char *str); VP_EXPORT U_LONG VpBaseFig(void); VP_EXPORT U_LONG VpDblFig(void); @@ -126,13 +126,13 @@ VP_EXPORT int VpIsRoundMode(unsigned long n); VP_EXPORT unsigned long VpGetRoundMode(void); VP_EXPORT unsigned long VpSetRoundMode(unsigned long n); -VP_EXPORT int VpException(unsigned short f,char *str,int always); +VP_EXPORT int VpException(unsigned short f,const char *str,int always); VP_EXPORT int VpIsNegDoubleZero(double v); -VP_EXPORT U_LONG VpNumOfChars(Real *vp,char *pszFmt); +VP_EXPORT U_LONG VpNumOfChars(Real *vp,const char *pszFmt); VP_EXPORT U_LONG VpInit(U_LONG BaseVal); VP_EXPORT void *VpMemAlloc(U_LONG mb); VP_EXPORT void VpFree(Real *pv); -VP_EXPORT Real *VpAlloc(U_LONG mx, char *szVal); +VP_EXPORT Real *VpAlloc(U_LONG mx, const char *szVal); VP_EXPORT int VpAsgn(Real *c,Real *a,int isw); VP_EXPORT int VpAddSub(Real *c,Real *a,Real *b,int operation); VP_EXPORT int VpMult(Real *c,Real *a,Real *b); @@ -143,7 +143,7 @@ VP_EXPORT void VpSzMantissa(Real *a,char *psz); VP_EXPORT int VpToSpecialString(Real *a,char *psz,int fPlus); VP_EXPORT void VpToString(Real *a,char *psz,int fFmt,int fPlus); VP_EXPORT void VpToFString(Real *a,char *psz,int fFmt,int fPlus); -VP_EXPORT int VpCtoV(Real *a,char *int_chr,U_LONG ni,char *frac,U_LONG nf,char *exp_chr,U_LONG ne); +VP_EXPORT int VpCtoV(Real *a,const char *int_chr,U_LONG ni,const char *frac,U_LONG nf,const char *exp_chr,U_LONG ne); VP_EXPORT int VpVtoD(double *d,S_LONG *e,Real *m); VP_EXPORT void VpDtoV(Real *m,double d); VP_EXPORT void VpItoV(Real *m,S_INT ival); diff --git a/ext/curses/curses.c b/ext/curses/curses.c index bdfae8360a..f1d037b19d 100644 --- a/ext/curses/curses.c +++ b/ext/curses/curses.c @@ -90,8 +90,7 @@ no_window() } while (0) static void -free_window(winp) - struct windata *winp; +free_window(struct windata *winp) { if (winp->window && winp->window != stdscr) delwin(winp->window); winp->window = 0; @@ -99,9 +98,7 @@ free_window(winp) } static VALUE -prep_window(class, window) - VALUE class; - WINDOW *window; +prep_window(VALUE class, WINDOW *window) { VALUE obj; struct windata *winp; @@ -178,8 +175,7 @@ curses_closed() /* def clear */ static VALUE -curses_clear(obj) - VALUE obj; +curses_clear(VALUE obj) { curses_stdscr(); wclear(stdscr); @@ -197,8 +193,7 @@ curses_clrtoeol() /* def refresh */ static VALUE -curses_refresh(obj) - VALUE obj; +curses_refresh(VALUE obj) { curses_stdscr(); refresh(); @@ -207,8 +202,7 @@ curses_refresh(obj) /* def doupdate */ static VALUE -curses_doupdate(obj) - VALUE obj; +curses_doupdate(VALUE obj) { curses_stdscr(); #ifdef HAVE_DOUPDATE @@ -221,8 +215,7 @@ curses_doupdate(obj) /* def echo */ static VALUE -curses_echo(obj) - VALUE obj; +curses_echo(VALUE obj) { curses_stdscr(); echo(); @@ -231,8 +224,7 @@ curses_echo(obj) /* def noecho */ static VALUE -curses_noecho(obj) - VALUE obj; +curses_noecho(VALUE obj) { curses_stdscr(); noecho(); @@ -241,8 +233,7 @@ curses_noecho(obj) /* def raw */ static VALUE -curses_raw(obj) - VALUE obj; +curses_raw(VALUE obj) { curses_stdscr(); raw(); @@ -251,8 +242,7 @@ curses_raw(obj) /* def noraw */ static VALUE -curses_noraw(obj) - VALUE obj; +curses_noraw(VALUE obj) { curses_stdscr(); noraw(); @@ -261,8 +251,7 @@ curses_noraw(obj) /* def cbreak */ static VALUE -curses_cbreak(obj) - VALUE obj; +curses_cbreak(VALUE obj) { curses_stdscr(); cbreak(); @@ -271,8 +260,7 @@ curses_cbreak(obj) /* def nocbreak */ static VALUE -curses_nocbreak(obj) - VALUE obj; +curses_nocbreak(VALUE obj) { curses_stdscr(); nocbreak(); @@ -281,8 +269,7 @@ curses_nocbreak(obj) /* def nl */ static VALUE -curses_nl(obj) - VALUE obj; +curses_nl(VALUE obj) { curses_stdscr(); nl(); @@ -291,8 +278,7 @@ curses_nl(obj) /* def nonl */ static VALUE -curses_nonl(obj) - VALUE obj; +curses_nonl(VALUE obj) { curses_stdscr(); nonl(); @@ -301,8 +287,7 @@ curses_nonl(obj) /* def beep */ static VALUE -curses_beep(obj) - VALUE obj; +curses_beep(VALUE obj) { #ifdef HAVE_BEEP curses_stdscr(); @@ -313,8 +298,7 @@ curses_beep(obj) /* def flash */ static VALUE -curses_flash(obj) - VALUE obj; +curses_flash(VALUE obj) { #ifdef HAVE_FLASH curses_stdscr(); @@ -325,9 +309,7 @@ curses_flash(obj) /* def ungetch */ static VALUE -curses_ungetch(obj, ch) - VALUE obj; - VALUE ch; +curses_ungetch(VALUE obj, VALUE ch) { #ifdef HAVE_UNGETCH curses_stdscr(); @@ -340,10 +322,7 @@ curses_ungetch(obj, ch) /* def setpos(y, x) */ static VALUE -curses_setpos(obj, y, x) - VALUE obj; - VALUE y; - VALUE x; +curses_setpos(VALUE obj, VALUE y, VALUE x) { curses_stdscr(); move(NUM2INT(y), NUM2INT(x)); @@ -352,8 +331,7 @@ curses_setpos(obj, y, x) /* def standout */ static VALUE -curses_standout(obj) - VALUE obj; +curses_standout(VALUE obj) { standout(); return Qnil; @@ -361,8 +339,7 @@ curses_standout(obj) /* def standend */ static VALUE -curses_standend(obj) - VALUE obj; +curses_standend(VALUE obj) { standend(); return Qnil; @@ -370,8 +347,7 @@ curses_standend(obj) /* def inch */ static VALUE -curses_inch(obj) - VALUE obj; +curses_inch(VALUE obj) { curses_stdscr(); return CH2FIX(inch()); @@ -379,9 +355,7 @@ curses_inch(obj) /* def addch(ch) */ static VALUE -curses_addch(obj, ch) - VALUE obj; - VALUE ch; +curses_addch(VALUE obj, VALUE ch) { curses_stdscr(); addch(NUM2CH(ch)); @@ -390,9 +364,7 @@ curses_addch(obj, ch) /* def insch(ch) */ static VALUE -curses_insch(obj, ch) - VALUE obj; - VALUE ch; +curses_insch(VALUE obj, VALUE ch) { curses_stdscr(); insch(NUM2CH(ch)); @@ -401,9 +373,7 @@ curses_insch(obj, ch) /* def addstr(str) */ static VALUE -curses_addstr(obj, str) - VALUE obj; - VALUE str; +curses_addstr(VALUE obj, VALUE str) { curses_stdscr(); if (!NIL_P(str)) { @@ -414,8 +384,7 @@ curses_addstr(obj, str) /* def getch */ static VALUE -curses_getch(obj) - VALUE obj; +curses_getch(VALUE obj) { rb_read_check(stdin); curses_stdscr(); @@ -424,8 +393,7 @@ curses_getch(obj) /* def getstr */ static VALUE -curses_getstr(obj) - VALUE obj; +curses_getstr(VALUE obj) { char rtn[1024]; /* This should be big enough.. I hope */ @@ -440,8 +408,7 @@ curses_getstr(obj) /* def delch */ static VALUE -curses_delch(obj) - VALUE obj; +curses_delch(VALUE obj) { delch(); return Qnil; @@ -449,8 +416,7 @@ curses_delch(obj) /* def delelteln */ static VALUE -curses_deleteln(obj) - VALUE obj; +curses_deleteln(VALUE obj) { #if defined(HAVE_DELETELN) || defined(deleteln) deleteln(); @@ -460,8 +426,7 @@ curses_deleteln(obj) /* def insertln */ static VALUE -curses_insertln(obj) - VALUE obj; +curses_insertln(VALUE obj) { #if defined(HAVE_INSERTLN) || defined(insertln) insertln(); @@ -471,9 +436,7 @@ curses_insertln(obj) /* def keyname */ static VALUE -curses_keyname(obj, c) - VALUE obj; - VALUE c; +curses_keyname(VALUE obj, VALUE c) { #ifdef HAVE_KEYNAME const char *name; @@ -768,12 +731,7 @@ window_s_allocate(VALUE class) /* def initialize(h, w, top, left) */ static VALUE -window_initialize(obj, h, w, top, left) - VALUE obj; - VALUE h; - VALUE w; - VALUE top; - VALUE left; +window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left) { struct windata *winp; WINDOW *window; @@ -791,12 +749,7 @@ window_initialize(obj, h, w, top, left) /* def subwin(height, width, top, left) */ static VALUE -window_subwin(obj, height, width, top, left) - VALUE obj; - VALUE height; - VALUE width; - VALUE top; - VALUE left; +window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left) { struct windata *winp; WINDOW *window; @@ -816,8 +769,7 @@ window_subwin(obj, height, width, top, left) /* def close */ static VALUE -window_close(obj) - VALUE obj; +window_close(VALUE obj) { struct windata *winp; @@ -830,8 +782,7 @@ window_close(obj) /* def clear */ static VALUE -window_clear(obj) - VALUE obj; +window_clear(VALUE obj) { struct windata *winp; @@ -843,8 +794,7 @@ window_clear(obj) /* def clrtoeol */ static VALUE -window_clrtoeol(obj) - VALUE obj; +window_clrtoeol(VALUE obj) { struct windata *winp; @@ -856,8 +806,7 @@ window_clrtoeol(obj) /* def refresh */ static VALUE -window_refresh(obj) - VALUE obj; +window_refresh(VALUE obj) { struct windata *winp; @@ -869,8 +818,7 @@ window_refresh(obj) /* def noutrefresh */ static VALUE -window_noutrefresh(obj) - VALUE obj; +window_noutrefresh(VALUE obj) { struct windata *winp; @@ -886,10 +834,7 @@ window_noutrefresh(obj) /* def move(y, x) */ static VALUE -window_move(obj, y, x) - VALUE obj; - VALUE y; - VALUE x; +window_move(VALUE obj, VALUE y, VALUE x) { struct windata *winp; @@ -901,10 +846,7 @@ window_move(obj, y, x) /* def setpos(y, x) */ static VALUE -window_setpos(obj, y, x) - VALUE obj; - VALUE y; - VALUE x; +window_setpos(VALUE obj, VALUE y, VALUE x) { struct windata *winp; @@ -915,8 +857,7 @@ window_setpos(obj, y, x) /* def cury */ static VALUE -window_cury(obj) - VALUE obj; +window_cury(VALUE obj) { struct windata *winp; int x, y; @@ -928,8 +869,7 @@ window_cury(obj) /* def curx */ static VALUE -window_curx(obj) - VALUE obj; +window_curx(VALUE obj) { struct windata *winp; int x, y; @@ -941,8 +881,7 @@ window_curx(obj) /* def maxy */ static VALUE -window_maxy(obj) - VALUE obj; +window_maxy(VALUE obj) { struct windata *winp; @@ -962,8 +901,7 @@ window_maxy(obj) /* def maxx */ static VALUE -window_maxx(obj) - VALUE obj; +window_maxx(VALUE obj) { struct windata *winp; @@ -983,8 +921,7 @@ window_maxx(obj) /* def begy */ static VALUE -window_begy(obj) - VALUE obj; +window_begy(VALUE obj) { struct windata *winp; int x, y; @@ -1000,8 +937,7 @@ window_begy(obj) /* def begx */ static VALUE -window_begx(obj) - VALUE obj; +window_begx(VALUE obj) { struct windata *winp; int x, y; @@ -1053,8 +989,7 @@ window_box(argc, argv, self) /* def standout */ static VALUE -window_standout(obj) - VALUE obj; +window_standout(VALUE obj) { struct windata *winp; @@ -1065,8 +1000,7 @@ window_standout(obj) /* def standend */ static VALUE -window_standend(obj) - VALUE obj; +window_standend(VALUE obj) { struct windata *winp; @@ -1077,8 +1011,7 @@ window_standend(obj) /* def inch */ static VALUE -window_inch(obj) - VALUE obj; +window_inch(VALUE obj) { struct windata *winp; @@ -1088,9 +1021,7 @@ window_inch(obj) /* def addch(ch) */ static VALUE -window_addch(obj, ch) - VALUE obj; - VALUE ch; +window_addch(VALUE obj, VALUE ch) { struct windata *winp; @@ -1102,9 +1033,7 @@ window_addch(obj, ch) /* def insch(ch) */ static VALUE -window_insch(obj, ch) - VALUE obj; - VALUE ch; +window_insch(VALUE obj, VALUE ch) { struct windata *winp; @@ -1116,9 +1045,7 @@ window_insch(obj, ch) /* def addstr(str) */ static VALUE -window_addstr(obj, str) - VALUE obj; - VALUE str; +window_addstr(VALUE obj, VALUE str) { if (!NIL_P(str)) { struct windata *winp; @@ -1131,9 +1058,7 @@ window_addstr(obj, str) /* def <<(str) */ static VALUE -window_addstr2(obj, str) - VALUE obj; - VALUE str; +window_addstr2(VALUE obj, VALUE str) { window_addstr(obj, str); return obj; @@ -1141,8 +1066,7 @@ window_addstr2(obj, str) /* def getch */ static VALUE -window_getch(obj) - VALUE obj; +window_getch(VALUE obj) { struct windata *winp; @@ -1153,8 +1077,7 @@ window_getch(obj) /* def getstr */ static VALUE -window_getstr(obj) - VALUE obj; +window_getstr(VALUE obj) { struct windata *winp; char rtn[1024]; /* This should be big enough.. I hope */ @@ -1171,8 +1094,7 @@ window_getstr(obj) /* def delch */ static VALUE -window_delch(obj) - VALUE obj; +window_delch(VALUE obj) { struct windata *winp; @@ -1183,8 +1105,7 @@ window_delch(obj) /* def delelteln */ static VALUE -window_deleteln(obj) - VALUE obj; +window_deleteln(VALUE obj) { #if defined(HAVE_WDELETELN) || defined(wdeleteln) struct windata *winp; @@ -1197,8 +1118,7 @@ window_deleteln(obj) /* def insertln */ static VALUE -window_insertln(obj) - VALUE obj; +window_insertln(VALUE obj) { #if defined(HAVE_WINSERTLN) || defined(winsertln) struct windata *winp; diff --git a/ext/etc/etc.c b/ext/etc/etc.c index ac95735549..6235d76a73 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -70,8 +70,7 @@ safe_setup_str(str) #ifdef HAVE_GETPWENT static VALUE -setup_passwd(pwd) - struct passwd *pwd; +setup_passwd(struct passwd *pwd) { if (pwd == 0) rb_sys_fail("/etc/passwd"); return rb_struct_new(sPasswd, @@ -119,10 +118,7 @@ setup_passwd(pwd) * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> */ static VALUE -etc_getpwuid(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +etc_getpwuid(int argc, VALUE *argv, VALUE obj) { #if defined(HAVE_GETPWENT) VALUE id; @@ -153,8 +149,7 @@ etc_getpwuid(argc, argv, obj) * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> */ static VALUE -etc_getpwnam(obj, nam) - VALUE obj, nam; +etc_getpwnam(VALUE obj, VALUE nam) { #ifdef HAVE_GETPWENT struct passwd *pwd; @@ -207,8 +202,7 @@ passwd_iterate() * */ static VALUE -etc_passwd(obj) - VALUE obj; +etc_passwd(VALUE obj) { #ifdef HAVE_GETPWENT struct passwd *pw; @@ -232,8 +226,7 @@ etc_passwd(obj) * to getpwent will return the first entry again. */ static VALUE -etc_setpwent(obj) - VALUE obj; +etc_setpwent(VALUE obj) { #ifdef HAVE_GETPWENT setpwent(); @@ -245,8 +238,7 @@ etc_setpwent(obj) * getpwent, and closes the file. */ static VALUE -etc_endpwent(obj) - VALUE obj; +etc_endpwent(VALUE obj) { #ifdef HAVE_GETPWENT endpwent(); @@ -281,8 +273,7 @@ etc_endpwent(obj) * - Passwd#shell contains the path to the login shell of the user as a String. */ static VALUE -etc_getpwent(obj) - VALUE obj; +etc_getpwent(VALUE obj) { #ifdef HAVE_GETPWENT struct passwd *pw; @@ -296,8 +287,7 @@ etc_getpwent(obj) #ifdef HAVE_GETGRENT static VALUE -setup_group(grp) - struct group *grp; +setup_group(struct group *grp) { VALUE mem; char **tbl; @@ -329,8 +319,7 @@ setup_group(grp) * */ static VALUE -etc_getgrgid(obj, id) - VALUE obj, id; +etc_getgrgid(VALUE obj, VALUE id) { #ifdef HAVE_GETGRENT int gid; @@ -357,8 +346,7 @@ etc_getgrgid(obj, id) * */ static VALUE -etc_getgrnam(obj, nam) - VALUE obj, nam; +etc_getgrnam(VALUE obj, VALUE nam) { #ifdef HAVE_GETGRENT struct group *grp; @@ -412,8 +400,7 @@ group_iterate() * */ static VALUE -etc_group(obj) - VALUE obj; +etc_group(VALUE obj) { #ifdef HAVE_GETGRENT struct group *grp; @@ -437,8 +424,7 @@ etc_group(obj) * to getgrent will return the first entry again. */ static VALUE -etc_setgrent(obj) - VALUE obj; +etc_setgrent(VALUE obj) { #ifdef HAVE_GETGRENT setgrent(); @@ -450,8 +436,7 @@ etc_setgrent(obj) * getgrent, and closes the file. */ static VALUE -etc_endgrent(obj) - VALUE obj; +etc_endgrent(VALUE obj) { #ifdef HAVE_GETGRENT endgrent(); @@ -480,8 +465,7 @@ etc_endgrent(obj) * members of the group. */ static VALUE -etc_getgrent(obj) - VALUE obj; +etc_getgrent(VALUE obj) { #ifdef HAVE_GETGRENT struct group *gr; diff --git a/ext/extmk.rb b/ext/extmk.rb index ade62c31d2..1a8f6cf3c3 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -233,7 +233,7 @@ def parse_args() opts.on('--make=MAKE') do |v| $make = v || 'make' end - opts.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v| + opts.on('--make-flags=FLAGS', '--mflags', Shellwords) do |*v| v.grep(/\A([-\w]+)=(.*)/) {$configure_args["--#{$1}"] = $2} if arg = v.first arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg @@ -258,7 +258,7 @@ def parse_args() $mflags.unshift(*rest) unless rest.empty? def $mflags.set?(flag) - grep(/\A-(?!-).*#{'%c' % flag}/i) { return true } + grep(/\A-(?!-).*#{'%s' % flag}/i) { return true } false end def $mflags.defined?(var) diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 37224d884b..767896ed57 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -166,7 +166,7 @@ iconv_create(VALUE to, VALUE from, struct rb_iconv_opt_t *opt) } if (cd == (iconv_t)-1) { int inval = errno == EINVAL; - char *s = inval ? "invalid encoding " : "iconv"; + const char *s = inval ? "invalid encoding " : "iconv"; volatile VALUE msg = rb_str_new(0, strlen(s) + RSTRING(to)->len + RSTRING(from)->len + 8); diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index 1226007b63..20aab9dd65 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -75,8 +75,7 @@ struct wait_readable_arg { #ifdef HAVE_RB_FD_INIT static VALUE -wait_readable(p) - VALUE p; +wait_readable(VALUE p) { struct wait_readable_arg *arg = (struct wait_readable_arg *)p; rb_fdset_t *fds = &arg->fds; diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c index 1677f4f962..63e1ef5ed8 100644 --- a/ext/nkf/nkf-utf8/nkf.c +++ b/ext/nkf/nkf-utf8/nkf.c @@ -1902,18 +1902,14 @@ const int score_table_F0[] = { SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_ERROR, }; -void set_code_score(ptr, score) - struct input_code *ptr; - int score; +void set_code_score(struct input_code *ptr, int score) { if (ptr){ ptr->score |= score; } } -void clr_code_score(ptr, score) - struct input_code *ptr; - int score; +void clr_code_score(struct input_code *ptr, int score) { if (ptr){ ptr->score &= ~score; @@ -1944,8 +1940,7 @@ void code_score(ptr) } } -void status_disable(ptr) -struct input_code *ptr; +void status_disable(struct input_code *ptr) { ptr->stat = -1; ptr->buf[0] = -1; @@ -1953,46 +1948,37 @@ struct input_code *ptr; if (iconv == ptr->iconv_func) set_iconv(FALSE, 0); } -void status_push_ch(ptr, c) - struct input_code *ptr; - int c; +void status_push_ch(struct input_code *ptr, int c) { ptr->buf[ptr->index++] = c; } -void status_clear(ptr) - struct input_code *ptr; +void status_clear(struct input_code *ptr) { ptr->stat = 0; ptr->index = 0; } -void status_reset(ptr) - struct input_code *ptr; +void status_reset(struct input_code *ptr) { status_clear(ptr); ptr->score = SCORE_INIT; } -void status_reinit(ptr) - struct input_code *ptr; +void status_reinit(struct input_code *ptr) { status_reset(ptr); ptr->_file_stat = 0; } -void status_check(ptr, c) - struct input_code *ptr; - int c; +void status_check(struct input_code *ptr, int c) { if (c <= DEL && estab_f){ status_reset(ptr); } } -void s_status(ptr, c) - struct input_code *ptr; - int c; +void s_status(struct input_code *ptr, int c) { switch(ptr->stat){ case -1: @@ -3062,9 +3048,7 @@ w_iconv(c2, c1, c0) #if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE) void -w16w_conv(val, p2, p1, p0) - unsigned short val; - int *p2, *p1, *p0; +w16w_conv(unsigned short val, int *p2, int *p1, int *p0) { if (val < 0x80){ *p2 = val; @@ -3771,9 +3755,7 @@ s_oconv(c2, c1) } void -j_oconv(c2, c1) - int c2, - c1; +j_oconv(int c2, int c1) { #ifdef NUMCHAR_OPTION if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){ @@ -3858,9 +3840,7 @@ j_oconv(c2, c1) } void -base64_conv(c2, c1) - int c2, - c1; +base64_conv(int c2, int c1) { mime_prechar(c2, c1); (*o_base64conv)(c2,c1); @@ -3871,8 +3851,7 @@ STATIC int broken_buf[3]; STATIC int broken_counter = 0; STATIC int broken_last = 0; int -broken_getc(f) -FILE *f; +broken_getc(FILE *f) { int c,c1; @@ -3911,9 +3890,7 @@ FILE *f; } int -broken_ungetc(c,f) -int c; -FILE *f; +broken_ungetc(int c, FILE *f) { if (broken_counter<2) broken_buf[broken_counter++]=c; @@ -3923,8 +3900,7 @@ FILE *f; STATIC int prev_cr = 0; void -cr_conv(c2,c1) -int c2,c1; +cr_conv(int c2, int c1) { if (prev_cr) { prev_cr = 0; @@ -3972,8 +3948,7 @@ int c2,c1; #define char_size(c2,c1) (c2?2:1) void -fold_conv(c2,c1) -int c2,c1; +fold_conv(int c2, int c1) { int prev0; int fold_state=0; @@ -4146,8 +4121,7 @@ int c2,c1; int z_prev2=0,z_prev1=0; void -z_conv(c2,c1) -int c2,c1; +z_conv(int c2, int c1) { /* if (c2) c1 &= 0x7f; assertion */ @@ -4237,8 +4211,7 @@ int c2,c1; ) void -rot_conv(c2,c1) -int c2,c1; +rot_conv(int c2, int c1) { if (c2==0 || c2==X0201 || c2==ISO8859_1) { c1 = rot13(c1); @@ -4250,8 +4223,7 @@ int c2,c1; } void -hira_conv(c2,c1) -int c2,c1; +hira_conv(int c2, int c1) { if ((hira_f & 1) && c2==0x25 && 0x20= o_len) { o_len += incsize; @@ -78,8 +77,7 @@ rb_nkf_putchar(c) #include "nkf-utf8/utf8tbl.c" #include "nkf-utf8/nkf.c" -int nkf_split_options(arg) - const char* arg; +int nkf_split_options(const char *arg) { int count = 0; char option[256]; @@ -142,8 +140,7 @@ int nkf_split_options(arg) */ static VALUE -rb_nkf_kconv(obj, opt, src) - VALUE obj, opt, src; +rb_nkf_kconv(VALUE obj, VALUE opt, VALUE src) { char *opt_ptr, *opt_end; volatile VALUE v; @@ -205,8 +202,7 @@ rb_nkf_kconv(obj, opt, src) */ static VALUE -rb_nkf_guess1(obj, src) - VALUE obj, src; +rb_nkf_guess1(VALUE obj, VALUE src) { unsigned char *p; unsigned char *pend; @@ -319,8 +315,7 @@ rb_nkf_guess1(obj, src) */ static VALUE -rb_nkf_guess2(obj, src) - VALUE obj, src; +rb_nkf_guess2(VALUE obj, VALUE src) { int code = _BINARY; diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 1947a42d71..c60cbc12a1 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -445,7 +445,7 @@ decode_time(unsigned char* der, int length) /********/ typedef struct { - char *name; + const char *name; VALUE *klass; } ossl_asn1_info_t; diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index 0f6ffc0277..07d2a39399 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -335,7 +335,7 @@ static int ossl_pkcs7_sym2typeid(VALUE sym) { int i, ret = Qnil; - char *s; + const char *s; static struct { const char *name; diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index d1340e2b17..963b05c5e2 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -62,7 +62,7 @@ VALUE cSSLSocket; #define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback") #define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context") -static char *ossl_sslctx_attrs[] = { +static const char *ossl_sslctx_attrs[] = { "cert", "key", "client_ca", "ca_file", "ca_path", "timeout", "verify_mode", "verify_depth", "verify_callback", "options", "cert_store", "extra_chain_cert", @@ -83,8 +83,8 @@ static char *ossl_sslctx_attrs[] = { #define ossl_ssl_set_key(o,v) rb_iv_set((o),"@key",(v)) #define ossl_ssl_set_tmp_dh(o,v) rb_iv_set((o),"@tmp_dh",(v)) -static char *ossl_ssl_attr_readers[] = { "io", "context", }; -static char *ossl_ssl_attrs[] = { "sync_close", }; +static const char *ossl_ssl_attr_readers[] = { "io", "context", }; +static const char *ossl_ssl_attrs[] = { "sync_close", }; /* * SSLContext class @@ -144,7 +144,7 @@ ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self) SSL_METHOD *method = NULL; SSL_CTX *ctx; int i; - char *s; + const char *s; for(i = 0; i < numberof(ossl_sslctx_attrs); i++){ char buf[32]; diff --git a/ext/pty/pty.c b/ext/pty/pty.c index b946fc8380..ef357ace5c 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -118,8 +118,7 @@ static char SlaveName[DEVICELEN]; static VALUE eChildExited; static VALUE -echild_status(self) - VALUE self; +echild_status(VALUE self) { return rb_ivar_get(self, rb_intern("status")); } @@ -131,9 +130,7 @@ struct pty_info { }; static void -raise_from_wait(state, info) - struct pty_info *info; - char *state; +raise_from_wait(char *state, struct pty_info *info) { extern VALUE rb_last_status; char buf[1024]; @@ -146,8 +143,7 @@ raise_from_wait(state, info) } static VALUE -pty_syswait(info) - struct pty_info *info; +pty_syswait(struct pty_info *info) { int cpid, status; @@ -184,17 +180,13 @@ struct exec_info { }; static VALUE -pty_exec(arg) - struct exec_info *arg; +pty_exec(struct exec_info *arg) { return rb_f_exec(arg->argc, arg->argv); } static void -establishShell(argc, argv, info) - int argc; - VALUE *argv; - struct pty_info *info; +establishShell(int argc, VALUE *argv, struct pty_info *info) { static int i,master,slave,currentPid; char *p,*getenv(); @@ -295,8 +287,7 @@ establishShell(argc, argv, info) } static VALUE -pty_finalize_syswait(info) - struct pty_info *info; +pty_finalize_syswait(struct pty_info *info) { rb_thread_kill(info->thread); rb_funcall(info->thread, rb_intern("value"), 0); @@ -310,8 +301,7 @@ pty_finalize_syswait(info) * or the same interface function. */ static void -getDevice(master,slave) - int *master,*slave; +getDevice(int *master, int *slave) { if (openpty(master, slave, SlaveName, (struct termios *)0, (struct winsize *)0) == -1) { @@ -321,8 +311,7 @@ getDevice(master,slave) #else /* HAVE_OPENPTY */ #ifdef HAVE__GETPTY static void -getDevice(master,slave) - int *master,*slave; +getDevice(int *master, int *slave) { char *name; @@ -335,8 +324,7 @@ getDevice(master,slave) } #else /* HAVE__GETPTY */ static void -getDevice(master,slave) - int *master,*slave; +getDevice(int *master, int *slave) { int i,j; @@ -407,10 +395,7 @@ freeDevice() /* ruby function: getpty */ static VALUE -pty_getpty(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +pty_getpty(int argc, VALUE *argv, VALUE self) { VALUE res; struct pty_info info; @@ -450,8 +435,7 @@ pty_getpty(argc, argv, self) /* ruby function: protect_signal - obsolete */ static VALUE -pty_protect(self) - VALUE self; +pty_protect(VALUE self) { rb_warn("PTY::protect_signal is no longer needed"); rb_yield(Qnil); @@ -460,8 +444,7 @@ pty_protect(self) /* ruby function: reset_signal - obsolete */ static VALUE -pty_reset_signal(self) - VALUE self; +pty_reset_signal(VALUE self) { rb_warn("PTY::reset_signal is no longer needed"); return self; diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 9661c3cad9..4a28b6e11c 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -50,10 +50,7 @@ readline_event() } static VALUE -readline_readline(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +readline_readline(int argc, VALUE *argv, VALUE self) { VALUE tmp, add_hist, result; char *prompt = NULL; @@ -95,8 +92,7 @@ readline_readline(argc, argv, self) } static VALUE -readline_s_set_input(self, input) - VALUE self, input; +readline_s_set_input(VALUE self, VALUE input) { OpenFile *ifp; @@ -108,8 +104,7 @@ readline_s_set_input(self, input) } static VALUE -readline_s_set_output(self, output) - VALUE self, output; +readline_s_set_output(VALUE self, VALUE output) { OpenFile *ofp; @@ -121,9 +116,7 @@ readline_s_set_output(self, output) } static VALUE -readline_s_set_completion_proc(self, proc) - VALUE self; - VALUE proc; +readline_s_set_completion_proc(VALUE self, VALUE proc) { rb_secure(4); if (!rb_respond_to(proc, rb_intern("call"))) @@ -132,35 +125,28 @@ readline_s_set_completion_proc(self, proc) } static VALUE -readline_s_get_completion_proc(self) - VALUE self; +readline_s_get_completion_proc(VALUE self) { rb_secure(4); return rb_attr_get(mReadline, completion_proc); } static VALUE -readline_s_set_completion_case_fold(self, val) - VALUE self; - VALUE val; +readline_s_set_completion_case_fold(VALUE self, VALUE val) { rb_secure(4); return rb_ivar_set(mReadline, completion_case_fold, val); } static VALUE -readline_s_get_completion_case_fold(self) - VALUE self; +readline_s_get_completion_case_fold(VALUE self) { rb_secure(4); return rb_attr_get(mReadline, completion_case_fold); } static char ** -readline_attempted_completion_function(text, start, end) - const char *text; - int start; - int end; +readline_attempted_completion_function(const char *text, int start, int end) { VALUE proc, ary, temp; char **result; @@ -224,8 +210,7 @@ readline_attempted_completion_function(text, start, end) } static VALUE -readline_s_vi_editing_mode(self) - VALUE self; +readline_s_vi_editing_mode(VALUE self) { #ifdef HAVE_RL_VI_EDITING_MODE rb_secure(4); @@ -238,8 +223,7 @@ readline_s_vi_editing_mode(self) } static VALUE -readline_s_emacs_editing_mode(self) - VALUE self; +readline_s_emacs_editing_mode(VALUE self) { #ifdef HAVE_RL_EMACS_EDITING_MODE rb_secure(4); @@ -252,8 +236,7 @@ readline_s_emacs_editing_mode(self) } static VALUE -readline_s_set_completion_append_character(self, str) - VALUE self, str; +readline_s_set_completion_append_character(VALUE self, VALUE str) { #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER rb_secure(4); @@ -276,8 +259,7 @@ readline_s_set_completion_append_character(self, str) } static VALUE -readline_s_get_completion_append_character(self) - VALUE self; +readline_s_get_completion_append_character(VALUE self) { #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER VALUE str; @@ -296,8 +278,7 @@ readline_s_get_completion_append_character(self) } static VALUE -readline_s_set_basic_word_break_characters(self, str) - VALUE self, str; +readline_s_set_basic_word_break_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS static char *basic_word_break_characters = NULL; @@ -323,8 +304,7 @@ readline_s_set_basic_word_break_characters(self, str) } static VALUE -readline_s_get_basic_word_break_characters(self, str) - VALUE self, str; +readline_s_get_basic_word_break_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS rb_secure(4); @@ -338,8 +318,7 @@ readline_s_get_basic_word_break_characters(self, str) } static VALUE -readline_s_set_completer_word_break_characters(self, str) - VALUE self, str; +readline_s_set_completer_word_break_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS static char *completer_word_break_characters = NULL; @@ -365,8 +344,7 @@ readline_s_set_completer_word_break_characters(self, str) } static VALUE -readline_s_get_completer_word_break_characters(self, str) - VALUE self, str; +readline_s_get_completer_word_break_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS rb_secure(4); @@ -380,8 +358,7 @@ readline_s_get_completer_word_break_characters(self, str) } static VALUE -readline_s_set_basic_quote_characters(self, str) - VALUE self, str; +readline_s_set_basic_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS static char *basic_quote_characters = NULL; @@ -408,8 +385,7 @@ readline_s_set_basic_quote_characters(self, str) } static VALUE -readline_s_get_basic_quote_characters(self, str) - VALUE self, str; +readline_s_get_basic_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS rb_secure(4); @@ -423,8 +399,7 @@ readline_s_get_basic_quote_characters(self, str) } static VALUE -readline_s_set_completer_quote_characters(self, str) - VALUE self, str; +readline_s_set_completer_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS static char *completer_quote_characters = NULL; @@ -451,8 +426,7 @@ readline_s_set_completer_quote_characters(self, str) } static VALUE -readline_s_get_completer_quote_characters(self, str) - VALUE self, str; +readline_s_get_completer_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS rb_secure(4); @@ -466,8 +440,7 @@ readline_s_get_completer_quote_characters(self, str) } static VALUE -readline_s_set_filename_quote_characters(self, str) - VALUE self, str; +readline_s_set_filename_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS static char *filename_quote_characters = NULL; @@ -494,8 +467,7 @@ readline_s_set_filename_quote_characters(self, str) } static VALUE -readline_s_get_filename_quote_characters(self, str) - VALUE self, str; +readline_s_get_filename_quote_characters(VALUE self, VALUE str) { #ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS rb_secure(4); @@ -509,16 +481,13 @@ readline_s_get_filename_quote_characters(self, str) } static VALUE -hist_to_s(self) - VALUE self; +hist_to_s(VALUE self) { return rb_str_new2("HISTORY"); } static VALUE -hist_get(self, index) - VALUE self; - VALUE index; +hist_get(VALUE self, VALUE index) { HIST_ENTRY *entry; int i; @@ -536,10 +505,7 @@ hist_get(self, index) } static VALUE -hist_set(self, index, str) - VALUE self; - VALUE index; - VALUE str; +hist_set(VALUE self, VALUE index, VALUE str) { #ifdef HAVE_REPLACE_HISTORY_ENTRY HIST_ENTRY *entry; @@ -563,9 +529,7 @@ hist_set(self, index, str) } static VALUE -hist_push(self, str) - VALUE self; - VALUE str; +hist_push(VALUE self, VALUE str) { rb_secure(4); SafeStringValue(str); @@ -574,10 +538,7 @@ hist_push(self, str) } static VALUE -hist_push_method(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +hist_push_method(int argc, VALUE *argv, VALUE self) { VALUE str; @@ -591,8 +552,7 @@ hist_push_method(argc, argv, self) } static VALUE -rb_remove_history(index) - int index; +rb_remove_history(int index) { #ifdef HAVE_REMOVE_HISTORY HIST_ENTRY *entry; @@ -614,8 +574,7 @@ rb_remove_history(index) } static VALUE -hist_pop(self) - VALUE self; +hist_pop(VALUE self) { rb_secure(4); if (history_length > 0) { @@ -626,8 +585,7 @@ hist_pop(self) } static VALUE -hist_shift(self) - VALUE self; +hist_shift(VALUE self) { rb_secure(4); if (history_length > 0) { @@ -638,8 +596,7 @@ hist_shift(self) } static VALUE -hist_each(self) - VALUE self; +hist_each(VALUE self) { HIST_ENTRY *entry; int i; @@ -655,25 +612,21 @@ hist_each(self) } static VALUE -hist_length(self) - VALUE self; +hist_length(VALUE self) { rb_secure(4); return INT2NUM(history_length); } static VALUE -hist_empty_p(self) - VALUE self; +hist_empty_p(VALUE self) { rb_secure(4); return history_length == 0 ? Qtrue : Qfalse; } static VALUE -hist_delete_at(self, index) - VALUE self; - VALUE index; +hist_delete_at(VALUE self, VALUE index) { int i; @@ -688,9 +641,7 @@ hist_delete_at(self, index) } static VALUE -filename_completion_proc_call(self, str) - VALUE self; - VALUE str; +filename_completion_proc_call(VALUE self, VALUE str) { VALUE result; char **matches; @@ -715,9 +666,7 @@ filename_completion_proc_call(self, str) } static VALUE -username_completion_proc_call(self, str) - VALUE self; - VALUE str; +username_completion_proc_call(VALUE self, VALUE str) { VALUE result; char **matches; diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c index 88d7856202..18d803873c 100644 --- a/ext/ripper/eventids2.c +++ b/ext/ripper/eventids2.c @@ -265,8 +265,7 @@ static struct token_assoc { }; static ID -ripper_token2eventid(tok) - int tok; +ripper_token2eventid(int tok) { struct token_assoc *a; diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 60333a1ff9..a1beaae375 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -489,8 +489,7 @@ strio_eof(self) /* :nodoc: */ static VALUE -strio_copy(copy, orig) - VALUE copy, orig; +strio_copy(VALUE copy, VALUE orig) { struct StringIO *ptr; @@ -559,10 +558,7 @@ strio_set_lineno(self, lineno) * and _mode_ (see StringIO#new). */ static VALUE -strio_reopen(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_reopen(int argc, VALUE *argv, VALUE self) { if (!OBJ_TAINTED(self)) rb_secure(4); if (argc == 1 && TYPE(*argv) != T_STRING) { @@ -717,9 +713,7 @@ strio_getc(self) } static void -strio_extend(ptr, pos, len) - struct StringIO *ptr; - long pos, len; +strio_extend(struct StringIO *ptr, long pos, long len) { long olen; @@ -1149,10 +1143,7 @@ strio_read(argc, argv, self) * returning +nil+, as well as IO#sysread does. */ static VALUE -strio_sysread(argc, argv, self) - int argc; - VALUE *argv; - VALUE self; +strio_sysread(int argc, VALUE *argv, VALUE self) { VALUE val = strio_read(argc, argv, self); if (NIL_P(val) || RSTRING(val)->len == 0) { diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index d9d58fdcfc..913c6b53c1 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -263,8 +263,7 @@ strscan_s_mustc(self) * Reset the scan pointer (index 0) and clear matching data. */ static VALUE -strscan_reset(self) - VALUE self; +strscan_reset(VALUE self) { struct strscanner *p; @@ -600,8 +599,7 @@ strscan_scan_until(self, re) * s.exist? /e/ # -> nil */ static VALUE -strscan_exist_p(self, re) - VALUE self, re; +strscan_exist_p(VALUE self, VALUE re) { return strscan_do_scan(self, re, 0, 0, 0); } @@ -962,8 +960,7 @@ strscan_matched_size(self) * This method is obsolete; use #matched_size instead. */ static VALUE -strscan_matchedsize(self) - VALUE self; +strscan_matchedsize(VALUE self) { rb_warning("StringScanner#matchedsize is obsolete; use #matched_size instead"); return strscan_matched_size(self); @@ -1084,8 +1081,7 @@ strscan_rest_size(self) * This method is obsolete; use #rest_size instead. */ static VALUE -strscan_restsize(self) - VALUE self; +strscan_restsize(VALUE self) { rb_warning("StringScanner#restsize is obsolete; use #rest_size instead"); return strscan_rest_size(self); diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index f8d7b548a9..f5c6c3c4bd 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -282,7 +282,7 @@ syck_emitter_clear( SyckEmitter *e ) * Raw write to the emitter buffer. */ void -syck_emitter_write( SyckEmitter *e, char *str, long len ) +syck_emitter_write( SyckEmitter *e, const char *str, long len ) { long at; ASSERT( str != NULL ) @@ -438,7 +438,7 @@ end_emit: * and the implicit tag which would be assigned to this node. If a tag is * required, write the tag. */ -void syck_emit_tag( SyckEmitter *e, char *tag, char *ignore ) +void syck_emit_tag( SyckEmitter *e, const char *tag, const char *ignore ) { SyckLevel *lvl; if ( tag == NULL ) return; @@ -457,7 +457,7 @@ void syck_emit_tag( SyckEmitter *e, char *tag, char *ignore ) int skip = 4 + strlen( YAML_DOMAIN ) + 1; syck_emitter_write( e, tag + skip, taglen - skip ); } else { - char *subd = tag + 4; + const char *subd = tag + 4; while ( *subd != ':' && *subd != '\0' ) subd++; if ( *subd == ':' ) { if ( subd - tag > ( strlen( YAML_DOMAIN ) + 5 ) && @@ -559,7 +559,7 @@ syck_scan_scalar( int req_width, char *cursor, long len ) } if ( ( cursor[0] == '-' || cursor[0] == ':' || cursor[0] == '?' || cursor[0] == ',' ) && - ( cursor[1] == ' ' || cursor[1] == '\n' || len == 1 ) ) + ( len == 1 || cursor[1] == ' ' || cursor[1] == '\n' ) ) { flags |= SCAN_INDIC_S; } @@ -1221,7 +1221,7 @@ syck_emitter_mark_node( SyckEmitter *e, st_data_t n ) if ( ! st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) ) { int idx = 0; - char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format ); + const char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format ); /* * Second time hitting this object, let's give it an anchor diff --git a/ext/syck/handler.c b/ext/syck/handler.c index 56fe838fbd..b04c4e3c0e 100644 --- a/ext/syck/handler.c +++ b/ext/syck/handler.c @@ -155,7 +155,7 @@ syck_xprivate( char *type_id, int type_len ) } char * -syck_taguri( char *domain, char *type_id, int type_len ) +syck_taguri( const char *domain, const char *type_id, int type_len ) { char *uri = S_ALLOC_N( char, strlen( domain ) + type_len + 14 ); uri[0] = '\0'; diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c index d356faf7d9..cfd5d7b3e6 100644 --- a/ext/syck/implicit.c +++ b/ext/syck/implicit.c @@ -1585,7 +1585,7 @@ yy201: ++YYCURSOR; /* Remove ending fragment and compare types */ int -syck_tagcmp( char *tag1, char *tag2 ) +syck_tagcmp( const char *tag1, const char *tag2 ) { if ( tag1 == tag2 ) return 1; if ( tag1 == NULL || tag2 == NULL ) return 0; diff --git a/ext/syck/node.c b/ext/syck/node.c index 28fc78c077..cbc2adb6c5 100644 --- a/ext/syck/node.c +++ b/ext/syck/node.c @@ -100,13 +100,13 @@ syck_alloc_str() } SyckNode * -syck_new_str( char *str, enum scalar_style style ) +syck_new_str( const char *str, enum scalar_style style ) { return syck_new_str2( str, strlen( str ), style ); } SyckNode * -syck_new_str2( char *str, long len, enum scalar_style style ) +syck_new_str2( const char *str, long len, enum scalar_style style ) { SyckNode *n; diff --git a/ext/syck/syck.c b/ext/syck/syck.c index 24a56a5e48..20b124ab28 100644 --- a/ext/syck/syck.c +++ b/ext/syck/syck.c @@ -32,7 +32,7 @@ syck_assert( char *file_name, unsigned line_num ) * Allocates and copies a string */ char * -syck_strndup( char *buf, long len ) +syck_strndup( const char *buf, long len ) { char *new = S_ALLOC_N( char, len + 1 ); S_MEMZERO( new, char, len + 1 ); diff --git a/ext/syck/syck.h b/ext/syck/syck.h index c49f740173..eb91b242c3 100644 --- a/ext/syck/syck.h +++ b/ext/syck/syck.h @@ -346,8 +346,8 @@ void syck_hdlr_remove_anchor( SyckParser *, char * ); SyckNode *syck_hdlr_get_anchor( SyckParser *, char * ); void syck_add_transfer( char *, SyckNode *, int ); char *syck_xprivate( char *, int ); -char *syck_taguri( char *, char *, int ); -int syck_tagcmp( char *, char * ); +char *syck_taguri( const char *, const char *, int ); +int syck_tagcmp( const char *, const char * ); int syck_add_sym( SyckParser *, char * ); int syck_lookup_sym( SyckParser *, SYMID, char ** ); int syck_try_implicit( SyckNode * ); @@ -358,7 +358,7 @@ char *syck_match_implicit( char *, size_t ); /* * API prototypes */ -char *syck_strndup( char *, long ); +char *syck_strndup( const char *, long ); long syck_io_file_read( char *, SyckIoFile *, long, long ); long syck_io_str_read( char *, SyckIoStr *, long, long ); char *syck_base64enc( char *, long ); @@ -370,7 +370,7 @@ void syck_output_handler( SyckEmitter *, SyckOutputHandler ); void syck_emitter_handler( SyckEmitter *, SyckEmitterHandler ); void syck_free_emitter( SyckEmitter * ); void syck_emitter_clear( SyckEmitter * ); -void syck_emitter_write( SyckEmitter *, char *, long ); +void syck_emitter_write( SyckEmitter *, const char *, long ); void syck_emitter_escape( SyckEmitter *, char *, long ); void syck_emitter_flush( SyckEmitter *, long ); void syck_emit( SyckEmitter *, st_data_t ); @@ -383,7 +383,7 @@ void syck_emit_seq( SyckEmitter *, char *, enum seq_style ); void syck_emit_item( SyckEmitter *, st_data_t ); void syck_emit_map( SyckEmitter *, char *, enum map_style ); void syck_emit_end( SyckEmitter * ); -void syck_emit_tag( SyckEmitter *, char *, char * ); +void syck_emit_tag( SyckEmitter *, const char *, const char * ); void syck_emit_indent( SyckEmitter * ); SyckLevel *syck_emitter_current_level( SyckEmitter * ); SyckLevel *syck_emitter_parent_level( SyckEmitter * ); @@ -421,8 +421,8 @@ SyckNode *syck_alloc_seq(); SyckNode *syck_alloc_str(); void syck_free_node( SyckNode * ); void syck_free_members( SyckNode * ); -SyckNode *syck_new_str( char *, enum scalar_style ); -SyckNode *syck_new_str2( char *, long, enum scalar_style ); +SyckNode *syck_new_str( const char *, enum scalar_style ); +SyckNode *syck_new_str2( const char *, long, enum scalar_style ); void syck_replace_str( SyckNode *, char *, enum scalar_style ); void syck_replace_str2( SyckNode *, char *, long, enum scalar_style ); void syck_str_blow_away_commas( SyckNode * ); diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c index 61cd8c8eac..821a3cd5b5 100644 --- a/ext/syck/yaml2byte.c +++ b/ext/syck/yaml2byte.c @@ -145,6 +145,7 @@ syck_yaml2byte_handler(p, n) strcat( type_tag, "!" ); strcat( type_tag, n->type_id ); bytestring_append( val, YAMLBYTE_TRANSFER, type_tag, NULL); + S_FREE(type_tag); } } switch (n->kind) diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index e43b98e2c1..9a64c27870 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -6217,7 +6217,11 @@ lib_fromUTF8_core(ip_obj, src, encodename) char *s; int len; +<<<<<<< tcltklib.c + StringValue(str); +======= StringValue(str); +>>>>>>> 1.45 s = Tcl_GetByteArrayFromObj(Tcl_NewStringObj(RSTRING(str)->ptr, RSTRING(str)->len), &len); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 822b2a5bee..0be5aa9aef 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -197,9 +197,7 @@ static VALUE cZError, cStreamEnd, cNeedDict; static VALUE cStreamError, cDataError, cMemError, cBufError, cVersionError; static void -raise_zlib_error(err, msg) - int err; - const char *msg; +raise_zlib_error(int err, const char *msg) { VALUE exc; @@ -247,8 +245,7 @@ raise_zlib_error(err, msg) /*--- Warning (in finalizer) ---*/ static void -finalizer_warn(msg) - const char *msg; +finalizer_warn(const char *msg) { fprintf(stderr, "zlib(finalizer): %s\n", msg); } @@ -260,8 +257,7 @@ finalizer_warn(msg) * Returns the string which represents the version of zlib library. */ static VALUE -rb_zlib_version(klass) - VALUE klass; +rb_zlib_version(VALUE klass) { VALUE str; @@ -311,10 +307,7 @@ do_checksum(argc, argv, func) * FIXME: expression. */ static VALUE -rb_zlib_adler32(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_zlib_adler32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, adler32); } @@ -329,10 +322,7 @@ rb_zlib_adler32(argc, argv, klass) * FIXME: expression. */ static VALUE -rb_zlib_crc32(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_zlib_crc32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, crc32); } @@ -341,8 +331,7 @@ rb_zlib_crc32(argc, argv, klass) * Returns the table for calculating CRC checksum as an array. */ static VALUE -rb_zlib_crc_table(obj) - VALUE obj; +rb_zlib_crc_table(VALUE obj) { const unsigned long *crctbl; VALUE dst; @@ -401,24 +390,19 @@ static const struct zstream_funcs inflate_funcs = { static voidpf -zlib_mem_alloc(opaque, items, size) - voidpf opaque; - uInt items, size; +zlib_mem_alloc(voidpf opaque, uInt items, uInt size) { return xmalloc(items * size); } static void -zlib_mem_free(opaque, address) - voidpf opaque, address; +zlib_mem_free(voidpf opaque, voidpf address) { free(address); } static void -zstream_init(z, func) - struct zstream *z; - const struct zstream_funcs *func; +zstream_init(struct zstream *z, const struct zstream_funcs *func) { z->flags = 0; z->buf = Qnil; @@ -439,8 +423,7 @@ zstream_init(z, func) #define zstream_init_inflate(z) zstream_init((z), &inflate_funcs) static void -zstream_expand_buffer(z) - struct zstream *z; +zstream_expand_buffer(struct zstream *z) { long inc; @@ -472,9 +455,7 @@ zstream_expand_buffer(z) } static void -zstream_expand_buffer_into(z, size) - struct zstream *z; - int size; +zstream_expand_buffer_into(struct zstream *z, int size) { if (NIL_P(z->buf)) { /* I uses rb_str_new here not rb_str_buf_new because @@ -493,10 +474,7 @@ zstream_expand_buffer_into(z, size) } static void -zstream_append_buffer(z, src, len) - struct zstream *z; - const Bytef *src; - int len; +zstream_append_buffer(struct zstream *z, const Bytef *src, int len) { if (NIL_P(z->buf)) { z->buf = rb_str_buf_new(len); @@ -529,8 +507,7 @@ zstream_append_buffer(z, src, len) zstream_append_buffer((z),(Bytef*)RSTRING(v)->ptr,RSTRING(v)->len) static VALUE -zstream_detach_buffer(z) - struct zstream *z; +zstream_detach_buffer(struct zstream *z) { VALUE dst; @@ -551,9 +528,7 @@ zstream_detach_buffer(z) } static VALUE -zstream_shift_buffer(z, len) - struct zstream *z; - int len; +zstream_shift_buffer(struct zstream *z, int len) { VALUE dst; @@ -576,9 +551,7 @@ zstream_shift_buffer(z, len) } static void -zstream_buffer_ungetc(z, c) - struct zstream *z; - int c; +zstream_buffer_ungetc(struct zstream *z, int c) { if (NIL_P(z->buf) || RSTRING(z->buf)->len - z->buf_filled == 0) { zstream_expand_buffer(z); @@ -594,10 +567,7 @@ zstream_buffer_ungetc(z, c) } static void -zstream_append_input(z, src, len) - struct zstream *z; - const Bytef *src; - unsigned int len; +zstream_append_input(struct zstream *z, const Bytef *src, unsigned int len) { if (len <= 0) return; @@ -615,9 +585,7 @@ zstream_append_input(z, src, len) zstream_append_input((z), (Bytef*)RSTRING(v)->ptr, RSTRING(v)->len) static void -zstream_discard_input(z, len) - struct zstream *z; - unsigned int len; +zstream_discard_input(struct zstream *z, unsigned int len) { if (NIL_P(z->input) || RSTRING(z->input)->len <= len) { z->input = Qnil; @@ -630,15 +598,13 @@ zstream_discard_input(z, len) } static void -zstream_reset_input(z) - struct zstream *z; +zstream_reset_input(struct zstream *z) { z->input = Qnil; } static void -zstream_passthrough_input(z) - struct zstream *z; +zstream_passthrough_input(struct zstream *z) { if (!NIL_P(z->input)) { zstream_append_buffer2(z, z->input); @@ -647,8 +613,7 @@ zstream_passthrough_input(z) } static VALUE -zstream_detach_input(z) - struct zstream *z; +zstream_detach_input(struct zstream *z) { VALUE dst; @@ -665,8 +630,7 @@ zstream_detach_input(z) } static void -zstream_reset(z) - struct zstream *z; +zstream_reset(struct zstream *z) { int err; @@ -683,8 +647,7 @@ zstream_reset(z) } static VALUE -zstream_end(z) - struct zstream *z; +zstream_end(struct zstream *z) { int err; @@ -707,11 +670,7 @@ zstream_end(z) } static void -zstream_run(z, src, len, flush) - struct zstream *z; - Bytef *src; - uInt len; - int flush; +zstream_run(struct zstream *z, Bytef *src, uInt len, int flush) { uInt n; int err; @@ -773,10 +732,7 @@ zstream_run(z, src, len, flush) } static VALUE -zstream_sync(z, src, len) - struct zstream *z; - Bytef *src; - uInt len; +zstream_sync(struct zstream *z, Bytef *src, uInt len) { VALUE rest; int err; @@ -815,16 +771,14 @@ zstream_sync(z, src, len) } static void -zstream_mark(z) - struct zstream *z; +zstream_mark(struct zstream *z) { rb_gc_mark(z->buf); rb_gc_mark(z->input); } static void -zstream_finalize(z) - struct zstream *z; +zstream_finalize(struct zstream *z) { int err = z->func->end(&z->stream); if (err == Z_STREAM_ERROR) @@ -834,8 +788,7 @@ zstream_finalize(z) } static void -zstream_free(z) - struct zstream *z; +zstream_free(struct zstream *z) { if (ZSTREAM_IS_READY(z)) { zstream_finalize(z); @@ -844,9 +797,7 @@ zstream_free(z) } static VALUE -zstream_new(klass, funcs) - VALUE klass; - const struct zstream_funcs *funcs; +zstream_new(VALUE klass, const struct zstream_funcs *funcs) { VALUE obj; struct zstream *z; @@ -861,8 +812,7 @@ zstream_new(klass, funcs) #define zstream_inflate_new(klass) zstream_new((klass), &inflate_funcs) static struct zstream * -get_zstream(obj) - VALUE obj; +get_zstream(VALUE obj) { struct zstream *z; @@ -942,8 +892,7 @@ get_zstream(obj) * exception. */ static VALUE -rb_zstream_end(obj) - VALUE obj; +rb_zstream_end(VALUE obj) { zstream_end(get_zstream(obj)); return Qnil; @@ -954,8 +903,7 @@ rb_zstream_end(obj) * are discarded. */ static VALUE -rb_zstream_reset(obj) - VALUE obj; +rb_zstream_reset(VALUE obj) { zstream_reset(get_zstream(obj)); return Qnil; @@ -966,8 +914,7 @@ rb_zstream_reset(obj) * Zlib::Inflate#finish for details of this behavior. */ static VALUE -rb_zstream_finish(obj) - VALUE obj; +rb_zstream_finish(VALUE obj) { struct zstream *z = get_zstream(obj); VALUE dst; @@ -983,8 +930,7 @@ rb_zstream_finish(obj) * Flushes input buffer and returns all data in that buffer. */ static VALUE -rb_zstream_flush_next_in(obj) - VALUE obj; +rb_zstream_flush_next_in(VALUE obj) { struct zstream *z; VALUE dst; @@ -999,8 +945,7 @@ rb_zstream_flush_next_in(obj) * Flushes output buffer and returns all data in that buffer. */ static VALUE -rb_zstream_flush_next_out(obj) - VALUE obj; +rb_zstream_flush_next_out(VALUE obj) { struct zstream *z; VALUE dst; @@ -1016,8 +961,7 @@ rb_zstream_flush_next_out(obj) * space is allocated automatically, this method returns 0 normally. */ static VALUE -rb_zstream_avail_out(obj) - VALUE obj; +rb_zstream_avail_out(VALUE obj) { struct zstream *z; Data_Get_Struct(obj, struct zstream, z); @@ -1031,8 +975,7 @@ rb_zstream_avail_out(obj) * method. */ static VALUE -rb_zstream_set_avail_out(obj, size) - VALUE obj, size; +rb_zstream_set_avail_out(VALUE obj, VALUE size) { struct zstream *z = get_zstream(obj); @@ -1045,8 +988,7 @@ rb_zstream_set_avail_out(obj, size) * Returns bytes of data in the input buffer. Normally, returns 0. */ static VALUE -rb_zstream_avail_in(obj) - VALUE obj; +rb_zstream_avail_in(VALUE obj) { struct zstream *z; Data_Get_Struct(obj, struct zstream, z); @@ -1057,8 +999,7 @@ rb_zstream_avail_in(obj) * Returns the total bytes of the input data to the stream. FIXME */ static VALUE -rb_zstream_total_in(obj) - VALUE obj; +rb_zstream_total_in(VALUE obj) { return rb_uint2inum(get_zstream(obj)->stream.total_in); } @@ -1067,8 +1008,7 @@ rb_zstream_total_in(obj) * Returns the total bytes of the output data from the stream. FIXME */ static VALUE -rb_zstream_total_out(obj) - VALUE obj; +rb_zstream_total_out(VALUE obj) { return rb_uint2inum(get_zstream(obj)->stream.total_out); } @@ -1079,8 +1019,7 @@ rb_zstream_total_out(obj) * Zlib::UNKNOWN. */ static VALUE -rb_zstream_data_type(obj) - VALUE obj; +rb_zstream_data_type(VALUE obj) { return INT2FIX(get_zstream(obj)->stream.data_type); } @@ -1089,8 +1028,7 @@ rb_zstream_data_type(obj) * Returns the adler-32 checksum. */ static VALUE -rb_zstream_adler(obj) - VALUE obj; +rb_zstream_adler(VALUE obj) { return rb_uint2inum(get_zstream(obj)->stream.adler); } @@ -1099,8 +1037,7 @@ rb_zstream_adler(obj) * Returns true if the stream is finished. */ static VALUE -rb_zstream_finished_p(obj) - VALUE obj; +rb_zstream_finished_p(VALUE obj) { return ZSTREAM_IS_FINISHED(get_zstream(obj)) ? Qtrue : Qfalse; } @@ -1109,8 +1046,7 @@ rb_zstream_finished_p(obj) * Returns true if the stream is closed. */ static VALUE -rb_zstream_closed_p(obj) - VALUE obj; +rb_zstream_closed_p(VALUE obj) { struct zstream *z; Data_Get_Struct(obj, struct zstream, z); @@ -1139,8 +1075,7 @@ rb_zstream_closed_p(obj) static VALUE -rb_deflate_s_allocate(klass) - VALUE klass; +rb_deflate_s_allocate(VALUE klass) { return zstream_deflate_new(klass); } @@ -1155,10 +1090,7 @@ rb_deflate_s_allocate(klass) * TODO: document better! */ static VALUE -rb_deflate_initialize(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_deflate_initialize(int argc, VALUE *argv, VALUE obj) { struct zstream *z; VALUE level, wbits, memlevel, strategy; @@ -1182,8 +1114,7 @@ rb_deflate_initialize(argc, argv, obj) * Duplicates the deflate stream. */ static VALUE -rb_deflate_init_copy(self, orig) - VALUE self, orig; +rb_deflate_init_copy(VALUE self, VALUE orig) { struct zstream *z1 = get_zstream(self); struct zstream *z2 = get_zstream(orig); @@ -1199,8 +1130,7 @@ rb_deflate_init_copy(self, orig) } static VALUE -deflate_run(args) - VALUE args; +deflate_run(VALUE args) { struct zstream *z = (struct zstream*)((VALUE*)args)[0]; VALUE src = ((VALUE*)args)[1]; @@ -1230,10 +1160,7 @@ deflate_run(args) * */ static VALUE -rb_deflate_s_deflate(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_deflate_s_deflate(int argc, VALUE *argv, VALUE klass) { struct zstream z; VALUE src, level, dst, args[2]; @@ -1259,10 +1186,7 @@ rb_deflate_s_deflate(argc, argv, klass) } static void -do_deflate(z, src, flush) - struct zstream *z; - VALUE src; - int flush; +do_deflate(struct zstream *z, VALUE src, int flush) { if (NIL_P(src)) { zstream_run(z, (Bytef*)"", 0, Z_FINISH); @@ -1289,10 +1213,7 @@ do_deflate(z, src, flush) * TODO: document better! */ static VALUE -rb_deflate_deflate(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_deflate_deflate(int argc, VALUE *argv, VALUE obj) { struct zstream *z = get_zstream(obj); VALUE src, flush, dst; @@ -1314,8 +1235,7 @@ rb_deflate_deflate(argc, argv, obj) * preserved in output buffer. */ static VALUE -rb_deflate_addstr(obj, src) - VALUE obj, src; +rb_deflate_addstr(VALUE obj, VALUE src) { OBJ_INFECT(obj, src); do_deflate(get_zstream(obj), src, Z_NO_FLUSH); @@ -1332,10 +1252,7 @@ rb_deflate_addstr(obj, src) * TODO: document better! */ static VALUE -rb_deflate_flush(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_deflate_flush(int argc, VALUE *argv, VALUE obj) { struct zstream *z = get_zstream(obj); VALUE v_flush, dst; @@ -1362,8 +1279,7 @@ rb_deflate_flush(argc, argv, obj) * TODO: document better! */ static VALUE -rb_deflate_params(obj, v_level, v_strategy) - VALUE obj, v_level, v_strategy; +rb_deflate_params(VALUE obj, VALUE v_level, VALUE v_strategy) { struct zstream *z = get_zstream(obj); int level, strategy; @@ -1395,8 +1311,7 @@ rb_deflate_params(obj, v_level, v_strategy) * TODO: document better! */ static VALUE -rb_deflate_set_dictionary(obj, dic) - VALUE obj, dic; +rb_deflate_set_dictionary(VALUE obj, VALUE dic) { struct zstream *z = get_zstream(obj); VALUE src = dic; @@ -1427,8 +1342,7 @@ rb_deflate_set_dictionary(obj, dic) static VALUE -rb_inflate_s_allocate(klass) - VALUE klass; +rb_inflate_s_allocate(VALUE klass) { return zstream_inflate_new(klass); } @@ -1442,10 +1356,7 @@ rb_inflate_s_allocate(klass) * TODO: document better! */ static VALUE -rb_inflate_initialize(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_inflate_initialize(int argc, VALUE *argv, VALUE obj) { struct zstream *z; VALUE wbits; @@ -1464,8 +1375,7 @@ rb_inflate_initialize(argc, argv, obj) } static VALUE -inflate_run(args) - VALUE args; +inflate_run(VALUE args) { struct zstream *z = (struct zstream*)((VALUE*)args)[0]; VALUE src = ((VALUE*)args)[1]; @@ -1493,8 +1403,7 @@ inflate_run(args) * */ static VALUE -rb_inflate_s_inflate(obj, src) - VALUE obj, src; +rb_inflate_s_inflate(VALUE obj, VALUE src) { struct zstream z; VALUE dst, args[2]; @@ -1517,9 +1426,7 @@ rb_inflate_s_inflate(obj, src) } static void -do_inflate(z, src) - struct zstream *z; - VALUE src; +do_inflate(struct zstream *z, VALUE src) { if (NIL_P(src)) { zstream_run(z, (Bytef*)"", 0, Z_FINISH); @@ -1546,8 +1453,7 @@ do_inflate(z, src) * TODO: document better! */ static VALUE -rb_inflate_inflate(obj, src) - VALUE obj, src; +rb_inflate_inflate(VALUE obj, VALUE src) { struct zstream *z = get_zstream(obj); VALUE dst; @@ -1584,8 +1490,7 @@ rb_inflate_inflate(obj, src) * preserved in output buffer. */ static VALUE -rb_inflate_addstr(obj, src) - VALUE obj, src; +rb_inflate_addstr(VALUE obj, VALUE src) { struct zstream *z = get_zstream(obj); @@ -1616,8 +1521,7 @@ rb_inflate_addstr(obj, src) * following data of full flush point is preserved in the buffer. */ static VALUE -rb_inflate_sync(obj, src) - VALUE obj, src; +rb_inflate_sync(VALUE obj, VALUE src) { struct zstream *z = get_zstream(obj); @@ -1634,8 +1538,7 @@ rb_inflate_sync(obj, src) * :) */ static VALUE -rb_inflate_sync_point_p(obj) - VALUE obj; +rb_inflate_sync_point_p(VALUE obj) { struct zstream *z = get_zstream(obj); int err; @@ -1657,8 +1560,7 @@ rb_inflate_sync_point_p(obj) * TODO: document better! */ static VALUE -rb_inflate_set_dictionary(obj, dic) - VALUE obj, dic; +rb_inflate_set_dictionary(VALUE obj, VALUE dic) { struct zstream *z = get_zstream(obj); VALUE src = dic; @@ -1753,8 +1655,7 @@ struct gzfile { static void -gzfile_mark(gz) - struct gzfile *gz; +gzfile_mark(struct gzfile *gz) { rb_gc_mark(gz->io); rb_gc_mark(gz->orig_name); @@ -1763,8 +1664,7 @@ gzfile_mark(gz) } static void -gzfile_free(gz) - struct gzfile *gz; +gzfile_free(struct gzfile *gz) { struct zstream *z = &gz->z; @@ -1806,8 +1706,7 @@ gzfile_new(klass, funcs, endfunc) #define gzfile_reader_new(gz) gzfile_new((gz),&inflate_funcs,gzfile_reader_end) static void -gzfile_reset(gz) - struct gzfile *gz; +gzfile_reset(struct gzfile *gz) { zstream_reset(&gz->z); gz->crc = crc32(0, Z_NULL, 0); @@ -1816,9 +1715,7 @@ gzfile_reset(gz) } static void -gzfile_close(gz, closeflag) - struct gzfile *gz; - int closeflag; +gzfile_close(struct gzfile *gz, int closeflag) { VALUE io = gz->io; @@ -1832,8 +1729,7 @@ gzfile_close(gz, closeflag) } static void -gzfile_write_raw(gz) - struct gzfile *gz; +gzfile_write_raw(struct gzfile *gz) { VALUE str; @@ -1848,8 +1744,7 @@ gzfile_write_raw(gz) } static VALUE -gzfile_read_raw_partial(arg) - VALUE arg; +gzfile_read_raw_partial(VALUE arg) { struct gzfile *gz = (struct gzfile*)arg; VALUE str; @@ -1860,8 +1755,7 @@ gzfile_read_raw_partial(arg) } static VALUE -gzfile_read_raw_rescue(arg) - VALUE arg; +gzfile_read_raw_rescue(VALUE arg) { struct gzfile *gz = (struct gzfile*)arg; VALUE str = Qnil; @@ -1875,8 +1769,7 @@ gzfile_read_raw_rescue(arg) } static VALUE -gzfile_read_raw(gz) - struct gzfile *gz; +gzfile_read_raw(struct gzfile *gz) { return rb_rescue2(gzfile_read_raw_partial, (VALUE)gz, gzfile_read_raw_rescue, (VALUE)gz, @@ -1884,9 +1777,7 @@ gzfile_read_raw(gz) } static int -gzfile_read_raw_ensure(gz, size) - struct gzfile *gz; - int size; +gzfile_read_raw_ensure(struct gzfile *gz, int size) { VALUE str; @@ -1899,9 +1790,7 @@ gzfile_read_raw_ensure(gz, size) } static char * -gzfile_read_raw_until_zero(gz, offset) - struct gzfile *gz; - long offset; +gzfile_read_raw_until_zero(struct gzfile *gz, long offset) { VALUE str; char *p; @@ -1921,8 +1810,7 @@ gzfile_read_raw_until_zero(gz, offset) } static unsigned int -gzfile_get16(src) - const unsigned char *src; +gzfile_get16(const unsigned char *src) { unsigned int n; n = *(src++) & 0xff; @@ -1931,8 +1819,7 @@ gzfile_get16(src) } static unsigned long -gzfile_get32(src) - const unsigned char *src; +gzfile_get32(const unsigned char *src) { unsigned long n; n = *(src++) & 0xff; @@ -1943,9 +1830,7 @@ gzfile_get32(src) } static void -gzfile_set32(n, dst) - unsigned long n; - unsigned char *dst; +gzfile_set32(unsigned long n, unsigned char *dst) { *(dst++) = n & 0xff; *(dst++) = (n >> 8) & 0xff; @@ -1954,8 +1839,7 @@ gzfile_set32(n, dst) } static void -gzfile_make_header(gz) - struct gzfile *gz; +gzfile_make_header(struct gzfile *gz) { Bytef buf[10]; /* the size of gzip header */ unsigned char flags = 0, extraflags = 0; @@ -1999,8 +1883,7 @@ gzfile_make_header(gz) } static void -gzfile_make_footer(gz) - struct gzfile *gz; +gzfile_make_footer(struct gzfile *gz) { Bytef buf[8]; /* 8 is the size of gzip footer */ @@ -2011,8 +1894,7 @@ gzfile_make_footer(gz) } static void -gzfile_read_header(gz) - struct gzfile *gz; +gzfile_read_header(struct gzfile *gz) { const unsigned char *head; long len; @@ -2087,8 +1969,7 @@ gzfile_read_header(gz) } static void -gzfile_check_footer(gz) - struct gzfile *gz; +gzfile_check_footer(struct gzfile *gz) { unsigned long crc, length; @@ -2113,10 +1994,7 @@ gzfile_check_footer(gz) } static void -gzfile_write(gz, str, len) - struct gzfile *gz; - Bytef *str; - uInt len; +gzfile_write(struct gzfile *gz, Bytef *str, uInt len) { if (!(gz->z.flags & GZFILE_FLAG_HEADER_FINISHED)) { gzfile_make_header(gz); @@ -2131,8 +2009,7 @@ gzfile_write(gz, str, len) } static long -gzfile_read_more(gz) - struct gzfile *gz; +gzfile_read_more(struct gzfile *gz) { volatile VALUE str; @@ -2154,9 +2031,7 @@ gzfile_read_more(gz) } static void -gzfile_calc_crc(gz, str) - struct gzfile *gz; - VALUE str; +gzfile_calc_crc(struct gzfile *gz, VALUE str) { if (RSTRING(str)->len <= gz->ungetc) { gz->ungetc -= RSTRING(str)->len; @@ -2169,9 +2044,7 @@ gzfile_calc_crc(gz, str) } static VALUE -gzfile_read(gz, len) - struct gzfile *gz; - int len; +gzfile_read(struct gzfile *gz, int len) { VALUE dst; @@ -2197,10 +2070,7 @@ gzfile_read(gz, len) } static VALUE -gzfile_readpartial(gz, len, outbuf) - struct gzfile *gz; - int len; - VALUE outbuf; +gzfile_readpartial(struct gzfile *gz, int len, VALUE outbuf) { VALUE dst; @@ -2245,8 +2115,7 @@ gzfile_readpartial(gz, len, outbuf) } static VALUE -gzfile_read_all(gz) - struct gzfile *gz; +gzfile_read_all(struct gzfile *gz) { VALUE dst; @@ -2268,17 +2137,14 @@ gzfile_read_all(gz) } static void -gzfile_ungetc(gz, c) - struct gzfile *gz; - int c; +gzfile_ungetc(struct gzfile *gz, int c) { zstream_buffer_ungetc(&gz->z, c); gz->ungetc++; } static VALUE -gzfile_writer_end_run(arg) - VALUE arg; +gzfile_writer_end_run(VALUE arg) { struct gzfile *gz = (struct gzfile *)arg; @@ -2294,8 +2160,7 @@ gzfile_writer_end_run(arg) } static void -gzfile_writer_end(gz) - struct gzfile *gz; +gzfile_writer_end(struct gzfile *gz) { if (ZSTREAM_IS_CLOSING(&gz->z)) return; gz->z.flags |= ZSTREAM_FLAG_CLOSING; @@ -2304,8 +2169,7 @@ gzfile_writer_end(gz) } static VALUE -gzfile_reader_end_run(arg) - VALUE arg; +gzfile_reader_end_run(VALUE arg) { struct gzfile *gz = (struct gzfile *)arg; @@ -2318,8 +2182,7 @@ gzfile_reader_end_run(arg) } static void -gzfile_reader_end(gz) - struct gzfile *gz; +gzfile_reader_end(struct gzfile *gz) { if (ZSTREAM_IS_CLOSING(&gz->z)) return; gz->z.flags |= ZSTREAM_FLAG_CLOSING; @@ -2328,8 +2191,7 @@ gzfile_reader_end(gz) } static void -gzfile_reader_rewind(gz) - struct gzfile *gz; +gzfile_reader_rewind(struct gzfile *gz) { long n; @@ -2343,8 +2205,7 @@ gzfile_reader_rewind(gz) } static VALUE -gzfile_reader_get_unused(gz) - struct gzfile *gz; +gzfile_reader_get_unused(struct gzfile *gz) { VALUE str; @@ -2361,8 +2222,7 @@ gzfile_reader_get_unused(gz) } static struct gzfile * -get_gzfile(obj) - VALUE obj; +get_gzfile(VALUE obj) { struct gzfile *gz; @@ -2388,8 +2248,7 @@ get_gzfile(obj) static VALUE -gzfile_ensure_close(obj) - VALUE obj; +gzfile_ensure_close(VALUE obj) { struct gzfile *gz; @@ -2404,10 +2263,7 @@ gzfile_ensure_close(obj) * See Zlib::GzipReader#wrap and Zlib::GzipWriter#wrap. */ static VALUE -rb_gzfile_s_wrap(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_gzfile_s_wrap(int argc, VALUE *argv, VALUE klass) { VALUE obj = rb_class_new_instance(argc, argv, klass); @@ -2423,11 +2279,7 @@ rb_gzfile_s_wrap(argc, argv, klass) * See Zlib::GzipReader#open and Zlib::GzipWriter#open. */ static VALUE -gzfile_s_open(argc, argv, klass, mode) - int argc; - VALUE *argv; - VALUE klass; - const char *mode; +gzfile_s_open(int argc, VALUE *argv, VALUE klass, const char *mode) { VALUE io, filename; @@ -2446,8 +2298,7 @@ gzfile_s_open(argc, argv, klass, mode) * Same as IO. */ static VALUE -rb_gzfile_to_io(obj) - VALUE obj; +rb_gzfile_to_io(VALUE obj) { return get_gzfile(obj)->io; } @@ -2456,8 +2307,7 @@ rb_gzfile_to_io(obj) * Returns CRC value of the uncompressed data. */ static VALUE -rb_gzfile_crc(obj) - VALUE obj; +rb_gzfile_crc(VALUE obj) { return rb_uint2inum(get_gzfile(obj)->crc); } @@ -2466,8 +2316,7 @@ rb_gzfile_crc(obj) * Returns last modification time recorded in the gzip file header. */ static VALUE -rb_gzfile_mtime(obj) - VALUE obj; +rb_gzfile_mtime(VALUE obj) { return rb_time_new(get_gzfile(obj)->mtime, (time_t)0); } @@ -2476,8 +2325,7 @@ rb_gzfile_mtime(obj) * Returns compression level. */ static VALUE -rb_gzfile_level(obj) - VALUE obj; +rb_gzfile_level(VALUE obj) { return INT2FIX(get_gzfile(obj)->level); } @@ -2486,8 +2334,7 @@ rb_gzfile_level(obj) * Returns OS code number recorded in the gzip file header. */ static VALUE -rb_gzfile_os_code(obj) - VALUE obj; +rb_gzfile_os_code(VALUE obj) { return INT2FIX(get_gzfile(obj)->os_code); } @@ -2497,8 +2344,7 @@ rb_gzfile_os_code(obj) * original filename is not present. */ static VALUE -rb_gzfile_orig_name(obj) - VALUE obj; +rb_gzfile_orig_name(VALUE obj) { VALUE str = get_gzfile(obj)->orig_name; if (!NIL_P(str)) { @@ -2513,8 +2359,7 @@ rb_gzfile_orig_name(obj) * is not present. */ static VALUE -rb_gzfile_comment(obj) - VALUE obj; +rb_gzfile_comment(VALUE obj) { VALUE str = get_gzfile(obj)->comment; if (!NIL_P(str)) { @@ -2528,8 +2373,7 @@ rb_gzfile_comment(obj) * ??? */ static VALUE -rb_gzfile_lineno(obj) - VALUE obj; +rb_gzfile_lineno(VALUE obj) { return INT2NUM(get_gzfile(obj)->lineno); } @@ -2538,8 +2382,7 @@ rb_gzfile_lineno(obj) * ??? */ static VALUE -rb_gzfile_set_lineno(obj, lineno) - VALUE obj, lineno; +rb_gzfile_set_lineno(VALUE obj, VALUE lineno) { struct gzfile *gz = get_gzfile(obj); gz->lineno = NUM2INT(lineno); @@ -2550,8 +2393,7 @@ rb_gzfile_set_lineno(obj, lineno) * ??? */ static VALUE -rb_gzfile_set_mtime(obj, mtime) - VALUE obj, mtime; +rb_gzfile_set_mtime(VALUE obj, VALUE mtime) { struct gzfile *gz = get_gzfile(obj); VALUE val; @@ -2574,8 +2416,7 @@ rb_gzfile_set_mtime(obj, mtime) * ??? */ static VALUE -rb_gzfile_set_orig_name(obj, str) - VALUE obj, str; +rb_gzfile_set_orig_name(VALUE obj, VALUE str) { struct gzfile *gz = get_gzfile(obj); VALUE s; @@ -2597,8 +2438,7 @@ rb_gzfile_set_orig_name(obj, str) * ??? */ static VALUE -rb_gzfile_set_comment(obj, str) - VALUE obj, str; +rb_gzfile_set_comment(VALUE obj, VALUE str) { struct gzfile *gz = get_gzfile(obj); VALUE s; @@ -2621,8 +2461,7 @@ rb_gzfile_set_comment(obj, str) * associated IO object. Returns the associated IO object. */ static VALUE -rb_gzfile_close(obj) - VALUE obj; +rb_gzfile_close(VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE io; @@ -2638,8 +2477,7 @@ rb_gzfile_close(obj) * object. */ static VALUE -rb_gzfile_finish(obj) - VALUE obj; +rb_gzfile_finish(VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE io; @@ -2653,8 +2491,7 @@ rb_gzfile_finish(obj) * Same as IO. */ static VALUE -rb_gzfile_closed_p(obj) - VALUE obj; +rb_gzfile_closed_p(VALUE obj) { struct gzfile *gz; Data_Get_Struct(obj, struct gzfile, gz); @@ -2665,8 +2502,7 @@ rb_gzfile_closed_p(obj) * ??? */ static VALUE -rb_gzfile_eof_p(obj) - VALUE obj; +rb_gzfile_eof_p(VALUE obj) { struct gzfile *gz = get_gzfile(obj); return GZFILE_IS_FINISHED(gz) ? Qtrue : Qfalse; @@ -2676,8 +2512,7 @@ rb_gzfile_eof_p(obj) * Same as IO. */ static VALUE -rb_gzfile_sync(obj) - VALUE obj; +rb_gzfile_sync(VALUE obj) { return (get_gzfile(obj)->z.flags & GZFILE_FLAG_SYNC) ? Qtrue : Qfalse; } @@ -2690,8 +2525,7 @@ rb_gzfile_sync(obj) * decreases sharply. */ static VALUE -rb_gzfile_set_sync(obj, mode) - VALUE obj, mode; +rb_gzfile_set_sync(VALUE obj, VALUE mode) { struct gzfile *gz = get_gzfile(obj); @@ -2708,8 +2542,7 @@ rb_gzfile_set_sync(obj, mode) * ??? */ static VALUE -rb_gzfile_total_in(obj) - VALUE obj; +rb_gzfile_total_in(VALUE obj) { return rb_uint2inum(get_gzfile(obj)->z.stream.total_in); } @@ -2718,8 +2551,7 @@ rb_gzfile_total_in(obj) * ??? */ static VALUE -rb_gzfile_total_out(obj) - VALUE obj; +rb_gzfile_total_out(VALUE obj) { struct gzfile *gz = get_gzfile(obj); return rb_uint2inum(gz->z.stream.total_out - gz->z.buf_filled); @@ -2756,8 +2588,7 @@ rb_gzfile_total_out(obj) */ static VALUE -rb_gzwriter_s_allocate(klass) - VALUE klass; +rb_gzwriter_s_allocate(VALUE klass) { return gzfile_writer_new(klass); } @@ -2770,10 +2601,7 @@ rb_gzwriter_s_allocate(klass) * this method are found in Zlib::GzipWriter.new and Zlib::GzipWriter#wrap. */ static VALUE -rb_gzwriter_s_open(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_gzwriter_s_open(int argc, VALUE *argv, VALUE klass) { return gzfile_s_open(argc, argv, klass, "wb"); } @@ -2787,10 +2615,7 @@ rb_gzwriter_s_open(argc, argv, klass) * +write+ method that behaves same as write method in IO class. */ static VALUE -rb_gzwriter_initialize(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz; VALUE io, level, strategy; @@ -2820,10 +2645,7 @@ rb_gzwriter_initialize(argc, argv, obj) * +flush+ is omitted. It is no use giving flush Zlib::NO_FLUSH. */ static VALUE -rb_gzwriter_flush(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzwriter_flush(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE v_flush; @@ -2847,8 +2669,7 @@ rb_gzwriter_flush(argc, argv, obj) * Same as IO. */ static VALUE -rb_gzwriter_write(obj, str) - VALUE obj, str; +rb_gzwriter_write(VALUE obj, VALUE str) { struct gzfile *gz = get_gzfile(obj); @@ -2863,8 +2684,7 @@ rb_gzwriter_write(obj, str) * Same as IO. */ static VALUE -rb_gzwriter_putc(obj, ch) - VALUE obj, ch; +rb_gzwriter_putc(VALUE obj, VALUE ch) { struct gzfile *gz = get_gzfile(obj); char c = NUM2CHR(ch); @@ -2955,8 +2775,7 @@ rb_gzwriter_putc(obj, ch) */ static VALUE -rb_gzreader_s_allocate(klass) - VALUE klass; +rb_gzreader_s_allocate(VALUE klass) { return gzfile_reader_new(klass); } @@ -2969,10 +2788,7 @@ rb_gzreader_s_allocate(klass) * are in Zlib::GzipReader.new and ZLib::GzipReader.wrap. */ static VALUE -rb_gzreader_s_open(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; +rb_gzreader_s_open(int argc, VALUE *argv, VALUE klass) { return gzfile_s_open(argc, argv, klass, "rb"); } @@ -2988,8 +2804,7 @@ rb_gzreader_s_open(argc, argv, klass) * exception. */ static VALUE -rb_gzreader_initialize(obj, io) - VALUE obj, io; +rb_gzreader_initialize(VALUE obj, VALUE io) { struct gzfile *gz; int err; @@ -3013,8 +2828,7 @@ rb_gzreader_initialize(obj, io) * object. The associated IO object needs to respond to the +seek+ method. */ static VALUE -rb_gzreader_rewind(obj) - VALUE obj; +rb_gzreader_rewind(VALUE obj) { struct gzfile *gz = get_gzfile(obj); gzfile_reader_rewind(gz); @@ -3026,8 +2840,7 @@ rb_gzreader_rewind(obj) * +nil+ if the whole gzip file is not parsed yet. */ static VALUE -rb_gzreader_unused(obj) - VALUE obj; +rb_gzreader_unused(VALUE obj) { struct gzfile *gz; Data_Get_Struct(obj, struct gzfile, gz); @@ -3038,10 +2851,7 @@ rb_gzreader_unused(obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_read(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_read(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE vlen; @@ -3070,10 +2880,7 @@ rb_gzreader_read(argc, argv, obj) * It raises EOFError on end of file. */ static VALUE -rb_gzreader_readpartial(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_readpartial(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE vlen, outbuf; @@ -3094,8 +2901,7 @@ rb_gzreader_readpartial(argc, argv, obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_getc(obj) - VALUE obj; +rb_gzreader_getc(VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE dst; @@ -3111,8 +2917,7 @@ rb_gzreader_getc(obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_readchar(obj) - VALUE obj; +rb_gzreader_readchar(VALUE obj) { VALUE dst; dst = rb_gzreader_getc(obj); @@ -3126,8 +2931,7 @@ rb_gzreader_readchar(obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_each_byte(obj) - VALUE obj; +rb_gzreader_each_byte(VALUE obj) { VALUE c; while (!NIL_P(c = rb_gzreader_getc(obj))) { @@ -3140,8 +2944,7 @@ rb_gzreader_each_byte(obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_ungetc(obj, ch) - VALUE obj, ch; +rb_gzreader_ungetc(VALUE obj, VALUE ch) { struct gzfile *gz = get_gzfile(obj); gzfile_ungetc(gz, NUM2CHR(ch)); @@ -3149,8 +2952,7 @@ rb_gzreader_ungetc(obj, ch) } static void -gzreader_skip_linebreaks(gz) - struct gzfile *gz; +gzreader_skip_linebreaks(struct gzfile *gz) { VALUE str; char *p; @@ -3181,20 +2983,14 @@ gzreader_skip_linebreaks(gz) } static void -rscheck(rsptr, rslen, rs) - char *rsptr; - long rslen; - VALUE rs; +rscheck(char *rsptr, long rslen, VALUE rs) { if (RSTRING(rs)->ptr != rsptr && RSTRING(rs)->len != rslen) rb_raise(rb_eRuntimeError, "rs modified"); } static VALUE -gzreader_gets(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +gzreader_gets(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); volatile VALUE rs; @@ -3274,10 +3070,7 @@ gzreader_gets(argc, argv, obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_gets(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_gets(int argc, VALUE *argv, VALUE obj) { VALUE dst; dst = gzreader_gets(argc, argv, obj); @@ -3291,10 +3084,7 @@ rb_gzreader_gets(argc, argv, obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_readline(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_readline(int argc, VALUE *argv, VALUE obj) { VALUE dst; dst = rb_gzreader_gets(argc, argv, obj); @@ -3308,10 +3098,7 @@ rb_gzreader_readline(argc, argv, obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_each(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_each(int argc, VALUE *argv, VALUE obj) { VALUE str; while (!NIL_P(str = gzreader_gets(argc, argv, obj))) { @@ -3324,10 +3111,7 @@ rb_gzreader_each(argc, argv, obj) * See Zlib::GzipReader documentation for a description. */ static VALUE -rb_gzreader_readlines(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; +rb_gzreader_readlines(int argc, VALUE *argv, VALUE obj) { VALUE str, dst; dst = rb_ary_new(); -- cgit v1.2.3