From 73f94bb851588f04e5189d37544e87884fc489c7 Mon Sep 17 00:00:00 2001 From: ocean Date: Fri, 21 Oct 2005 06:46:41 +0000 Subject: * intern.h, struct.c (rb_struct_iv_get): constified. * marshal.c: avoid one VC++6 warning for implicit conversion from int to char. * ruby.h: ANSI styled. * bcc32/Makefile.sub (HAVE_HYPOT): added. * ext/socket/extconf.rb: BeOS is only one platform should call closesocket, so check __BEOS__ macro directly. (I was worried accidently HAVE_CLOSESOCKET is defined on windows again because it has it) * ext/socket/{getaddrinfo.c,socket.c}: ditto. ... these are all cosmetic changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 20 ++++++++++++++++++++ bcc32/Makefile.sub | 1 + ext/socket/extconf.rb | 1 - ext/socket/getaddrinfo.c | 2 +- ext/socket/socket.c | 2 +- intern.h | 2 +- marshal.c | 12 ++++++------ ruby.h | 15 --------------- struct.c | 8 +++----- 9 files changed, 33 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5f60406e0..66068301b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Fri Oct 21 15:42:28 2005 Hirokazu Yamamoto + + * intern.h, struct.c (rb_struct_iv_get): constified. + + * marshal.c: avoid one VC++6 warning for implicit conversion + from int to char. + + * ruby.h: ANSI styled. + + * bcc32/Makefile.sub (HAVE_HYPOT): added. + + * ext/socket/extconf.rb: BeOS is only one platform should call + closesocket, so check __BEOS__ macro directly. (I was worried + accidently HAVE_CLOSESOCKET is defined on windows again because + it has it) + + * ext/socket/{getaddrinfo.c,socket.c}: ditto. + + ... these are all cosmetic changes. + Fri Oct 21 15:23:23 2005 Hirokazu Yamamoto * bignum.c (bignew_1): convertion from `int' to `char' discards diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub index 3f19841697..53b908f658 100644 --- a/bcc32/Makefile.sub +++ b/bcc32/Makefile.sub @@ -255,6 +255,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub \#define HAVE_VSNPRINTF 1 \#define HAVE_ISNAN 1 \#define HAVE_FINITE 1 +\#define HAVE_HYPOT 1 \#define HAVE_FMOD 1 \#define HAVE_WAITPID 1 \#define HAVE_FSYNC 1 diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index da498639ad..a83afa558d 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -9,7 +9,6 @@ when /cygwin/ when /beos/ test_func = "socket" have_library("net", "socket") - have_func("closesocket") when /i386-os2_emx/ test_func = "socket" have_library("socket", "socket") diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index 14bedb2e9b..02f2ab9d35 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -437,7 +437,7 @@ getaddrinfo(hostname, servname, hints, res) s = socket(afd->a_af, SOCK_DGRAM, 0); if (s < 0) continue; -#if defined(HAVE_CLOSESOCKET) +#if defined(__BEOS__) closesocket(s); #else close(s); diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 6a787629f8..1037c8546b 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -193,7 +193,7 @@ ruby_getaddrinfo__aix(nodename, servname, hints, res) #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res)) #endif -#ifdef HAVE_CLOSESOCKET +#ifdef __BEOS__ #undef close #define close closesocket #endif diff --git a/intern.h b/intern.h index 4cd58b31d3..4df7106a7a 100644 --- a/intern.h +++ b/intern.h @@ -518,7 +518,7 @@ VALUE rb_struct_alloc(VALUE, VALUE); VALUE rb_struct_aref(VALUE, VALUE); VALUE rb_struct_aset(VALUE, VALUE, VALUE); VALUE rb_struct_getmember(VALUE, ID); -VALUE rb_struct_iv_get(VALUE, char*); +VALUE rb_struct_iv_get(VALUE, const char*); VALUE rb_struct_s_members(VALUE); VALUE rb_struct_members(VALUE); /* time.c */ diff --git a/marshal.c b/marshal.c index cbc9f5ec42..17adae3bc6 100644 --- a/marshal.c +++ b/marshal.c @@ -116,7 +116,7 @@ class2path(VALUE klass) static void w_long(long, struct dump_arg*); static void -w_nbyte(char *s, int n, struct dump_arg *arg) +w_nbyte(const char *s, int n, struct dump_arg *arg) { VALUE buf = arg->str; rb_str_buf_cat(buf, s, n); @@ -134,7 +134,7 @@ w_byte(char c, struct dump_arg *arg) } static void -w_bytes(char *s, int n, struct dump_arg *arg) +w_bytes(const char *s, int n, struct dump_arg *arg) { w_long(n, arg); w_nbyte(s, n, arg); @@ -319,7 +319,7 @@ w_symbol(ID id, struct dump_arg *arg) } static void -w_unique(char *s, struct dump_arg *arg) +w_unique(const char *s, struct dump_arg *arg) { if (s[0] == '#') { rb_raise(rb_eTypeError, "can't dump anonymous class %s", s); @@ -358,7 +358,7 @@ w_extended(VALUE klass, struct dump_arg *arg, int check) } static void -w_class(int type, VALUE obj, struct dump_arg *arg, int check) +w_class(char type, VALUE obj, struct dump_arg *arg, int check) { char *path; @@ -908,7 +908,7 @@ r_ivar(VALUE obj, struct load_arg *arg) } static VALUE -path2class(char *path) +path2class(const char *path) { VALUE v = rb_path2class(path); @@ -919,7 +919,7 @@ path2class(char *path) } static VALUE -path2module(char *path) +path2module(const char *path) { VALUE v = rb_path2class(path); diff --git a/ruby.h b/ruby.h index 52e9fdd28c..02b305ad18 100644 --- a/ruby.h +++ b/ruby.h @@ -655,12 +655,7 @@ RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr; RUBY_EXTERN VALUE ruby_errinfo; static inline VALUE -#if defined(HAVE_PROTOTYPES) rb_class_of(VALUE obj) -#else -rb_class_of(obj) - VALUE obj; -#endif { if (IMMEDIATE_P(obj)) { if (FIXNUM_P(obj)) return rb_cFixnum; @@ -675,12 +670,7 @@ rb_class_of(obj) } static inline int -#if defined(HAVE_PROTOTYPES) rb_type(VALUE obj) -#else -rb_type(obj) - VALUE obj; -#endif { if (IMMEDIATE_P(obj)) { if (FIXNUM_P(obj)) return T_FIXNUM; @@ -696,12 +686,7 @@ rb_type(obj) } static inline int -#if defined(HAVE_PROTOTYPES) rb_special_const_p(VALUE obj) -#else -rb_special_const_p(obj) - VALUE obj; -#endif { if (SPECIAL_CONST_P(obj)) return Qtrue; return Qfalse; diff --git a/struct.c b/struct.c index 674fc9c62d..1cc4d38b08 100644 --- a/struct.c +++ b/struct.c @@ -17,7 +17,7 @@ VALUE rb_cStruct; static VALUE struct_alloc(VALUE); VALUE -rb_struct_iv_get(VALUE c, char *name) +rb_struct_iv_get(VALUE c, const char *name) { ID id; @@ -123,9 +123,9 @@ static VALUE rb_struct_ref7(VALUE obj) {return RSTRUCT(obj)->ptr[7];} static VALUE rb_struct_ref8(VALUE obj) {return RSTRUCT(obj)->ptr[8];} static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT(obj)->ptr[9];} -#define N_REF_FUNC (sizeof(ref_func) / sizeof(VALUE (*)())) +#define N_REF_FUNC (sizeof(ref_func) / sizeof(ref_func[0])) -static VALUE (*ref_func[])() = { +static VALUE (*ref_func[])(VALUE) = { rb_struct_ref0, rb_struct_ref1, rb_struct_ref2, @@ -214,8 +214,6 @@ make_struct(VALUE name, VALUE members, VALUE klass) return nstr; } -#include - VALUE rb_struct_define(const char *name, ...) { -- cgit v1.2.3