mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Remove superflous event_signal_listen function, replace all calls to it with event_get
darcs-hash:20060514222758-ac50b-de4457154510b89d1c9b893bc39f06a23c8fc08f.gz
This commit is contained in:
parent
c9deea2237
commit
3d601bd751
3 changed files with 13 additions and 29 deletions
21
event.c
21
event.c
|
@ -654,24 +654,3 @@ void event_free( event_t *e )
|
|||
free( e );
|
||||
}
|
||||
|
||||
int event_signal_listen( int signal )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !events )
|
||||
return 0;
|
||||
|
||||
for( i=0; i<al_get_count( events ); i++ )
|
||||
{
|
||||
event_t *e = (event_t *)al_get( events, i );
|
||||
|
||||
if( e->type == EVENT_SIGNAL &&
|
||||
(e->param1.signal == signal || e->param1.signal == EVENT_ANY_SIGNAL) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
|
5
event.h
5
event.h
|
@ -136,9 +136,4 @@ void event_free( event_t *e );
|
|||
*/
|
||||
const wchar_t *event_get_desc( event_t *e );
|
||||
|
||||
/**
|
||||
Returns a non-zero status if there are event listeners that fire on the specified signal
|
||||
*/
|
||||
int event_signal_listen( int signal );
|
||||
|
||||
#endif
|
||||
|
|
16
signal.c
16
signal.c
|
@ -426,7 +426,11 @@ static void default_handler(int signal, siginfo_t *info, void *context)
|
|||
e.param1.signal = signal;
|
||||
e.function_name=0;
|
||||
|
||||
event_fire( &e );
|
||||
if( event_get( &e, 0 ) )
|
||||
{
|
||||
|
||||
event_fire( &e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -443,7 +447,13 @@ static void handle_winch( int sig, siginfo_t *info, void *context )
|
|||
*/
|
||||
static void handle_hup( int sig, siginfo_t *info, void *context )
|
||||
{
|
||||
if( event_signal_listen( SIGHUP ) )
|
||||
event_t e;
|
||||
|
||||
e.type=EVENT_SIGNAL;
|
||||
e.param1.signal = SIGHUP;
|
||||
e.function_name=0;
|
||||
|
||||
if( event_get( &e, 0 ) )
|
||||
{
|
||||
default_handler( sig, 0, 0 );
|
||||
}
|
||||
|
@ -502,7 +512,7 @@ void signal_set_handlers()
|
|||
sigemptyset( & act.sa_mask );
|
||||
act.sa_flags=SA_SIGINFO;
|
||||
act.sa_sigaction = &default_handler;
|
||||
|
||||
|
||||
/*
|
||||
First reset everything to a use default_handler, a function
|
||||
whose sole action is to fire of an event
|
||||
|
|
Loading…
Reference in a new issue