diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-01-03 10:03:34 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-01-03 10:03:34 +0000 |
commit | 7d66859277280e48eb717756cd0b1f50b3ea2054 (patch) | |
tree | b723f02f03da252c4e1dba6e6f7ca55e958e43fc /src/interface.c | |
parent | a9b581f6c551e783030a8ce54008a772325f71b6 (diff) | |
download | mpd-7d66859277280e48eb717756cd0b1f50b3ea2054.tar.gz mpd-7d66859277280e48eb717756cd0b1f50b3ea2054.tar.xz mpd-7d66859277280e48eb717756cd0b1f50b3ea2054.zip |
ioops: make this zero-impact when compiling w/o zeroconf as well
This reduces the text size of the binary slightly when zeroconf
support is not built, and keeps the interface code cleaner as
well.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7133 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/interface.c | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/src/interface.c b/src/interface.c index 76770a15f..289ed8066 100644 --- a/src/interface.c +++ b/src/interface.c @@ -49,9 +49,6 @@ static size_t interface_max_command_list_size = static size_t interface_max_output_buffer_size = INTERFACE_MAX_OUTPUT_BUFFER_SIZE_DEFAULT; -/* List of registered external IO handlers */ -static struct ioOps *ioList; - /* maybe make conf option for this, or... 32 might be good enough */ static long int interface_list_cache_size = 32; @@ -487,41 +484,18 @@ int doIOForInterfaces(void) while (1) { fdmax = 0; - FD_ZERO( &rfds ); - FD_ZERO( &wfds ); FD_ZERO( &efds ); addInterfacesReadyToReadAndListenSocketToFdSet(&rfds, &fdmax); addInterfacesForBufferFlushToFdSet(&wfds, &fdmax); - /* Add fds for all registered IO handlers */ - if( ioList ) { - struct ioOps *o = ioList; - while( o ) { - struct ioOps *current = o; - int fdnum; - assert( current->fdset ); - fdnum = current->fdset( &rfds, &wfds, &efds ); - if( fdmax < fdnum ) - fdmax = fdnum; - o = o->next; - } - } + registered_IO_add_fds(&fdmax, &rfds, &wfds, &efds); selret = select(fdmax + 1, &rfds, &wfds, &efds, &tv); if (selret < 0 && errno == EINTR) break; - /* Consume fds for all registered IO handlers */ - if( ioList ) { - struct ioOps *o = ioList; - while( o ) { - struct ioOps *current = o; - assert( current->consume ); - selret = current->consume( selret, &rfds, &wfds, &efds ); - o = o->next; - } - } + registered_IO_consume_fds(&selret, &rfds, &wfds, &efds); if (selret == 0) break; @@ -810,24 +784,3 @@ static void printInterfaceOutBuffer(Interface * interface) interface->send_buf_used = 0; } -/* From ioops.h: */ -void registerIO(struct ioOps *ops) -{ - assert(ops != NULL); - - ops->next = ioList; - ioList = ops; - ops->prev = NULL; - if (ops->next) - ops->next->prev = ops; -} - -void deregisterIO(struct ioOps *ops) -{ - assert(ops != NULL); - - if (ioList == ops) - ioList = ops->next; - else if (ops->prev != NULL) - ops->prev->next = ops->next; -} |