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:
axel 2006-05-15 08:27:58 +10:00
parent c9deea2237
commit 3d601bd751
3 changed files with 13 additions and 29 deletions

21
event.c
View file

@ -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;
}

View file

@ -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

View file

@ -426,8 +426,12 @@ static void default_handler(int signal, siginfo_t *info, void *context)
e.param1.signal = signal;
e.function_name=0;
if( event_get( &e, 0 ) )
{
event_fire( &e );
}
}
/**
Respond to a winch signal by checking the terminal size
@ -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 );
}