ruby-changes:4705
From: ko1@a...
Date: Sat, 26 Apr 2008 17:30:47 +0900 (JST)
Subject: [ruby-changes:4705] nobu - Ruby:r16199 (trunk): * error.c (builtin_types), signal.c (siglist), st.c (primes),
nobu 2008-04-26 17:30:22 +0900 (Sat, 26 Apr 2008) New Revision: 16199 Modified files: trunk/ChangeLog trunk/error.c trunk/signal.c trunk/st.c trunk/struct.c trunk/time.c Log: * error.c (builtin_types), signal.c (siglist), st.c (primes), struct.c (ref_func), time.c (months): constified. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/time.c?r1=16199&r2=16198&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16199&r2=16198&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/struct.c?r1=16199&r2=16198&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/signal.c?r1=16199&r2=16198&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/error.c?r1=16199&r2=16198&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/st.c?r1=16199&r2=16198&diff_format=u Index: time.c =================================================================== --- time.c (revision 16198) +++ time.c (revision 16199) @@ -327,7 +327,7 @@ return t; } -static const char *months[] = { +static const char *const months[] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", }; Index: ChangeLog =================================================================== --- ChangeLog (revision 16198) +++ ChangeLog (revision 16199) @@ -1,3 +1,8 @@ +Sat Apr 26 17:30:18 2008 Nobuyoshi Nakada <nobu@r...> + + * error.c (builtin_types), signal.c (siglist), st.c (primes), + struct.c (ref_func), time.c (months): constified. + Sat Apr 26 13:00:41 2008 Tanaka Akira <akr@f...> * lib/open3.rb: double fork is replaced by spawn with Process.detach. Index: st.c =================================================================== --- st.c (revision 16198) +++ st.c (revision 16199) @@ -82,7 +82,7 @@ /* Table of prime numbers 2^n+a, 2<=n<=30. */ -static long primes[] = { +static const long primes[] = { 8 + 3, 16 + 3, 32 + 5, Index: struct.c =================================================================== --- struct.c (revision 16198) +++ struct.c (revision 16199) @@ -127,7 +127,7 @@ #define N_REF_FUNC (sizeof(ref_func) / sizeof(ref_func[0])) -static VALUE (*ref_func[])(VALUE) = { +static VALUE (*const ref_func[])(VALUE) = { rb_struct_ref0, rb_struct_ref1, rb_struct_ref2, Index: error.c =================================================================== --- error.c (revision 16198) +++ error.c (revision 16199) @@ -238,7 +238,7 @@ abort(); } -static struct types { +static const struct types { int type; const char *name; } builtin_types[] = { @@ -263,20 +263,21 @@ {T_MATCH, "MatchData"}, /* data of $~ */ {T_NODE, "Node"}, /* internal use: syntax tree node */ {T_UNDEF, "undef"}, /* internal use: #undef; should not happen */ - {-1, 0} }; void rb_check_type(VALUE x, int t) { - struct types *type = builtin_types; + const struct types *type = builtin_types; + const struct types *const typeend = builtin_types + + sizeof(builtin_types) / sizeof(builtin_types[0]); if (x == Qundef) { rb_bug("undef leaked to the Ruby space"); } if (TYPE(x) != t) { - while (type->type >= 0) { + while (type < typeend) { if (type->type == t) { const char *etype; Index: signal.c =================================================================== --- signal.c (revision 16198) +++ signal.c (revision 16199) @@ -36,7 +36,7 @@ # endif #endif -static struct signals { +static const struct signals { const char *signm; int signo; } siglist [] = { @@ -178,7 +178,7 @@ static int signm2signo(const char *nm) { - struct signals *sigs; + const struct signals *sigs; for (sigs = siglist; sigs->signm; sigs++) if (strcmp(sigs->signm, nm) == 0) @@ -189,7 +189,7 @@ static const char* signo2signm(int no) { - struct signals *sigs; + const struct signals *sigs; for (sigs = siglist; sigs->signm; sigs++) if (sigs->signo == no) @@ -381,7 +381,9 @@ VALUE cmd; } trap_list[NSIG]; static rb_atomic_t trap_pending_list[NSIG]; +#if 0 static char rb_trap_accept_nativethreads[NSIG]; +#endif rb_atomic_t rb_trap_pending; rb_atomic_t rb_trap_immediate; int rb_prohibit_interrupt = 1; @@ -417,7 +419,9 @@ { struct sigaction sigact, old; +#if 0 rb_trap_accept_nativethreads[signum] = 0; +#endif sigemptyset(&sigact.sa_mask); #ifdef SA_SIGINFO @@ -443,8 +447,8 @@ } #else /* !POSIX_SIGNAL */ -#define ruby_signal(sig,handler) (rb_trap_accept_nativethreads[sig] = 0, signal((sig),(handler))) -#ifdef HAVE_NATIVETHREAD +#define ruby_signal(sig,handler) (/* rb_trap_accept_nativethreads[sig] = 0,*/ signal((sig),(handler))) +#if 0 /* def HAVE_NATIVETHREAD */ static sighandler_t ruby_nativethread_signal(int signum, sighandler_t handler) { @@ -938,7 +942,7 @@ sig_list(void) { VALUE h = rb_hash_new(); - struct signals *sigs; + const struct signals *sigs; for (sigs = siglist; sigs->signm; sigs++) { rb_hash_aset(h, rb_str_new2(sigs->signm), INT2FIX(sigs->signo)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/