aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-05-15 08:27:58 +1000
committerGravatar axel <axel@liljencrantz.se>2006-05-15 08:27:58 +1000
commit3d601bd75179e579bd76617c85f67c7fe0fca2f7 (patch)
tree13482e75d739c3048e0a49277776bfebbd2c24f9
parentc9deea223769c1615e98ed220c45c8a273a07dbe (diff)
Remove superflous event_signal_listen function, replace all calls to it with event_get
darcs-hash:20060514222758-ac50b-de4457154510b89d1c9b893bc39f06a23c8fc08f.gz
-rw-r--r--event.c21
-rw-r--r--event.h5
-rw-r--r--signal.c16
3 files changed, 13 insertions, 29 deletions
diff --git a/event.c b/event.c
index 6c42414e..88eaac5b 100644
--- a/event.c
+++ b/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;
-
-
-}
diff --git a/event.h b/event.h
index 9b09938e..9bd3f81b 100644
--- a/event.h
+++ b/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
diff --git a/signal.c b/signal.c
index 8b886429..29e3e466 100644
--- a/signal.c
+++ b/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