зеркало из https://github.com/github/ruby.git
* error.c (builtin_types), signal.c (siglist), st.c (primes),
struct.c (ref_func), time.c (months): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
61234dab9c
Коммит
e615e3ce30
|
@ -1,3 +1,8 @@
|
|||
Sat Apr 26 17:30:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* lib/open3.rb: double fork is replaced by spawn with Process.detach.
|
||||
|
|
9
error.c
9
error.c
|
@ -238,7 +238,7 @@ rb_compile_bug(const char *file, int line, const char *fmt, ...)
|
|||
abort();
|
||||
}
|
||||
|
||||
static struct types {
|
||||
static const struct types {
|
||||
int type;
|
||||
const char *name;
|
||||
} builtin_types[] = {
|
||||
|
@ -263,20 +263,21 @@ static struct types {
|
|||
{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;
|
||||
|
||||
|
|
16
signal.c
16
signal.c
|
@ -36,7 +36,7 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
static struct signals {
|
||||
static const struct signals {
|
||||
const char *signm;
|
||||
int signo;
|
||||
} siglist [] = {
|
||||
|
@ -178,7 +178,7 @@ static struct signals {
|
|||
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 @@ signm2signo(const char *nm)
|
|||
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 @@ static struct {
|
|||
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 @@ ruby_signal(int signum, sighandler_t handler)
|
|||
{
|
||||
struct sigaction sigact, old;
|
||||
|
||||
#if 0
|
||||
rb_trap_accept_nativethreads[signum] = 0;
|
||||
#endif
|
||||
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
#ifdef SA_SIGINFO
|
||||
|
@ -443,8 +447,8 @@ posix_signal(int signum, sighandler_t handler)
|
|||
}
|
||||
|
||||
#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 @@ static VALUE
|
|||
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));
|
||||
|
|
2
st.c
2
st.c
|
@ -82,7 +82,7 @@ static void rehash(st_table *);
|
|||
/*
|
||||
Table of prime numbers 2^n+a, 2<=n<=30.
|
||||
*/
|
||||
static long primes[] = {
|
||||
static const long primes[] = {
|
||||
8 + 3,
|
||||
16 + 3,
|
||||
32 + 5,
|
||||
|
|
2
struct.c
2
struct.c
|
@ -127,7 +127,7 @@ static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT_PTR(obj)[9];}
|
|||
|
||||
#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,
|
||||
|
|
2
time.c
2
time.c
|
@ -327,7 +327,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
|
|||
return t;
|
||||
}
|
||||
|
||||
static const char *months[] = {
|
||||
static const char *const months[] = {
|
||||
"jan", "feb", "mar", "apr", "may", "jun",
|
||||
"jul", "aug", "sep", "oct", "nov", "dec",
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче