diff --git a/ChangeLog b/ChangeLog index ad1317e54e..97753c97f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Nov 8 17:35:53 2005 Hirokazu Yamamoto + + * intern.h, eval.c (rb_thread_signal_raise): costified. + + * signal.c: cosmetic change. + Tue Nov 8 15:32:27 2005 GOTOU Yuuzou * lib/drb/ssl.rb (DRb::SSLConfig#accept): fixed typo. diff --git a/eval.c b/eval.c index d5048d9465..b98746e517 100644 --- a/eval.c +++ b/eval.c @@ -10014,7 +10014,7 @@ static VALUE th_raise_exception; static NODE *th_raise_node; static VALUE th_cmd; static int th_sig, th_safe; -static char *th_signm; +static const char *th_signm; #define RESTORE_NORMAL 1 #define RESTORE_FATAL 2 @@ -12101,7 +12101,7 @@ rb_thread_interrupt(void) } void -rb_thread_signal_raise(char *sig) +rb_thread_signal_raise(const char *sig) { if (sig == 0) return; /* should not happen */ rb_thread_critical = 0; @@ -12115,7 +12115,7 @@ rb_thread_signal_raise(char *sig) return; } } - th_signm = sig; + th_signm = sig; /* should be literal */ curr_thread = main_thread; rb_thread_restore_context(curr_thread, RESTORE_SIGNAL); } diff --git a/intern.h b/intern.h index ec08a3f5fa..7c33d7c225 100644 --- a/intern.h +++ b/intern.h @@ -273,7 +273,7 @@ VALUE rb_thread_kill(VALUE); VALUE rb_thread_create(VALUE (*)(ANYARGS), void*); void rb_thread_interrupt(void); void rb_thread_trap_eval(VALUE, int, int); -void rb_thread_signal_raise(char*); +void rb_thread_signal_raise(const char*); /* should pass literal */ void rb_thread_signal_exit(void); int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); void rb_thread_wait_for(struct timeval); diff --git a/signal.c b/signal.c index 48820c0308..2bbf9e84b9 100644 --- a/signal.c +++ b/signal.c @@ -30,7 +30,7 @@ #endif static struct signals { - char *signm; + const char *signm; int signo; } siglist [] = { {"EXIT", 0}, @@ -169,7 +169,7 @@ static struct signals { }; static int -signm2signo(char *nm) +signm2signo(const char *nm) { struct signals *sigs; @@ -179,7 +179,7 @@ signm2signo(char *nm) return 0; } -static char* +static const char* signo2signm(int no) { struct signals *sigs; @@ -325,9 +325,7 @@ typedef RETSIGTYPE (*sighandler_t)(int); #ifdef POSIX_SIGNAL static sighandler_t -ruby_signal(signum, handler) - int signum; - sighandler_t handler; +ruby_signal(int signum, sighandler_t handler) { struct sigaction sigact, old; @@ -345,18 +343,14 @@ ruby_signal(signum, handler) } void -posix_signal(signum, handler) - int signum; - sighandler_t handler; +posix_signal(int signum, sighandler_t handler) { ruby_signal(signum, handler); } #ifdef HAVE_NATIVETHREAD static sighandler_t -ruby_nativethread_signal(signum, handler) - int signum; - sighandler_t handler; +ruby_nativethread_signal(int signum, sighandler_t handler) { sighandler_t old; @@ -366,9 +360,7 @@ ruby_nativethread_signal(signum, handler) } void -posix_nativethread_signal(signum, handler) - int signum; - sighandler_t handler; +posix_nativethread_signal(int signum, sighandler_t handler) { ruby_nativethread_signal(signum, handler); } @@ -445,7 +437,6 @@ sigsend_to_ruby_thread(int sig) } #endif -static RETSIGTYPE sighandler(int); static RETSIGTYPE sighandler(int sig) { @@ -707,8 +698,7 @@ trap(struct trap_arg *arg) #ifndef _WIN32 static VALUE -trap_ensure(arg) - struct trap_arg *arg; +trap_ensure(struct trap_arg *arg) { /* enable interrupt */ #ifdef HAVE_SIGPROCMASK